This week's book giveaway is in the Web Services forum.
We're giving away four copies of Microservices in Action and have Morgan Bruce & Paulo A. Pereira on-line!
See this thread for details.
Win a copy of Microservices in Action this week in the Web Services forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

Connection problem with MYSQL  RSS feed

 
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Terence Doyle
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 173
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 173
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks, guys! Everything is up and running. What a brilliant web site this is!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!