开发者

Database Driver connection problems in JDBC

I am developing an app in Java with Netbeans 6.9.1 as the IDE. I use a MySQL database, and connect to it using JDBC.

I have a curious problem.

Class.forName() does not throw ClassNotFoundException in one package, whereas it th开发者_如何学Pythonrows it in another. What might be wrong?

JDK version is 1.6 and I am using Ubuntu 10.10.


Class.forName() does not throw ClassNotFoundException in one package, whereas it throws it in another. What might be wrong?

The only two scenarios I can think of for this are:

  1. One package is an application package and the other is a test package. In this case, you'd have to make sure Connector/J is added to the regular library list and the test library list as well.

  2. They're two different projects, at which rate you'd have to add Connector/J to both projects.


If you use to connect mysql with netbeans, you may have to do the steps in the following link. ----->Netbeans Help

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜