This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes JDBC and the fly likes JAVA JDBC connectivity problem. Kindly see the attached code, Please guide me. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Bookmark "JAVA JDBC connectivity problem. Kindly see the attached code, Please guide me." Watch "JAVA JDBC connectivity problem. Kindly see the attached code, Please guide me." New topic
Author

JAVA JDBC connectivity problem. Kindly see the attached code, Please guide me.

vicky amrev
Greenhorn

Joined: Aug 06, 2012
Posts: 1
JAVA JDBC connectivity problem. I am using MySql database, also I have downloaded and configure JDBC Connector. In the end of this code please see the error that I am getting.
sonu raj
Ranch Hand

Joined: Jul 31, 2012
Posts: 43



Hi vicky,
I copied your code and created a database according to your code and I found two errors.
You have written "com.mysql.Jdbc.Driver". here 'J' of Jdbc should be in lowercase it should be "com.mysql.jdbc.Driver"
vicky amrev wrote:
try{
Class.forName("com.mysql.Jdbc.Driver");


one more mistake you have not mentioned any user name and password in below code, do mention the username and password for your mysql.

conn = DriverManager.getConnection(
"jdbc:mysql://vicky-PC/student");
rs = conn.createStatement().executeQuery("select * from student");


It should be DriverManager.getConnection("jdbc:mysql://vicky-PC/student","root","password"); here root is default username for mysql and enter the password set while installing it.
Rest of the code is Correct. All the best!!
 
Don't get me started about those stupid light bulbs.
 
subject: JAVA JDBC connectivity problem. Kindly see the attached code, Please guide me.