Alex R
Alex R

Reputation: 11891

Unable to create Derby database over the Network on Windows, Error 40000 / XJ041 / XBM02?

I tried several variations on this documented example from the tutorial here

ij version 10.10
ij> connect 'jdbc:derby://localhost:1527/MyDbTest;create=true';
ERROR XJ041: DERBY SQL error: ERRORCODE: 40000, SQLSTATE: XJ041, SQLERRMC: Failed to create database 'MyDbTest', see the
 next exception for details.::SQLSTATE: XBM02
ij> connect 'jdbc:derby://localhost:1527/c:\temp\MyDbTest;create=true';
ERROR XJ041: DERBY SQL error: ERRORCODE: 40000, SQLSTATE: XJ041, SQLERRMC: Failed to create database 'c:\temp\MyDbTest',
 see the next exception for details.::SQLSTATE: XBM02
ij> connect 'jdbc:derby://localhost:1527/c:/temp/MyDbTest;create=true';
ERROR XJ041: DERBY SQL error: ERRORCODE: 40000, SQLSTATE: XJ041, SQLERRMC: Failed to create database 'c:/temp/MyDbTest',
 see the next exception for details.::SQLSTATE: XBM02
ij> connect 'jdbc:derby://localhost:1527/file://c:/temp/MyDbTest;create=true';
ERROR 08001: No suitable driver found for jdbc:derby://localhost:1527/file://c:/temp/MyDbTest;create=true
ij> connect 'jdbc:derby://localhost:1527/MyDbTest;create=false';
ERROR 08004: The connection was refused because the database MyDbTest;create=false was not found.
ij> connect 'jdbc:derby://localhost:1527/MyDbTest;create=true';
ERROR XJ041: DERBY SQL error: ERRORCODE: 40000, SQLSTATE: XJ041, SQLERRMC: Failed to create database 'MyDbTest', see the
 next exception for details.::SQLSTATE: XBM02
ij>

Upvotes: 1

Views: 2067

Answers (2)

Usama Sajjad
Usama Sajjad

Reputation: 1

This type of issue arises when derby fails to write on to the disk. Restart command prompt using administrator. Hopefully, this issue will be resolved.

Upvotes: 0

Emanuel Pinho
Emanuel Pinho

Reputation: 136

I had the same error before and it was because Db already exists.

Upvotes: 1

Related Questions