Hi, i'm new in jdbc and
my problem is, the driver doesn't load,
the code is:
public static void connect(){
try{
Class.forName("org.postgresql.Driver");
}catch(ClassNotFoundException cnfex){
System.err.println("driver load fail");
//the problem is here, i don't know what library i need and what i need to do with the classpath to this works,
//when compile to bytecode the error message is:
/*
driver load fail
Exception in thread "main" java.lang.NullPointerException
at DB.DBAccess.connect(DBAccess.java:45)
at DB.DBAccess.begin(DBAccess.java:81)
at Simulator.main(Simulator.java:23)
*/
}
String url = "jdbc:
postgresql://localhost/projeto";
Properties props = new Properties();
props.setProperty("user","postgres");
props.setProperty("password","postgres");
try{
Connection con = DriverManager.getConnection(url, props);
}catch(SQLException sql){}
try{
statement = con.createStatement();
}catch(SQLException sql){}
/*try{
con = DriverManager.getConnection("postgres:projeto:localhost", "postgres", "usuario1");
}
catch(SQLException sql){}
*/
}
If anyone have some idea about it thanks a lot, this is my last chance to solve this problem,
i have tryed many other forms to solve this, but i still have the problem
--
******************************************************
"Ciência da computação está tão relacionada
aos computadores quanto a Astronomia aos
telescópios, Biologia aos microscópios, ou
Química aos tubos de ensaio. A Ciência não
estuda ferramentas. Ela estuda como nós
as utilizamos, e o que descobrimos com elas."
(Edsger W. Dijkstra)
*******************************************************