gpt4 book ai didi

java - Derby:另一个 Derby 实例可能已经启动了数据库

转载 作者:行者123 更新时间:2023-12-03 12:09:26 30 4
gpt4 key购买 nike

我想在网络服务器模式下使用 Derby,并按照他们网站上的说明进行操作。

Derby 开局:

/opt/glassfish/4.0/javadb/bin/NetworkServerControl start -noSecurityManager

Sun Apr 13 23:47:57 CEST 2014 : Apache Derby Network Server - 10.9.1.0 - (1344872) started and ready to accept connections on port 1527

联系 ij :
$ /opt/glassfish/4.0/javadb/bin/ij
ij version 10.9
ij> connect 'jdbc:derby:testDB';
ij> create table testt ( x varchar(200), y varchar(200), z varchar(13));
0 rows inserted/updated/deleted
ij> select * from testt;

X

|Y



|Z
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


0 rows selected
ij> commit;
ij>

在 Java 中连接到 Derby:
static{

try {
Class.forName("org.apache.derby.jdbc.ClientDriver").newInstance();
} catch (Throwable e) {
e.printStackTrace();
}
}

public void readData(){
final Connection connection = DriverManager.getConnection("jdbc:derby://localhost:1527/testDB");
....
}
DriverManager.getConnection()失败了:
java.sql.SQLException: DERBY SQL error: SQLCODE: -1, SQLSTATE: XJ040, 
SQLERRMC: Failed to start database 'testDB' with class loader sun.misc.Launcher$AppClassLoader@23137792, see the next exception for details.::
SQLSTATE: XSDB6Another instance of Derby may have already booted the database

我不是刚刚在网络服务器模式下启动了 derby 吗?为什么我收到这个错误?

最佳答案

删除以下文件

../metastore_db/dbex.lck 和 ../metastore_db/db.lck

谢谢

关于java - Derby:另一个 Derby 实例可能已经启动了数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23049078/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com