NullPointerException in DriverManager.getConnection
sofianeFeb 24 2013 — edited Feb 26 2013hi
i have a problem establishing an connection to PostgreSQL database on remote CentOS linux server ,when i run my program I get NullPionterExeption at DriverManager.getConnection
this is the code
String StringConnectionUrl="jdbc:postgresql://@IP/DB_NAME";
try
{
Class.forName("org.postgresql.Driver");
Properties prop=new Properties();
prop.put("user","postgres");
prop.put("password","postgres");
prop.put("ssl",true);
Connection con=DriverManager.getConnection(StringConnectionUrl,prop);
System.out.println(con.getCatalog());
}catch(SQLException ex)
{
System.err.println(ex.getMessage());
} catch(ClassNotFoundException ex){
System.err.println(ex.getMessage());
}
need your help please
Edited by: sofiane on Feb 24, 2013 12:17 PM