2016-04-12 32 views
1

Sadece MySQL'den MariaDb'ye geçiş sürecindeyiz. JDBC URL'sini ve JDBC Sürücüsünü güncellemek kadar kolay olacağını umuyordum ama maalesef bu yeterli değildi.JDBC/c3p0 kullanarak MariaDB'ye bağlanma

mariadb sürümü: 5.5.47-MariaDB

Yapılandırma:

db.driver=org.mariadb.jdbc.Driver 
db.url=jdbc:mysql://localhost:3306/test?characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&autoReconnect=true 
db.user=user 
db.password=secret 

Sürücü:

<dependency> 
     <groupId>org.mariadb.jdbc</groupId> 
     <artifactId>mariadb-java-client</artifactId> 
     <version>1.4.2</version> 
</dependency> 

c3po tanımı, hiçbir şey MySQL ile aynıdır, burada değişti:

<bean id="c3p0dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"> 
    <!-- access --> 
    <property name="driverClass" value="${db.driver}" /> 
    <property name="jdbcUrl" value="${db.url}" /> 
    <property name="user" value="${db.user}" /> 
    <property name="password" value="${db.password}" /> 
    .... 

hatası:

Last acquisition attempt exception: 
java.sql.SQLNonTransientConnectionException: Client does not support authentication protocol requested by server. Consider upgrading MariaDB client. plugin was = 
     at org.mariadb.jdbc.internal.util.ExceptionMapper.get(ExceptionMapper.java:123) 
     at org.mariadb.jdbc.internal.util.ExceptionMapper.throwException(ExceptionMapper.java:69) 
     at org.mariadb.jdbc.Driver.connect(Driver.java:110) 
     at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:134) 
     at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182) 
     at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171) 
     at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137) 
     at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014) 
     at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32) 
     at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810) 
     at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547) 
Caused by: org.mariadb.jdbc.internal.util.dao.QueryException: Client does not support authentication protocol requested by server. Consider upgrading MariaDB client. plugin was = 
     at org.mariadb.jdbc.internal.protocol.authentication.DefaultAuthenticationProvider.processAuthPlugin(DefaultAuthenticationProvider.java:94) 
     at org.mariadb.jdbc.internal.protocol.authentication.AuthenticationProviderHolder$1.processAuthPlugin(AuthenticationProviderHolder.java:69) 
     at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.authentication(AbstractConnectProtocol.java:490) 
     at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.handleConnectionPhases(AbstractConnectProtocol.java:448) 
     at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.connect(AbstractConnectProtocol.java:359) 
     at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.connectWithoutProxy(AbstractConnectProtocol.java:703) 
     at org.mariadb.jdbc.internal.util.Utils.retrieveProxy(Utils.java:471) 
     at org.mariadb.jdbc.Driver.connect(Driver.java:105) 
     ... 8 more 

Zaten birkaç şey denedim ama şimdiye kadar hiçbir şey yardımcı olur:

Yeni şifre biçimini kullanmayı deneyin db.url=jdbc:mariadb://localhost... çalıştı: update mysql.user set Password = PASSWORD('secret') where user = 'user'; Herhangi bir yardım mutluluk duyacağız

com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up. 
     at sun.reflect.GeneratedConstructorAccessor47.newInstance(Unknown Source) 
     at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) 
     at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 
     at com.mysql.jdbc.Util.handleNewInstance(Util.java:408) 
     at com.mysql.jdbc.Util.getInstance(Util.java:383) 
     at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1023) 
     at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:997) 
     at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:983) 
     at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:928) 
     at com.mysql.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:2407) 
     at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2328) 
     at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:832) 
     at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:46) 
     at sun.reflect.GeneratedConstructorAccessor17.newInstance(Unknown Source) 
     at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) 
     at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 
     at com.mysql.jdbc.Util.handleNewInstance(Util.java:408) 
     at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:417) 
     at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:344) 
     at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:134) 
     at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182) 
     at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171) 
     at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137) 
     at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014) 
     at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32) 
     at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810) 
     at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547) 
Caused by: java.sql.SQLException: Unable to load authentication plugin ''. 
     at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:935) 
     at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:932) 
     at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1769) 
     at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1288) 
     at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2508) 
     at com.mysql.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:2346) 
     ... 17 more 

:

aşağıdaki özel durum alırsınız. Ben yeni şifreye güncelleme işe yaramadı öğrendim bazı ek testlerden sonra

+0

Parolayı 'normal' veya 'güvenli' modda mı sıfırlamayı denediniz? Örneğin. Burada olduğu gibi: http://tecadmin.net/steps-to-reset-mariadb-root-password-in-linux/ – nyname00

cevap

1

:

MariaDB [test]> SELECT PASSWORD('123456'), OLD_PASSWORD('123456'); 
+--------------------+------------------------+ 
| PASSWORD('123456') | OLD_PASSWORD('123456') | 
+--------------------+------------------------+ 
| 565491d704013245 | 565491d704013245  | 
+--------------------+------------------------+ 

biz /etc/my.cnf belirlenen old_passwords seçeneği varmış. Kapatıp MariaDb'yi yeniden başlattıktan sonra yeni PASSWORD() düzgün çalışmaya başladı ve şimdi bağlanabiliyoruz. Umarım hata ayıklama mücadelelerinde birileri için yararlı olur.

> SHOW VARIABLES LIKE 'old_passwords'; 
+---------------+-------+ 
| Variable_name | Value | 
+---------------+-------+ 
| old_passwords | 0  | 
+---------------+-------+ 

> SELECT PASSWORD('123456'), OLD_PASSWORD('123456'); 
+-------------------------------------------+------------------------+ 
| PASSWORD('123456')      | OLD_PASSWORD('123456') | 
+-------------------------------------------+------------------------+ 
| *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 | 565491d704013245  | 
+-------------------------------------------+------------------------+