wood burning stoves*
The moose likes JDBC and the fly likes Connnecting Java programs to Mysql Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Connnecting Java programs to Mysql" Watch "Connnecting Java programs to Mysql" New topic
Author

Connnecting Java programs to Mysql

Saheed Adepoju
Ranch Hand

Joined: Jun 23, 2004
Posts: 267
Hi all
I have had this problem for a while now! I have the native drivers downloaded i just dont seem to know how to do the connection! I place the uncompressed file in my classpath as instructed in the README, it just doesnt seem to work! I use the Connect.java that came with a sample of the connector driver and it doesnt seem to work! Pls someone should help me out and point me in the right direction from the very begining again! Thanks for your anticipated response.


Saheed Adepoju<br />SCJP 1.4<br />SCJD (B&S..In progress)
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30356
    
150

Saheed,
"it doesn't work" is a bit vague in terms of us trying to help. What error message are you getting? Do you have sample code? Please post more details so we can work figuring out the problem.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Anand Karia
Ranch Hand

Joined: Sep 25, 2004
Posts: 156

Saheed!

I think you are using Dollar$one database and its sample.java file.

If you go through properly then you can understand that this sample file is just to let you know how to work in java using Dollar$one databse. You have to find out your requirements in that particular sample.java file and make new .java file and run it.

Correct me if i am wrong.


Love is GOD and GOD is Love.
Anand Karia
IT Concretor.......
M/s. Anand Karia Concreting IT
Saheed Adepoju
Ranch Hand

Joined: Jun 23, 2004
Posts: 267
Hi
Here is a sample code i got off the internet regarding connecting to mysql and modifying it i have the following


The above code when run gives me the output of "cannot connect to database" and then gives "com.mysql.jdbc.Driver" from e.getMessage()! I have Mysql installed properly and also have the native driver copied to the appropriate folder in my /JRE/bin/ext(I use a windows box)! Pls any apropriate help would be highly appreciated. Thanks.
Saheed Adepoju
Ranch Hand

Joined: Jun 23, 2004
Posts: 267
Hi
Strangely enough i didnt look through the postings of others! I found someone with the same problem and i am gonna try out the suggested solution! I will be in touch if i get into any trouble! Thanks all!
chsanthosh kumar
Ranch Hand

Joined: Jun 28, 2005
Posts: 56
Originally posted by Saheed Adepoju:
Hi
Here is a sample code i got off the internet regarding connecting to mysql and modifying it i have the following


The above code when run gives me the output of "cannot connect to database" and then gives "com.mysql.jdbc.Driver" from e.getMessage()! I have Mysql installed properly and also have the native driver copied to the appropriate folder in my /JRE/bin/ext(I use a windows box)! Pls any apropriate help would be highly appreciated. Thanks.




Hi All,
The same code i excuted in my system.And it is working finr for me.
First it's given Error Message(As the aboveOnly..)
After i changed the classpath using mysql connector jar file(mysql-connector-java-3.0.10-stable-bin.jar).
I Placed this file in my Classpath.Now it is working fine for me.

Please Check the same.
Thank You.


---------------------<br />SCJP(1.4)With 95%<br /> <br />Do it Right and Forget it!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Connnecting Java programs to Mysql