Re: ArrayIndexOutOfBounds Execption when using DriverManager.getConnection()
Mark,
I have upraded to Connector/J 3.1.10, added mysql-connector-java-3.1.10-bin.jar to the classpath and removed the 3.1.8 jar file from the classpath, however the error message that I am receiving is still very similar.
Database Connection Problem
Error during query: Unexpected Exception: java.lang.ArrayIndexOutOfBoundsExcepti
on message given: 26
Error during query: Unexpected Exception: java.lang.ArrayIndexOutOfBoundsExcepti
on message given: 26
java.sql.SQLException: Error during query: Unexpected Exception: java.lang.Array
IndexOutOfBoundsException message given: 26
at com.mysql.jdbc.Connection.execSQL(Connection.java:1913)
at com.mysql.jdbc.Connection.execSQL(Connection.java:1842)
at com.mysql.jdbc.Statement.executeQuery(Statement.java:1064)
at com.mysql.jdbc.Connection.initializePropsFromServer(Connection.java:9
79)
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:523)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at test2.init(test2.java:30)
at sun.applet.AppletPanel.run(AppletPanel.java:354)
at java.lang.Thread.run(Thread.java:566)
-----------------------------------------------------
I have managed to repeat the error on three separate machines.
The code that I am using is:
import java.awt.*;
import java.sql.*;
public class test2 extends java.applet.Applet {
private Connection con;
public void init() {
try {
//Class.forName("org.gjt.mm.mysql.Driver").newInstance();
Class.forName("com.mysql.jdbc.Driver").newInstance();
}
catch (Exception e){
System.out.println("Database Driver Problem");
System.out.println(e.getMessage());
}
try {
con = DriverManager.getConnection("jdbc:mysql://localhost/personnel","root","pwd");
//con = DriverManager.getConnection("jdbc:mysql://localhost/personnel","root","pwd");
//con = DriverManager.getConnection("jdbc:mysql://localhost/personnel?user=root&password=pwd");
}
catch (Exception e){
System.out.println("Database Connection Problem");
System.out.println(e.getMessage());
System.out.println(e.getLocalizedMessage());
e.printStackTrace();
}
}
}
Subject
Written By
Posted
Re: ArrayIndexOutOfBounds Execption when using DriverManager.getConnection()
July 07, 2005 10:30PM
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.