Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

ClassNotFoundException("com.mysql.jdbcdriver")

$
0
0
I have installed MySql and edited my CLASSPATH(variable) to the path specifying the connector.
Now when I am running this code using java TestConnection it gives me ClassNotFoundException.
I am not getting where I am doing wrong. How can I get it correct?

import java.sql.*;

public class TestConnection
	{
   public static void main(String[] args)throws ClassNotFoundException
			{
	Class.forName("com.mysql.jdbc.Driver") ;			
    Connection conn = null;
    String url = "jdbc:mysql://localhost:3306/student";
    String userName = "root"; 
    String password = "twinrdmighty";
    try 
		{
          conn = DriverManager.getConnection(url,userName,password);
		  Statement stat = conn.createStatement() ;
		  stat.execute("create table student(fname varchar(100), lname varchar(100))") ;
		 }
	catch(Exception e)
		{}
          }
} 


Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>