How to connect Mysql with JDBC with null password
Posted by:
Andrew Ma
Date: August 14, 2004 10:07PM
I want to use JDBC to connect Mysql, but currently the user is root and password is null. Please help me. Thank you.
My test code is following:
----------------------------
public class Test {
public static void main(String[] arg) {
try {
Class.forName("org.gjt.mm.mysql.Driver");
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test_df","root", "");
} catch(Exception e) {
e.printStackTrace();
}
}
}
The exception is following:
------------------------------
java.lang.ExceptionInInitializerError
at com.mysql.jdbc.ResultSet.getString(ResultSet.java:1948)
at com.mysql.jdbc.Connection.initializePropsFromServer(Connection.java:983)
at com.mysql.jdbc.Connection.connectionInit(Connection.java:905)
at com.mysql.jdbc.Driver.connect(Driver.java:311)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at com.etchsoft.datafairy.Test.main(Test.java:21)
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 192
at java.lang.String.charAt(String.java:444)
at com.mysql.jdbc.StringUtils.<clinit>(StringUtils.java:48)
... 7 more
Exception in thread "main"
Subject
Written By
Posted
How to connect Mysql with JDBC with null password
August 14, 2004 10:07PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.