| | |
Derby Connection Issues
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Aug 2008
Posts: 208
Reputation:
Solved Threads: 13
Hello, I'm using NetBeans 6.7.1, and Derby 10.5.3.0. I'm trying to learn how to write Database applications, and I'm having trouble connecting to my Database. It loads the Derby Driver (EmbeddedDriver), but won't connect to the the Database named test. I looked at tests Properties in NetBeans, and it said that it was using the org.apache.jdbc.derby.ClientDriver. I did create the Database, and give it no username or password. Below is the code that I have. If anybody could help, that would be great =D
This is the error that I get:
Java Syntax (Toggle Plain Text)
package jdb.test; import java.sql.*; public class DatabaseTest { public static void main(String[] args){ try{ // Load the EmbeddedDriver class Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance(); System.out.println("Loaded Derby Driver"); }catch(Exception e){ e.printStackTrace(); System.out.println("Error loading Derby Driver. Shutting down."); System.exit(-1); } // The database located on my computer String database = "jdbc:derby://localhost:1527/test"; try{ // Connect without a username and password Connection conn = DriverManager.getConnection(database); System.out.println("Connected to "+database); }catch(SQLException e){ e.printStackTrace(); System.out.println("Could not connect to "+database); System.exit(-1); } System.out.println("You have connect to the selected database."); } }
This is the error that I get:
Java Syntax (Toggle Plain Text)
java.sql.SQLException: No suitable driver found for jdbc:derby://localhost:1527/test at java.sql.DriverManager.getConnection(DriverManager.java:602) at java.sql.DriverManager.getConnection(DriverManager.java:207) at jdb.test.DatabaseTest.main(DatabaseTest.java:22)
•
•
Join Date: Aug 2008
Posts: 208
Reputation:
Solved Threads: 13
I tried using "jdbc:derby:test" instead of ""jdbc:derby://localhost:1527/test", but it gave me this error:
(this is the entire output from the execution)
(this is the entire output from the execution)
Java Syntax (Toggle Plain Text)
Loaded Derby Driver java.sql.SQLException: Database 'test' not found. at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source) at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source) at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source) at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source) at org.apache.derby.impl.jdbc.EmbedConnection.newSQLException(Unknown Source) at org.apache.derby.impl.jdbc.EmbedConnection.handleDBNotFound(Unknown Source) at org.apache.derby.impl.jdbc.EmbedConnection.<init>(Unknown Source) at org.apache.derby.impl.jdbc.EmbedConnection30.<init>(Unknown Source) at org.apache.derby.impl.jdbc.EmbedConnection40.<init>(Unknown Source) at org.apache.derby.jdbc.Driver40.getNewEmbedConnection(Unknown Source) at org.apache.derby.jdbc.InternalDriver.connect(Unknown Source) at org.apache.derby.jdbc.AutoloadedDriver.connect(Unknown Source) Could not connect to jdbc:derby:test at java.sql.DriverManager.getConnection(DriverManager.java:582) at java.sql.DriverManager.getConnection(DriverManager.java:207) at jdb.test.DatabaseTest.main(DatabaseTest.java:22) Caused by: java.sql.SQLException: Database 'test' not found. at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source) at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source) ... 15 more
Well, I can only point to the docs:
http://db.apache.org/derby/docs/10.5...dvlp40350.html
and experimentation with the path you're using in the connection string.
http://db.apache.org/derby/docs/10.5...dvlp40350.html
and experimentation with the path you're using in the connection string.
•
•
Join Date: Aug 2008
Posts: 208
Reputation:
Solved Threads: 13
AHA! I used the create property to create a new Database, and then searched for it using the OS's Search Program. I found the newly created database in the NetBeans project folder. I can not successfully connect to the database. I don't know how to add that new Database to the list of databases that are editable directly through NetBeans.
![]() |
Similar Threads
- One Laptop causing Intemittent Connection Drops (Networking Hardware Configuration)
- Router, cable internet connection issues (Networking Hardware Configuration)
- Connection Issues (Windows Vista and Windows 7)
- Dell laptop won't boot windows - black screen, power issues (Windows NT / 2000 / XP)
- Weird connection problem - I'm sure it's PC (Networking Hardware Configuration)
- JDBC Connection Pooling : Network Adapter could not establish the connection (Java)
- Connection Issues (Networking Hardware Configuration)
- Computer will connect to Internet...just not MY connection (Windows NT / 2000 / XP)
- ISDN internet connection issues (Networking Hardware Configuration)
Other Threads in the Java Forum
- Previous Thread: MySQL Connector
- Next Thread: Server - Client thing
Views: 1167 | Replies: 7
| Thread Tools | Search this Thread |
Tag cloud for derby, java, netbeans, sql
.net 3.5 access ajax apple applet array asp automation binary c# c++ class classes code codesnippet compiler component connection convert data database design developer development draw eclipse editor error event exception exploit firefox fractal game google gui hacker html image images input integer integration java javafx javascript jetbrains jmf jsp julia linux loop method microsoft mobileapplication ms msaccess msdn mysql netbeans newbie news number object office oracle php problem program programming project python qt query reference report screen security server service set socket software sort sql string sun swing test threads time transfer tree update vb.net video vista web windows







If I find anything, I'll post it here. 