MySQL Connector/J 3.1 Error connecting to MySQL 4.1 (alpha)

MySQL Connector/J 3.1 Error connecting to MySQL 4.1 (alpha)

am 05.06.2003 21:35:38 von Shane Pitts

Hello..

Since I honestly know nothing about the Connector/J, or the
connection/responses it actually initiates with MySQL, I can't say with
any certainty at all what the problem is, or the correct way to fix it.
However, I do know how to replicate it, and how I made it work :-)

After much digging, and turning on the debug/trace settings in
com/mysql/jdbc/Driver.java I was able to conclude that the variable
"database" was being truncated when the packet was sent to the mySQL
server. The only logical explanation for this was the packLength used
in the MysqlIO.java file.

After tracing which code was running in my setup, I found that the
secureAuth() function was being called from line 686. Whenever I would
attempt a connect, it would return the error "Communication error during
handshake, unknown database 'reng'." The actual database was called
'rengames'

Just for a "test" I changed line 679 in MysqlIO.java to:
int packLength = (userLength + passwordLength + database.length()) + 6 +
HEADER_LENGTH;

It's original code omitted the database.length() count.

I don't know what the reasoning is for setting the length the way it is
set. All I know is that it currently isn't long enough. At least for
me, while using mySQL 4.1.. Maybe changing the + 6 to + 10 is
sufficient (4 chars where being truncated for me) I honestly don't
know.. I also don't know if there are "implications" of having it too
long.. I should try just setting it to + 300 and see what happens..

All I know is that it now works, and that was the only thing I changed..

If anyone wants to let me know "why" it works, or what the "more
correct" fix is, I'd be happy to test it out..

Shane..


--
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe: http://lists.mysql.com/bugs?unsub=gcdmb-bugs@m.gmane.org

Re: MySQL Connector/J 3.1 Error connecting to MySQL 4.1 (alpha)

am 05.06.2003 23:05:44 von Mark Matthews

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

Shane Pitts wrote:

> Hello..
>
> Since I honestly know nothing about the Connector/J, or the
> connection/responses it actually initiates with MySQL, I can't say with
> any certainty at all what the problem is, or the correct way to fix it.
> However, I do know how to replicate it, and how I made it work :-)
>
> After much digging, and turning on the debug/trace settings in
> com/mysql/jdbc/Driver.java I was able to conclude that the variable
> "database" was being truncated when the packet was sent to the mySQL
> server. The only logical explanation for this was the packLength used
> in the MysqlIO.java file.
>
> After tracing which code was running in my setup, I found that the
> secureAuth() function was being called from line 686. Whenever I would
> attempt a connect, it would return the error "Communication error during
> handshake, unknown database 'reng'." The actual database was called
> 'rengames'
>
> Just for a "test" I changed line 679 in MysqlIO.java to:
> int packLength = (userLength + passwordLength + database.length()) + 6 +
> HEADER_LENGTH;
>
> It's original code omitted the database.length() count.
>
> I don't know what the reasoning is for setting the length the way it is
> set. All I know is that it currently isn't long enough. At least for
> me, while using mySQL 4.1.. Maybe changing the + 6 to + 10 is
> sufficient (4 chars where being truncated for me) I honestly don't
> know.. I also don't know if there are "implications" of having it too
> long.. I should try just setting it to + 300 and see what happens..
>
> All I know is that it now works, and that was the only thing I changed..
>
> If anyone wants to let me know "why" it works, or what the "more
> correct" fix is, I'd be happy to test it out..
>
> Shane..
>
>

I fixed this in a different way, which you'll see once the nightly
snapshots have _everything_ that's currently about to be checked in
(there's a lot of internal changes to support the NIO interfaces, handle
configuration properties more sanely, etc).

Thanks!

-Mark

- --
For technical support contracts, visit https://order.mysql.com/?ref=mmma

__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Mark Matthews
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, SW Dev. Manager - J2EE/Windows
/_/ /_/\_, /___/\___\_\___/ Flossmoor (Chicago), IL USA
<___/ www.mysql.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQE+37CotvXNTca6JD8RAiErAJ4xdta5Wy54RVDFJlFoLMJyLfWltgCf ZLe6
053BuabKOubgzP5fayIVhn8=
=YvQ0
-----END PGP SIGNATURE-----


--
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe: http://lists.mysql.com/bugs?unsub=gcdmb-bugs@m.gmane.org