2013-02-13 1 views
0

셀렌 테스트에서 SQL Server에 연결해야합니다. jtds 1.3 드라이버를 사용하여 프로젝트의 Buildpath에 추가합니다. 오류java.lang.ClassNotFoundException : net.sourceforge.jtds.jdbc.Drive

java.lang.ClassNotFoundException: net.sourceforge.jtds.jdbc.Drive 
at java.net.URLClassLoader$1.run(URLClassLoader.java:366) 
at java.net.URLClassLoader$1.run(URLClassLoader.java:355) 
at java.security.AccessController.doPrivileged(Native Method) 
at java.net.URLClassLoader.findClass(URLClassLoader.java:354) 
at java.lang.ClassLoader.loadClass(ClassLoader.java:423) 
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) 
at java.lang.ClassLoader.loadClass(ClassLoader.java:356) 
at java.lang.Class.forName0(Native Method) 
at java.lang.Class.forName(Class.java:186) 
at com.SQLConnection.connectToSQL(SQLConnection.java:16) 
at com.SqlRun.insert(SqlRun.java:58) 
at com.SqlRun.insert(SqlRun.java:80) 
at com.test.SQLRequest.checkTestPreconditions(SQLRequest.java:39) 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
at java.lang.reflect.Method.invoke(Method.java:601) 
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80) 
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:564) 
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213) 
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138) 
at org.testng.TestRunner.beforeRun(TestRunner.java:641) 
at org.testng.TestRunner.run(TestRunner.java:609) 
at org.testng.SuiteRunner.runTest(SuiteRunner.java:334) 
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329) 
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291) 
at org.testng.SuiteRunner.run(SuiteRunner.java:240) 
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) 
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) 
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1203) 
at org.testng.TestNG.runSuitesLocally(TestNG.java:1128) 
at org.testng.TestNG.run(TestNG.java:1036) 
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111) 
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204) 
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175) 

답변

1

java.sql.Driver 인터페이스의 jTDS를 구현 Driver하지 Drive 인에게 얻을

Class.forName("net.sourceforge.jtds.jdbc.Drive"); 
String url = "jdbc:jtds:sqlserver:localhost:1433/db_name;instance=SQLEXPRESS;"; 
final Connection con = DriverManager.getConnection(url, "login", "password"); 

하지만 난 내 프로젝트를 실행 : 여기

의 연결 코드입니다.

트릭 어떻게해야 당신의 Class#forName 방법 매개 변수를 변경 :

Class.forName("net.sourceforge.jtds.jdbc.Driver");