derbyjavadb

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>

Solution

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