Two Laptop Bag
The moose likes JDBC and Relational Databases and the fly likes Reg JDBC Connector in 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 "Reg JDBC Connector in MySql" Watch "Reg JDBC Connector in MySql" New topic

Reg JDBC Connector in MySql

Karthik Krishnamurthy
Ranch Hand

Joined: Feb 04, 2005
Posts: 118
I am using the mysql-connector-java-3.1.12-bin.jar driver for jdbc connectivity to my MySql Database.

My question is does this need JDK1.4 and above to funtion / deliver a connection.

Reason I am asking is I am working on a company product that uses its own jre (version 1.3) and at the DriverManager.getConnection point it hangs.

Code :
S.o.pln("After class");
S.o.pln("After connect");

When I run this one as its own application, the connection is fine.

But when I run it as part of this product it prints "After Class" but stops and does nothing afterward.

Please Help

George Stoianov
Ranch Hand

Joined: Jan 15, 2006
Posts: 94

You should get an exception if there is a problem if there is no problem than it maybe that this is taking very the db server on the same machine...seems like it from the url. You can try exchanging localhost with and trying that I had an experience like that with an older driver as far as I can remember. I think your driver is not the latest I think 15 is the latest. Check that would be the best place for the JVM version question as well, even though I think it should work.

You should also try a "dry test" no java just calling up mysql and connection with the same credentials, also check if mysql is running and listening.

Hope this helps
Maximilian Xavier Stocker
Ranch Hand

Joined: Sep 20, 2005
Posts: 381
Please please please do not use SMS in your CODE examples! It's just terrible. Javaranch is not charging you the use of this forum by the letter and it makes your code difficult to read.

Now as to your problem. What do you mean hang? Forever? Or just awhile? There are alot of possibilities of what could be happening many of the network related difficulties.

It would be nice to see your real code because for various and sundry reasons what you posted is not it. It would also be nice to see an error message... or perhaps you are eating it in an empty catch block. Please post your actual real code and any error messages you are getting.
I agree. Here's the link:
subject: Reg JDBC Connector in MySql
It's not a secret anymore!