on 2012 Jul 17 6:39 AM
when executing the IsqlApp class I'm having a ClassNotFoundException. According to me the file should not be looking for that driver but the one in the jconn4.jar (I installed Jconnect7)
How can I solve this problem?
Unexpected exception : java.lang.ClassNotFoundException: com.sybase.jdbc.SybDriv er java.lang.ClassNotFoundException: com.sybase.jdbc.SybDriver at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at IsqlApp.doIsql(IsqlApp.java:86) at IsqlApp.main(IsqlApp.java:58)
Request clarification before answering.
You have the wrong classname being loaded by your JDBC code for jConnect 7.0.
See: http://dcx.sybase.com/index.html#1201/en/dbprogramming/jconnect-using-jdbxextra.html
The jConnect JDBC driver
The classes in jConnect are all in com.sybase.jdbc4.jdbc
. You must import these classes at the beginning of each source file:
import com.sybase.jdbc4.jdbc.*
Loading the jConnect driver
Ensure that the jConnect driver is in your class file path. The driver file jconn4.jar is located in the classes subdirectory of your jConnect installation.
set classpath=.;c:\\jConnect-7_0\\classes\\jconn4.jar;%classpath%
The jConnect driver takes advantage of the new automatic JDBC driver registration. The driver is automatically loaded at execution startup when it is in the class file path.
If you are using JDBC 4.0, you should note that you no longer are required to call DriverManager.registerDriver()
and this is taken care of for you instead.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
9 | |
9 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.