Error while executing Java code in RFT
I am using RFT(Rational Functional Tester) 8.2 for my automation. I am getting error when I am doing the following steps
- I using Microsoft Excel ODBC Driver to connect to excel sheet from Java program.
- I cant able to connect to the excel driver. I am getting the below error message.
This is my Code
Connection c1 =null;
c1 = java.sql.DriverManager.getConnection( "jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};DBQ="+SummaryExcelfile+";READONLY=FALSE");
This is my exception
java.sql.SQLException: [Microsoft][ODBC Excel Driver] System resource exceeded. at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6957) at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7114) at sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(JdbcOdbc.java:3073) at sun.jdbc.odbc.JdbcOdbcConnection.initialize(JdbcOdbcConnection.java:323) at sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDriver.java:174) at java.sql.DriverManager.getConnection(DriverManager.java:322) at java.sql.DriverManager.getConnection(DriverManager.java:273) at SupportLibraries.CRAFT_ExcelResults.createSummaryHeader(CRAFT_ExcelResults.java:230) at SupportLibraries.CRAFT_Report.createSummaryHeader(CRAFT_Report.java:63) at Allocator.testMain(Allocator.java:89) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:600) at com.rational.test.ft.sys.FtReflection.invokeMethod2Ext(FtReflection.java:1253) at com.rational.test.ft.sys.FtReflection.invokeMethodExt(FtReflection.java:1453) at com.rational.test.ft.sys.FtReflection.invokeMethodExt(FtReflection.java:1806) at com.rational.test.ft.script.RationalTestScript.runMainInner(RationalTestScript.java:999) at com.rational.test.ft.script.RationalTestScript.runMain(RationalTestScript.java:924) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:600) at com.rational.test.ft.sys.FtReflection.invokeMethod2Ext(FtReflection.java:1253) at com.rational.test.ft.sys.FtReflection.invokeMethodExt(FtReflection.java:1453) at com.rational.test.ft.sys.FtReflection.invokeMethodExt(FtReflection.java:1806) at com.rational.test.ft.application.ScriptPlayback.runScript(ScriptPlayback.java:734) at com.rational.test.ft.application.ScriptPlayback.run(ScriptPlayback.java:671) at com.rational.test.ft.application.Rationa开发者_运维技巧lFtMain.run(RationalFtMain.java:2356) at com.rational.test.ft.application.RationalFtMain.main(RationalFtMain.java:344) at com.rational.test.ft.application.CommandLineApplication.run(CommandLineApplication.java:40) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:600) at org.eclipse.equinox.internal.app.EclipseAppContainer.callMethodWithException(EclipseAppContainer.java:587) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:198) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:600) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574) at org.eclipse.equinox.launcher.Main.run(Main.java:1407) at org.eclipse.equinox.launcher.Main.main(Main.java:1383) at org.eclipse.core.launcher.Main.main(Main.java:34) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:600) at com.rational.test.ft.rational_ft.startFT(rational_ft.java:316) at com.rational.test.ft.rational_ft.main(rational_ft.java:187)
An easier way to work with Excel in Java is to use Apache POI or JExcel. Your code looks fine to me as long as that path variable is correct. You might want to check your datasources and make sure you have the ODBC .xls driver.
精彩评论