简体   繁体   中英

Driver to connect database to java

I have a problem

I want to get data from a graphical interface and save them on a SQL file on Netbeans and then import from SQL to fill the graphical interface.

I have my database ready but the only

Problem:

I have how to get to the SQL from java , and I tried the code, then I got an Exception

ClassNotFoundException: myDriver.ClassName
SQLException: No suitable driver found for Jdbc:derby://localhost:1527/sample[app on APP]
BUILD SUCCESSFUL (total time: 1 second)"

You need to add the connector jar of the database to the classpath of your project, as stated in other answers.

With Derby, that jar is the same one that runs the database. Explanation of how to add a jar to the classpath in Netbeans.

For the oracle database you need to add oracle library for the datatbase connection. oracle library is available in the path of where you installed the oracle.

You need to have the database jar in your classpath depending on which database you are using. Here is tutorial to help you understand about creating JDBC connection:

http://docs.oracle.com/javase/tutorial/jdbc/basics/connecting.html#drivermanager

如果您使用oracle数据库意味着您应该在Netbeans中添加oracle库文件.. 请在此处查看

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM