3 messages in com.mysql.lists.javaRe: Bug of MySQL Connector/J 3.0.12 ?
FromSent OnAttachments
Huang wen hui19 May 2004 18:48 
Mark Matthews19 May 2004 19:03 
Huang wen hui19 May 2004 19:52 
Subject:Re: Bug of MySQL Connector/J 3.0.12 ?
From:Mark Matthews (ma@mysql.com)
Date:05/19/2004 07:03:08 PM
List:com.mysql.lists.java

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1

Huang wen hui wrote:

hi, I use mysql server 4.0.20 + connector/J 3.0.12. I got "No Database Selected" msg when using PooledConnection( using DriverManager is ok). I change back to connector/J 3.0.10. It works fine again.

--hwh

java.sql.SQLException: General error, message from server: "No Database Selected" at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1962) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1163) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1257) at com.mysql.jdbc.MysqlIO.sqlQuery(MysqlIO.java:1218) at com.mysql.jdbc.Connection.execSQL(Connection.java:2239) at com.mysql.jdbc.Connection.execSQL(Connection.java:2187) at com.mysql.jdbc.Statement.executeQuery(Statement.java:1158) at

com.mysql.jdbc.jdbc2.optional.StatementWrapper.executeQuery(StatementWrapper.java:617)

at cn.gd.test.TestTimer.query(TestTimer.java:56) at cn.gd.test.TestTimer.main(TestTimer.java:75)

----------------------------------------------------------------

try {

Connection conn = null; Statement stmt = null;

String jdbcDriver = "com.mysql.jdbc.Driver"; String dbURL = "jdbc:mysql://localhost/apnet?user=apnet"+ "&password=apnet" + "&socketTimeout=1800000&useUnicode=true&characterEncoding=eucCN";

MysqlConnectionPoolDataSource dataSource = new MysqlConnectionPoolDataSource(); dataSource.setUrl(dbURL); dataSource.setDatabaseName("apnet");

It looks like a bug, however there seems to be an issue with your code as well...Why are you specifying the database name in both the URL, and via setDatabaseName(). You should use _either_ setUrl(), or the individual property setters, not both at the same time.

Regards,

- Mark

- -- Mr. Mark Matthews MySQL AB, Software Development Manager, J2EE and Windows Platforms Office: +1 708 332 0507 www.mysql.com

MySQL Guide to Lower TCO http://www.mysql.com/it-resources/white-papers/tco.php -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (MingW32) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFArBHytvXNTca6JD8RAjRBAKCp9ZmAlcdrbtU5ApaBHeHMjUpzhQCfUMBW Huq0OE0u8UWg6k6zv54o8po= =0mCp -----END PGP SIGNATURE-----