Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

NullPointerException in DriverManager.getConnection

sofianeFeb 24 2013 — edited Feb 26 2013
hi







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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 26 2013
Added on Feb 24 2013
6 comments
628 views