Click here to Skip to main content
15,879,613 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Even after adding the MySQL Connector jar file in my project, the statement "import java.sql.Connection" is an error.

package com.Connectors.Data;

import java.sql.Connection; (Error here)
import java.sql.DriverManager;

public class Connection {
  public static void main(String [] args){
	  Connection conn = null;
	  try {
		  Connection conn = DriverManager.getConnection("", "", "");  (Error here)
	  }catch(Exception e){
		  
	  }
  }
}


I'm using the latest version of connector J and have tried some other versions.
Posted
Comments
Mohibur Rashid 10-Nov-15 0:18am    
First of all, take a closer look at your class name. Its `Connection`, where as you are also importing `Connection` class, hence the conflict. Rename your Connection.java to something else as well as your public class name should be same as something else.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900