PDA

View Full Version : MySQL Connection Problem



cau2germany
11-17-2010, 04:41 AM
[Resolved]
Hi,

I tried to run the DatabaseWithJDBC example.

I already install server Extensions via Electroserver Admin tool.

I configured the extension.xml to:
=================================
<!-- Create an array of EsObjects. One object represents a connection pool. -->
<Variable name="pools" type="EsObject">
<Entry>
<Variable name="poolname" type="string">mysqlpool</Variable>
<Variable name="url" type="string">jdbc:mysql://localhost:3306/esserver</Variable>
<Variable name="user" type="string">myusername</Variable>
<Variable name="password" type="string">mypass</Variable>
<Variable name="timeout" type="integer">2000</Variable>
<Variable name="maxpool" type="integer">20</Variable>
<Variable name="maxconn" type="integer">98</Variable>

<Variable name="expiry" type="integer">5</Variable>
</Entry>
</Variable>

=================================

But when I start the server. Error occurred. Please help me.
It told that my connection string is lack of username and password but I already put them in the extenstion.xml.

This is the error:

水 11 17 01:40:02.892 +0900 2010: Registered JDBC driver com.mysql.jdbc.Driver
水 11 17 01:40:02.892 +0900 2010: Registered JDBC driver org.apache.derby.jdbc.ClientDriver
水 11 17 01:40:02.908 +0900 2010: Invalid dateformat string specified: null
水 11 17 01:40:02.908 +0900 2010: Initialized pool mysqlpool (pool=20,max=98,expiry=5000ms)
2010/11/17 13:40:02 JST: mysqlpool: Getting connection (user/pass): jdbc:mysql://localhost:3306/esserver
2010/11/17 13:40:03 JST: mysqlpool: Failed to connect with standard authentication...trying with just JDBC URL
2010/11/17 13:40:03 JST: mysqlpool: Getting connection (URL only): jdbc:mysql://localhost:3306/esserver
2010/11/17 13:40:03 JST: mysqlpool: Can't create a new connection for jdbc:mysql://localhost:3306/esserver
com.mysql.jdbc.exceptions.MySQLSyntaxErrorExceptio n: Access denied for user ''@'localhost' to database 'esserver'
at com.mysql.jdbc.SQLError.createSQLException(SQLErro r.java:936)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.ja va:2870)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.ja va:812)
at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java: 3269)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:11 82)
at com.mysql.jdbc.Connection.createNewIO(Connection.j ava:2670)
at com.mysql.jdbc.Connection.<init>(Connection.java:1531)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonReg isteringDriver.java:266)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at snaq.db.ConnectionPool.create(ConnectionPool.java: 102)
at snaq.util.ObjectPool.checkOut(ObjectPool.java:178)
at snaq.util.ObjectPool.checkOut(ObjectPool.java:229)
at snaq.db.ConnectionPool.getConnection(ConnectionPoo l.java:234)
at snaq.db.ConnectionPoolManager.getConnection(Connec tionPoolManager.java:591)
at com.electrotank.electroserver5.examples.database.C onnectionPool.acquireObject(ConnectionPool.java:10 7)
at com.electrotank.electroserver5.entities.Extension. acquireObject(Extension.java:343)
at com.electrotank.electroserver5.extensions.api.Elec troServerApiImpl.acquireManagedObject(ElectroServe rApiImpl.java:986)
at com.electrotank.electroserver5.examples.database.D atabaseJDBCPlugin.doQuery(DatabaseJDBCPlugin.java: 52)
at com.electrotank.electroserver5.examples.database.T estDatabasePlugin.testQuery(TestDatabasePlugin.jav a:58)
at com.electrotank.electroserver5.examples.database.T estDatabasePlugin.init(TestDatabasePlugin.java:32)
at com.electrotank.electroserver5.entities.PluginBrid ge$1.call(PluginBridge.java:104)
at com.electrotank.electroserver5.entities.BaseBridge .withLockAndClassloader(BaseBridge.java:192)
at com.electrotank.electroserver5.entities.PluginBrid ge.withLockAndClassloader(PluginBridge.java:283)
at com.electrotank.electroserver5.entities.PluginBrid ge.initializePlugin(PluginBridge.java:102)
at

tcarr
11-17-2010, 02:20 PM
How is your MySQL configured? Is it set to allow connections from localhost, or from some other IP? Is the name of the database you are trying to use spelled correctly?

cau2germany
11-18-2010, 01:06 AM
Yes, It was set to allow connection from localhost.

I use MySQL of Appserv (included PHP & MySQL), I have been using it for a quite long time with PHP without any problem.

I tested by connecting to it through DbVisualier client with the same connection information and it was successful.

tcarr
11-18-2010, 01:22 AM
I have no idea why it won't connect. The error message is that MySQL is refusing the connection. The only thing I can think of is a typo in the username, password, or the url, or a MySQL configuration problem, or possibly if you have non-ASCII characters in your username, password, or database name.

tchen
11-27-2010, 06:07 AM
Dunno if this would help or not, but here's a thread from the archives...

http://www.electrotank.com/forums/showthread.php?10791-DatabaseExample-issue-question/page2

Are you using an older driver perhaps?

cau2germany
01-17-2011, 04:27 AM
Thank you for your help.

I think that the problem came from the firewall configuration in my Company.
I did it well in my private machine and my VPS server.

tcarr
01-17-2011, 01:42 PM
Glad that you figured it out!