This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 177030 - cannot connect to some databases when derby started with asadmin start-database
Summary: cannot connect to some databases when derby started with asadmin start-database
Status: RESOLVED WORKSFORME
Alias: None
Product: db
Classification: Unclassified
Component: Derby (show other bugs)
Version: 6.x
Hardware: PC Other
: P3 normal (vote)
Assignee: Jiri Rechtacek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-17 15:06 UTC by emiddio
Modified: 2009-11-20 08:05 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description emiddio 2009-11-17 15:06:45 UTC
if netbeans starts derby i can connect/disconnect to any of the databases derby has. when started with asadmin -- start-database -- i can connect to some databases but not others;

the asant command is in my C:\Sun\glassfish-v2ur2/bin dir; the databases
configured with netbeans for derby is C:\Sun\glassfish-v2ur2\javadb, and
C:\Sun\glassfish-v2ur2\databases

when netbeans starts derby -- other netbeans and glassfish can connect to and use the same database.

so why cant i connect to -- 
connect 'jdbc:derby://localhost:1527/sun-appserv-samples' user 'app' password 'app';

with netbeans or ij when asant start-database is what started derby ?
Comment 1 emiddio 2009-11-17 15:33:14 UTC
issue seems resolved -- by examining gfv2ur2/databases/derby.log

apparantly when start-database command issued a connection already existed
to sun-appserv-samples;

after exiting all netbeans, then stop-database, then start-database with
asadmin was able to connect to sun-appserv-samples with netbeans,

derby log also did not contain any startup errors.
Comment 2 emiddio 2009-11-17 16:45:15 UTC
guess not solved after all;

after fresh start:

asadmin start-database
asadmin start-domain

then start netbeans

i was able to connect to 6 of 7 derby databases;

the 5th failed, 6th,7th also succeeded.

i can use netbeans to stop derby then restart and connect;

but whats going on here ???????




got error from ide log
        at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:1084)
INFO [org.netbeans.modules.db.explorer.action.ConnectAction]
org.apache.derby.client.am.SqlException: DERBY SQL error: SQLCODE: -1, SQLSTATE: XJ040, SQLERRMC: Failed to start database 'sun-appserv-samples', see the next exception for details.::SQLSTATE: XSDB6Another instance of Derby may have already booted the database C:\Sun\glassfish-v2ur2\databases\sun-appserv-samples.
        at org.apache.derby.client.am.Connection.completeSqlca(Connection.java:1957)
        at org.apache.derby.client.net.NetConnectionReply.parseRdbAccessFailed(NetConnectionReply.java:549)
        at org.apache.derby.client.net.NetConnectionReply.parseAccessRdbError(NetConnectionReply.java:442)
        at org.apache.derby.client.net.NetConnectionReply.parseACCRDBreply(NetConnectionReply.java:306)
        at org.apache.derby.client.net.NetConnectionReply.readAccessDatabase(NetConnectionReply.java:133)
        at org.apache.derby.client.net.NetConnection.readSecurityCheckAndAccessRdb(NetConnection.java:887)
        at org.apache.derby.client.net.NetConnection.flowSecurityCheckAndAccessRdb(NetConnection.java:799)
        at org.apache.derby.client.net.NetConnection.flowUSRIDPWDconnect(NetConnection.java:620)
        at org.apache.derby.client.net.NetConnection.flowConnect(NetConnection.java:435)
        at org.apache.derby.client.net.NetConnection.<init>(NetConnection.java:217)
        at org.apache.derby.client.net.NetConnection40.<init>(NetConnection40.java:77)
        at org.apache.derby.client.net.ClientJDBCObjectFactoryImpl40.newNetConnection(ClientJDBCObjectFactoryImpl40.java:209)
        at org.apache.derby.jdbc.ClientDriver.connect(ClientDriver.java:140)
Caused: java.sql.SQLException: DERBY SQL error: SQLCODE: -1, SQLSTATE: XJ040, SQLERRMC: Failed to start database 'sun-appserv-samples', see the next exception for details.::SQLSTATE: XSDB6Another instance of Derby may have already booted the database C:\Sun\glassfish-v2ur2\databases\sun-appserv-samples.
        at org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:95)
        at org.apache.derby.client.am.SqlException.getSQLException(SqlException.java:362)
        at org.apache.derby.jdbc.ClientDriver.connect(ClientDriver.java:149)
        at org.netbeans.modules.db.explorer.DbDriverManager.getConnection(DbDriverManager.java:128)
        at org.netbeans.modules.db.explorer.DatabaseConnection.doConnect(DatabaseConnection.java:701)
        at org.netbeans.modules.db.explorer.DatabaseConnection.access$100(DatabaseConnection.java:102)
[catch] at org.netbeans.modules.db.explorer.DatabaseConnection$2.run(DatabaseConnection.java:757)
        at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:602)
        at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:1084)
Comment 3 Jiri Rechtacek 2009-11-20 08:05:00 UTC
It seems as mismatch of two Derby databases. One of them came from Glassfish and second one from JDK6 installation. Make sure you are starting as same Derby DB from IDE as from asadmin. Look on Derby properties in Services tab|Databases|JavaDB|Java DB Installation.