• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 43
Android C++ Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


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!!
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic