| | |
Derby Connection Issues
![]() |
•
•
Join Date: Aug 2008
Posts: 205
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: 205
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: 205
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
| Thread Tools | Search this Thread |
.net 3d addressbook ajax apple applet array asp automation binary bluetooth c# c++ class classes code component connection convert crashcourse csv data database delphi deploy design desktop developer development eclipse editor educational error extensions firefox fractal g2one game google gui hint html ideas image images integer java javafx javascript jetbrains julia linux loan loop macosx method microsoft mobile mobileapplication ms msdn mysql netbeans newbie news number office opensource oracle php problem program programming python qt query report ria security server service set sharepoint software sort sql sun swing textfields threads tree trolltech update vb.net video vista warehouse web windows xerces







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