Sory for my weak english, I want to connect mysql connection with java, I added the mysql-connector.jar but class not found error still continue. Here is the screenshot of build path.
What should I do for the connect mysql
Here is the code
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
try{
Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection(DB_URL,USER,PASS);
String sql1 = "INSERT INTO test (name) VALUES(?)";
stmt = conn.prepareStatement(sql1);
stmt.setString(1, okey);
}
// execute insert SQL stetement
stmt .executeUpdate();
stmt.close();
conn.close();
}catch(SQLException se){
//Handle errors for JDBC
se.printStackTrace();
}catch(Exception e){
//Handle errors for Class.forName
e.printStackTrace();
}finally{
try{
if(stmt!=null)
stmt.close();
}catch(SQLException se2){
}// nothing we can do
try{
if(conn!=null)
conn.close();
}catch(SQLException se){
}//end finally try
}//end try