lealone / Lealone

比 MySQL 和 MongoDB 快10倍的 OLTP 关系数据库和文档数据库
Other
2.47k stars 518 forks source link

DBeaver 无法连接 Lealone 数据库 #248

Closed lovefishs closed 2 days ago

lovefishs commented 5 days ago

Lealone 版本: 6.0.1 DBeaver 版本: 24.2.0.202409011551 系统: macOS 13.6.9

Lealone 已经本地启动

Lealone version: 6.0.1
Use default config
Base dir: /Users/xxx/yyy/lealone/lealone_data
Init storage engines: 20 ms
Init transaction engines: 102 ms
Init sql engines: 7 ms
Init protocol server engines: 23 ms
Init lealone database: 244 ms
TcpServer started, host: 127.0.0.1, port: 9211
Total time: 455 ms (Load config: 3 ms, Init: 432 ms, Start: 20 ms)
Exit with Ctrl+C

当使用 DBeaver 连接 Lealone 时,会打印错误日志,如下

Failed to read remote address[127.0.0.1:54043]: Packet too large, maxPacketSize: 16777216, receive: 1195725856
Failed to read remote address[127.0.0.1:54187]: Packet too large, maxPacketSize: 16777216, receive: 1195725856
Failed to read remote address[127.0.0.1:54333]: Packet too large, maxPacketSize: 16777216, receive: 1195725856

连接 Lealone 客户端成功

Welcome to Lealone Shell 6.0.1
Connect to jdbc:lealone:tcp://localhost:9211/lealone
Commands are case insensitive; SQL statements end with ';'
help or ?          Display this help
list               Toggle result list / stack trace mode
maxwidth or md     Set maximum column width (default is 100)
autocommit or ac   Enable or disable autocommit
history or h       Show the last 20 statements
reconnect or rc    Reconnect the database
quit or exit       Close the connection and exit

sql>

Lealone 驱动器已经根据文档正确创建

连接报错信息如下

Can't create driver instance (class 'com.lealone.client.jdbc.JdbcDriver

').
  Error creating driver 'Lealone' instance.
Most likely required jar files are missing.
You should configure jars in driver settings.

Reason: can't load driver class 'com.lealone.client.jdbc.JdbcDriver

'
  Error creating driver 'Lealone' instance.
Most likely required jar files are missing.
You should configure jars in driver settings.

Reason: can't load driver class 'com.lealone.client.jdbc.JdbcDriver

'
    com.lealone.client.jdbc.JdbcDriver

    com.lealone.client.jdbc.JdbcDriver
codefollower commented 4 days ago

当使用 DBeaver 连接 Lealone 时,会打印错误日志,如下

Failed to read remote address[127.0.0.1:54043]: Packet too large, maxPacketSize: 16777216, receive: 1195725856
Failed to read remote address[127.0.0.1:54187]: Packet too large, maxPacketSize: 16777216, receive: 1195725856
Failed to read remote address[127.0.0.1:54333]: Packet too large, maxPacketSize: 16777216, receive: 1195725856

这个 WARN 是你的电脑上开了 QQ,它会连到9210端口,然后给9210端口发信息。

codefollower commented 4 days ago

连接报错信息如下

Can't create driver instance (class 'com.lealone.client.jdbc.JdbcDriver

').
  Error creating driver 'Lealone' instance.
Most likely required jar files are missing.
You should configure jars in driver settings.

Reason: can't load driver class 'com.lealone.client.jdbc.JdbcDriver

'
  Error creating driver 'Lealone' instance.
Most likely required jar files are missing.
You should configure jars in driver settings.

Reason: can't load driver class 'com.lealone.client.jdbc.JdbcDriver

'
    com.lealone.client.jdbc.JdbcDriver

    com.lealone.client.jdbc.JdbcDriver

这个是配置驱动的时候没有把 lealone-6.0.1.jar 加进去,参考 使用DBeaver访问Lealone数据库 中的第二张截图。

lovefishs commented 2 days ago

当使用 DBeaver 连接 Lealone 时,会打印错误日志,如下

Failed to read remote address[127.0.0.1:54043]: Packet too large, maxPacketSize: 16777216, receive: 1195725856
Failed to read remote address[127.0.0.1:54187]: Packet too large, maxPacketSize: 16777216, receive: 1195725856
Failed to read remote address[127.0.0.1:54333]: Packet too large, maxPacketSize: 16777216, receive: 1195725856

这个 WARN 是你的电脑上开了 QQ,它会连到9210端口,然后给9210端口发信息。

我启动数据库的时候,使用了 -port 参数修改了端口为 9211,怎么会还往 9210 发信息呢?

lovefishs commented 2 days ago

连接报错信息如下

Can't create driver instance (class 'com.lealone.client.jdbc.JdbcDriver

').
  Error creating driver 'Lealone' instance.
Most likely required jar files are missing.
You should configure jars in driver settings.

Reason: can't load driver class 'com.lealone.client.jdbc.JdbcDriver

'
  Error creating driver 'Lealone' instance.
Most likely required jar files are missing.
You should configure jars in driver settings.

Reason: can't load driver class 'com.lealone.client.jdbc.JdbcDriver

'
    com.lealone.client.jdbc.JdbcDriver

    com.lealone.client.jdbc.JdbcDriver

这个是配置驱动的时候没有把 lealone-6.0.1.jar 加进去,参考 使用DBeaver访问Lealone数据库 中的第二张截图。

我是按照文档进行配置的,具体信息见下面截图

1 2 3
codefollower commented 2 days ago

当使用 DBeaver 连接 Lealone 时,会打印错误日志,如下

Failed to read remote address[127.0.0.1:54043]: Packet too large, maxPacketSize: 16777216, receive: 1195725856
Failed to read remote address[127.0.0.1:54187]: Packet too large, maxPacketSize: 16777216, receive: 1195725856
Failed to read remote address[127.0.0.1:54333]: Packet too large, maxPacketSize: 16777216, receive: 1195725856

这个 WARN 是你的电脑上开了 QQ,它会连到9210端口,然后给9210端口发信息。

9211端口QQ也会发

codefollower commented 2 days ago

你截图里的端口号配成9210了,应该是9211。

找不到 JdbcDriver 类也可能是 DBeaver 需要重启动,lealone-6.0.1.jar 包里是有 JdbcDriver 这个类的,而且你加 jar 包的那个截图都能实别出 com.lealone.client.jdbc.JdbcDriver 了,若是还找不到,看看你第一张截图配置的类名后面是不是多加了空格,有了空格 DBeaver 也没法识别。

lovefishs commented 2 days ago

你截图里的端口号配成9210了,应该是9211。

找不到 JdbcDriver 类也可能是 DBeaver 需要重启动,lealone-6.0.1.jar 包里是有 JdbcDriver 这个类的,而且你加 jar 包的那个截图都能实别出 com.lealone.client.jdbc.JdbcDriver 了,若是还找不到,看看你第一张截图配置的类名后面是不是多加了空格,有了空格 DBeaver 也没法识别。

谢谢您的回复,问题解决了,是“类名后面多了空格”,类名是从文档里面复制的,可能不小心把空格也帖进去了

经过测试发现,驱动器端口设置我用你的默认值 9210,但是我创建连接的时候,重新修改成了启动端口 9211,所以这里的问题与驱动器默认端口没关系 为了避免和 QQ 端口冲突,我把启动端口改成了 9410,驱动器类名空格删掉,然后就好了

1