*
The moose likes JDBC and the fly likes Connection problem with MYSQL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Connection problem with MYSQL" Watch "Connection problem with MYSQL" New topic
Author

Connection problem with MYSQL

Terence Doyle
Ranch Hand

Joined: May 30, 2001
Posts: 328
HI,
I'm trying to run an example from at tutorial and the connection doesn't seem to be made properly. Is ther anything wrong with this code?

- I have the JDBC driver installed and in the class path.
- The account and password strings contain the correct info
- the port number is correct

Ideas??
Thanks in advance.
Terry

Raising Flares debut album 'Ignition' out now

http://www.raisingflares.com

Terry Doyle <br />SCPJ 1.4 , SCWCD , SCMAD(Beta)
Terence Doyle
Ranch Hand

Joined: May 30, 2001
Posts: 328
HI,
I sorted it out by myself.
The problem was that I didn't need to pass in the user and login as I am running it on W98.
So I changed the get.Connection() to include "" for account and password.

Bye,
Terry
Simon Ingram
Ranch Hand

Joined: Nov 30, 2003
Posts: 171
Hi folks!

I am trying to do what Terrance did, namely connect a Java program to MySQL. Reading this post, I realise I have not installed the Connector/J driver and it's not in my class path. How do you do this? I have downloaded the Connector/J zip file (I am using windows XP) from MySQL into a separte directory on my drive and I have extracted a load of stuff but I have no idea where the driver is or how to configure it. Has anyone done this before, I have been horsing about clueless for days on this and if I don't get it sorted soon, I shall become seriously depressed!
Jason Moors
Ranch Hand

Joined: Dec 04, 2001
Posts: 188
If you search for mysql-connector-java*.zip you should be able to find the driver ZIP file.

Contained within the ZIP file there should be a JAR file named something like mysql-connector-java-3.1.12-bin.jar (depending on your version).

You need to extract the file to certain location and then add the JAR file to your CLASSPATH environment variable.

i.e if you extract to c:\msqldriver

you need to add to CLASSPATH

c:\mysqldriver\mysql-connector-java-3.1.12-bin.jar

Jason
benny rusli
Ranch Hand

Joined: Jan 15, 2005
Posts: 72
or you can put the mysql connector jar file into the directory where you install your jdk or jre. Specifically put into the directory : c:/Java/jdk1.5.0/jre/lib/ext or if you only install jre c:/Java/jre1.5.0/lib/ext. I hope this help you.
Simon Ingram
Ranch Hand

Joined: Nov 30, 2003
Posts: 171
thanks, guys! Everything is up and running. What a brilliant web site this is!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Connection problem with MYSQL
 
Similar Threads
Communications link failure
error in servlet
Servlet and JDBC
Changing Timeout
Access denied for user