60 683
Assignments Done
97,8%
Successfully Done
In April 2018

Answer to Question #23743 in Java | JSP | JSF for Sourabh Vishal

Question #23743
getting error as "com.mysl.jdbc.Driver" when trying to run a simple programe named as iit registration
Expert's answer
Firstly, to start working with MySQL database in Java youhave to download the JDBC driver (or howit is called MySQL connector). Install it.

Secondly, in your code you have to import some packagesfrom it:

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

Then when trying to access to your database:
try {
Class.forName("com.mysql.jdbc.Driver"); //loading your JDBC driver Connection connect =
DriverManager.getConnection("jdbc:mysql:databasename”, “login”,
“password”); Statement statement = connect.createStatement(); // Result set get
the result of the SQL query ResultSet resultSet =
statement.executeQuery("select * from table_name"); } catch
(SQLException e) {
throwe;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions