File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Connecting to MySQL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Connecting to MySQL" Watch "Connecting to MySQL" New topic

Connecting to MySQL

bill bozeman
Ranch Hand

Joined: Jun 30, 2000
Posts: 1070
I am trying to make a connection to a mysql database. I have a database setup on some server and I have the proper driver setup. It does work when I place the class on the server by calling this:
But when I try to run the samething locally like this:
I get an error saying "Bad Handshake". From this I am assuming this must be a permissions thing on the server. Can anyone confirm that and/or tell me how I can change those permissions.
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
MySQL has an option to disallow connections from outside servers. The server needs to be configured to allow what you want. I forget how to do it, but it is in the manual at

Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
bill bozeman
Ranch Hand

Joined: Jun 30, 2000
Posts: 1070
Thanks Thomas, I found it. Looks like you have to change the user table. Change the host field to a wildcard or a mask to allow connections from any or certain computers. Of course I don't have access to the user table, but hopefully my hosting company will open it up for me.
I agree. Here's the link:
subject: Connecting to MySQL
It's not a secret anymore!