1 message in com.mysql.lists.javaConnector J, Mysql 4.1 and empty pass...
FromSent OnAttachments
Ulrich Naegele04 Feb 2005 02:43 
Subject:Connector J, Mysql 4.1 and empty passwords
From:Ulrich Naegele (naeg@econda.de)
Date:02/04/2005 02:43:48 AM
List:com.mysql.lists.java

Hello everybody,

recently I ran into problem, when upgrading from MySQL 4.0 to 4.1. I have a user with an empty password e.g. user1. I can connect the Database with the commandline

mysql -uuser1

but I can not connect with Connector J (testet 3.0.10-stable and 3.1.6) on 4.1 while with MySQL 4.0 it worked perfectly. (Connecting with non empty passwords also works on 4.1 and 4.0)

Is this a known problem? What would you suggest ?(dispite using a non empty password :o)

Cheers Uli

Example: Suse Linux 9.0 with MySQL-Max-4.1.9 offical rpms, Sun JDK 1.4.2, Connector J 3.0.10 or 3.1.6

import java.sql.*; import javax.sql.*;

import com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource;

public class Test{

public static void main(String[] args) throws Exception{ System.out.println("testing");

//connect with datasource MysqlConnectionPoolDataSource dataSource = new MysqlConnectionPoolDataSource(); dataSource.setServerName("localhost"); dataSource.setPort(3306); dataSource.setDatabaseName("database"); dataSource.setPassword(""); dataSource.setUser("user1"); dataSource.getConnection();

//connect with DriverManager Class.forName("com.mysql.jdbc.Driver").newInstance(); Connection connection = DriverManager.getConnection("jdbc:mysql://localhost/database","user1","" );

System.out.println("test passed"); } }

Results in :

Exception in thread "main" java.sql.SQLException: Invalid authorization specification, message from server: "Access denied for user 'user1'@'localhost' (using password: YES)" at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1825) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1752) at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:2251) at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:695) at com.mysql.jdbc.Connection.createNewIO(Connection.java:1734) at com.mysql.jdbc.Connection.<init>(Connection.java:562) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:36 1) at java.sql.DriverManager.getConnection(DriverManager.java:512) at java.sql.DriverManager.getConnection(DriverManager.java:171) at Test.main(Test.java:21)

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

-----

Alle Erfolgskennzahlen von Online-Shops mit wenigen Klicks auf einen Blick? -

Testen Sie jetzt unseren ECONDA Monitor!

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

-----

ECONDA GmbH econtrolling - data mining Technologiefabrik Haid-und-Neu-Str. 7 76131 Karlsruhe

Tel.: 0721/6635788 Fax.: 0721/66499070

http://www.econda.de