Je n'arrive pas à me connecter à ma DB
Bonjour,
J'utilise Eclipse et PostgreSQL, je n'arrive pas à me connecter !
voici mon code de connection:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| public static Connection getConnection() throws FileNotFoundException, IOException, SQLException
{
Properties props = new Properties();
FileInputStream in = new FileInputStream ("COREJAVA.properties");
props.load(in);
in.close();
String drivers = props.getProperty("org.postgresql.Driver");
if(drivers != null)
{
System.setProperty("jdbc.drivers", drivers);
}
String url = "jdbc:postgresql:COREJAVA";
String username = "postgre";
String password = "pwd";
return DriverManager.getConnection(url, username, password);
}
} |
Je suis débutant en java, pouvez-vous m'aider ?
Merci infiniment ;) ;) ;)