import java.sql.DriverManager;
public class Connection {
public static Connection getDatabaseConnection(){
Connection con = null;
try{
// load the driver
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
// get the connection
con = DriverManager.getConnection ("jdbc:oracle:thin:@localhost:1521:bob", "scott", "tiger");
if(con != null){
System.out.println("Connection established Successfully at port : "+1521);
}else{
System.out.println("Could not establish Connection");
}
}
catch (Exception e){
e.printStackTrace();
con = null;
}
return con;
}
}
Error pointing on line
con = DriverManager.getConnection ("jdbc:oracle:thin:@localhost:1521:bob", "scott", "tiger");
Type Mismatch: Cannot convert from Connection to Connection
I have included the classes12.jar file as an external Jar file for the project.