Meaningless Drivel is fun!*
The moose likes JDBC and the fly likes database not found Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "database not found" Watch "database not found" New topic
Author

database not found

Ravan Kumar
Greenhorn

Joined: Nov 15, 2012
Posts: 17


Exception in thread "main" java.sql.SQLNonTransientConnectionException: The connection was refused because the database test was not found.
at org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown Source)
at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source)
at org.apache.derby.jdbc.ClientDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(DriverManager.java:579)
at java.sql.DriverManager.getConnection(DriverManager.java:243)
at Student.main(Student.java:20)
Caused by: org.apache.derby.client.am.DisconnectException: The connection was refused because the database test was not found.
at org.apache.derby.client.net.NetConnectionReply.parseRDBNFNRM(Unknown Source)
at org.apache.derby.client.net.NetConnectionReply.parseAccessRdbError(Unknown Source)
at org.apache.derby.client.net.NetConnectionReply.parseACCRDBreply(Unknown Source)
at org.apache.derby.client.net.NetConnectionReply.readAccessDatabase(Unknown Source)
at org.apache.derby.client.net.NetConnection.readSecurityCheckAndAccessRdb(Unknown Source)
at org.apache.derby.client.net.NetConnection.flowSecurityCheckAndAccessRdb(Unknown Source)
at org.apache.derby.client.net.NetConnection.flowUSRIDONLconnect(Unknown Source)
at org.apache.derby.client.net.NetConnection.flowConnect(Unknown Source)
at org.apache.derby.client.net.NetConnection.<init>(Unknown Source)
at org.apache.derby.client.net.NetConnection40.<init>(Unknown Source)
at org.apache.derby.client.net.ClientJDBCObjectFactoryImpl40.newNetConnection(Unknown Source)
... 4 more


C:\WINDOWS\system32>java org.apache.derby.tools.sysinfo
------------------ Java Information ------------------
Java Version: 1.7.0_09
Java Vendor: Oracle Corporation
Java home: C:\Program Files\Java\jre7
Java classpath: C:\Program Files\Java\jdk1.7.0_09\db\lib\derbytools.jar;C:\Program Files\Java\jdk1.7.0_09\db\
lib\derbynet.jar;.
OS name: Windows XP
OS architecture: x86
OS version: 5.1
Java user dir: C:\WINDOWS\system32
java.specification.name: Java Platform API Specification
java.specification.version: 1.7
java.runtime.version: 1.7.0_09-b05
--------- Derby Information --------
JRE - JDBC: Java SE 7 - JDBC 4.0
[C:\Program Files\Java\jdk1.7.0_09\db\lib\derby.jar] 10.8.2.2 - (1181258)
[C:\Program Files\Java\jdk1.7.0_09\db\lib\derbytools.jar] 10.8.2.2 - (1181258)
[C:\Program Files\Java\jdk1.7.0_09\db\lib\derbynet.jar] 10.8.2.2 - (1181258)
------------------------------------------------------
----------------- Locale Information -----------------
Current Locale : [English/United States [en_US]]
Found support for locale: [cs]
version: 10.8.2.2 - (1181258)
Found support for locale: [de_DE]
version: 10.8.2.2 - (1181258)
Found support for locale: [es]
version: 10.8.2.2 - (1181258)
Found support for locale: [fr]
version: 10.8.2.2 - (1181258)
Found support for locale: [hu]
version: 10.8.2.2 - (1181258)
Found support for locale: [it]
version: 10.8.2.2 - (1181258)
Found support for locale: [ja_JP]
version: 10.8.2.2 - (1181258)
Found support for locale: [ko_KR]
version: 10.8.2.2 - (1181258)
Found support for locale: [pl]
version: 10.8.2.2 - (1181258)
Found support for locale: [pt_BR]
version: 10.8.2.2 - (1181258)
Found support for locale: [ru]
version: 10.8.2.2 - (1181258)
Found support for locale: [zh_CN]
version: 10.8.2.2 - (1181258)
Found support for locale: [zh_TW]
version: 10.8.2.2 - (1181258)
------------------------------------------------------

C:\WINDOWS\system32>java org.apache.derby.tools.ij
ij version 10.8
ij> connect 'jdbc:derby:test';
ij> select * from student;
NAME |AGE
--------------------------------
Swami |28
amit |27

2 rows selected
ij>

Please Help!!
Dave Elwood
Ranch Hand

Joined: Dec 27, 2002
Posts: 84

maybe this will help, maybe not.

I have windows xp and have netbeans 7.1 with glassfish 3.1.1 installed.

under netbeans I ran a web app MyWebApp with javaee (entity beans) and placed info in a database "sample". It appears to be
created at C:\Documents and Settings\David\.netbeans-derby\ in the form of a folder named "sample".
Whenever I use netbeans, the glassfish server and the database are started and when I stop netbeans the glassfish server and the database turn off.

I then must copy the folder to %DERBY_HOME%\bin !! when the database is OFF !!
Then with asadmin.bat start-domain and asadmin.bat start-database get the show running again.
Then with the browser and http://localhost:8080/MyWebApp I can look at the database.

But !! don't forget, netbeans puts the database in C:\Documents and Settings\David\.netbeans-derby\ [for some strange reason]
and when using glassfish server like a normal human, without netbeans, the database must be in %DERBY_HOME%\bin [for yet another strange reason]

hope that helps
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: database not found
 
Similar Threads
JDBC 4.1
Problems regarding MS JDBC Driver and JTDS-JDBC Connectivity for MS SQL Server 2000
New FAQ from a Newbie to Java!
Problem setting Oracle connection