没有注册Driver, 下面是摘自oracle目录中的Jdbc目录下的readme文件. 你应该读一下。 这样可以省些分数 关键是节约时间2. Register the Oracle driver before before calling other JDBC APIs. (This is not needed if you are using the JDBC Server-side Internal Driver because registration is done automatically in the server.) To register the Oracle driver, make sure the following statement is executed at least once in your Java session: DriverManager.registerDriver( new oracle.jdbc.OracleDriver());
thrive_li() :那您只是把select语句改了吗?我想看看您的classpath怎么设的,还有DBConnection DBCon = new DBConnection("jdbc:oracle:thin:@192.168.0.38:1521:wms","wms","wms");这个地方怎么写的,,谢了!!
我用的jb9x,只是建立了个工程,下面有3个.class,其它的就没有设置,
F:\liu>java OracleOCITest Error loading Oracle Driver... java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver at java.net.URLClassLoader$1.run(URLClassLoader.java:199) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) at OracleOCITest.<clinit>(OracleOcitest.java:6) The SQL command you want to execute is select * from shp_yot_tbl 这是我的运行情况:怎么就和 thrive_li() 不一样哪?郁闷
你应该读一下。
这样可以省些分数
关键是节约时间2. Register the Oracle driver before before calling other JDBC APIs.
(This is not needed if you are using the JDBC Server-side Internal
Driver because registration is done automatically in the server.)
To register the Oracle driver, make sure the following statement
is executed at least once in your Java session: DriverManager.registerDriver(
new oracle.jdbc.OracleDriver());
是这错了:;.D:\oracle\ora90\jdbc\lib\classes12.jar;前多了一点“.”
看到了吗?
可以结分了!
Qiufenghan(秋风寒) :怎么注册driver呀?
应该是你环境的问题-------这是运行结果C:\test\a>java OracleOCITest
Success loading Oracle Driver...
The SQL command you want to execute is
select * from tree
ID PARENTID REMARK URL
---------------------------------------------------------
2 1 sohu http://www.sohu.com
3 1 sina http://www.china.com
4 0 java http://www.java.sun.com
5 4 sun http://www.yahoo.com
6 4 csdn http://www.etang.com
7 5 tomcat http://www.tom.com
8 7 org http://www.taobao.com
2.严查路径是否正确.看看该路径下是否有classes12.jar
Error loading Oracle Driver...
java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:141)
at OracleOCITest.<clinit>(OracleOcitest.java:6)
The SQL command you want to execute is
select * from shp_yot_tbl
这是我的运行情况:怎么就和 thrive_li() 不一样哪?郁闷