ArrayIndexOutOfBounds Execption when using DriverManager.getConnection()
Posted by: Sarah Horne
Date: July 05, 2005 08:26PM

I am (attempting to) writing a series of Java based programs that access a MySQL database.

So far I have successfully interfaced a series of Java applications with the MySQL database however are having problems with interfacing a Java Applet with the MySQL database.

The machine that hosts the applet and the MySQL database are one and the same so I don't believe that there should be a Java Sandbox restriction.

Orginally I was getting an error:

Communications failure during handshake. Is there a MySQL server running on 127.0.0.1:3306?
Null
0
Communications failure during handshake. Is there a MySQL server running on 127.0.0.1:3306?
java.sql.SQLException: Communication failure during handshake. Is there a MySQL server running on 127.0.0.1:3306?
at com.mysql.jdbc.MySQLIO.init(MySQLIO.java:628)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:1621)
at com.mysql.jdbc.Connect(Driver.java:311)
at java.sql.DriverManager.getConnection(DriverManager.java:525)

caused by the following line of code:
conn = DriverManager.getConnection("jdbc:mysql://localhost/test?user=root&password =mypwd")

after looking at http://www.mysqlusers.com/msg/26275.hmtl I changed the MySQL password format to the pre-4.1 style password. (Although it does seem strange that a Java Application would interface with the database without this change).

After doing this I now receive an ArrayIndexOutOfBounds Exception error caused by conn = DriverManager.getConnection("jdbc:mysql://localhost/test?user=root&password =mypwd")

This error appears to occur regardless of whether I use the
conn = DriverManager.getConnection("url", "User", "password") format or the format used above.

Can anybody help?

Options: ReplyQuote




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.