天堂2单机交流论坛

标题: 无法创建到数据库服务器的连接怎么搞 [打印本页]

作者: zz2826285    时间: 2021-3-24 20:01
标题: 无法创建到数据库服务器的连接怎么搞
java.sql.SQLException: Unable to open a test connection to the given database. JDBC url = jdbc:mysql://localhost/l2jcn_gs?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true, username = root. Terminating connection pool. Original Exception: ------
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.
        at sun.reflect.GeneratedConstructorAccessor7.newInstance(Unknown Source)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
        at java.lang.reflect.Constructor.newInstance(Unknown Source)
        at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
        at com.mysql.jdbc.Util.getInstance(Util.java:386)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1015)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:989)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:975)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:920)
        at com.mysql.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:2388)
        at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2309)
        at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:834)
        at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
        at sun.reflect.GeneratedConstructorAccessor5.newInstance(Unknown Source)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
        at java.lang.reflect.Constructor.newInstance(Unknown Source)
        at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
        at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:416)
        at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:346)
        at java.sql.DriverManager.getConnection(Unknown Source)
        at java.sql.DriverManager.getConnection(Unknown Source)
        at com.jolbox.bonecp.BoneCP.obtainRawInternalConnection(BoneCP.java:256)
        at com.jolbox.bonecp.BoneCP.<init>(BoneCP.java:305)
        at com.jolbox.bonecp.BoneCPDataSource.maybeInit(BoneCPDataSource.java:150)
        at com.jolbox.bonecp.BoneCPDataSource.getConnection(BoneCPDataSource.java:112)
        at com.l2jserver.L2DatabaseFactory.getConnection(L2DatabaseFactory.java:154)
        at com.l2jserver.gameserver.GameServer.getHextId(GameServer.java:191)
        at com.l2jserver.gameserver.GameServer.main(GameServer.java:511)
Caused by: java.lang.NullPointerException
        at com.mysql.jdbc.ConnectionImpl.getServerCharacterEncoding(ConnectionImpl.java:3279)
        at com.mysql.jdbc.MysqlIO.sendConnectionAttributes(MysqlIO.java:1940)
        at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1866)
        at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1252)
        at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2486)
        at com.mysql.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:2327)
        ... 18 more
------

        at com.jolbox.bonecp.BoneCP.<init>(BoneCP.java:312)
        at com.jolbox.bonecp.BoneCPDataSource.maybeInit(BoneCPDataSource.java:150)
        at com.jolbox.bonecp.BoneCPDataSource.getConnection(BoneCPDataSource.java:112)
        at com.l2jserver.L2DatabaseFactory.getConnection(L2DatabaseFactory.java:154)
        at com.l2jserver.gameserver.GameServer.getHextId(GameServer.java:191)
        at com.l2jserver.gameserver.GameServer.main(GameServer.java:511)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.
        at sun.reflect.GeneratedConstructorAccessor7.newInstance(Unknown Source)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
        at java.lang.reflect.Constructor.newInstance(Unknown Source)
        at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
        at com.mysql.jdbc.Util.getInstance(Util.java:386)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1015)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:989)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:975)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:920)
        at com.mysql.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:2388)
        at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2309)
        at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:834)
        at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
        at sun.reflect.GeneratedConstructorAccessor5.newInstance(Unknown Source)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
        at java.lang.reflect.Constructor.newInstance(Unknown Source)
        at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
        at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:416)
        at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:346)
        at java.sql.DriverManager.getConnection(Unknown Source)
        at java.sql.DriverManager.getConnection(Unknown Source)
        at com.jolbox.bonecp.BoneCP.obtainRawInternalConnection(BoneCP.java:256)
        at com.jolbox.bonecp.BoneCP.<init>(BoneCP.java:305)
        ... 5 more
Caused by: java.lang.NullPointerException
        at com.mysql.jdbc.ConnectionImpl.getServerCharacterEncoding(ConnectionImpl.java:3279)
        at com.mysql.jdbc.MysqlIO.sendConnectionAttributes(MysqlIO.java:1940)
        at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1866)
        at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1252)
        at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2486)
        at com.mysql.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:2327)
        ... 18 more


作者: L2CN管理员    时间: 2021-3-25 10:52
数据库连接看配置表设置
作者: zz2826285    时间: 2021-3-28 10:39
L2CN管理员 发表于 2021-3-25 10:52
数据库连接看配置表设置

这个教程在哪里看




欢迎光临 天堂2单机交流论坛 (http://l2cn.com/) Powered by Discuz! X3.2