no save
Assistance
Achat
News

Forum | programmation
connexion java postgresql
workflow, le jeu. 14 sept. 2006 à 11:47:49
bonjour tout le monde ;
voila j'ai un problème au niveau de la connexion entre mon Postgresql (BD) et java je n'arrive pas à établir la connexion entre deux postes ou un est un serveur (ou est installée ma BD) et l'autre c un client qui peut faire toutes les reqêtes SQL sur ma BD?voila ma portion de code je ne sais pas si c un problème dans mon code ou de configuration de mon PostgreSQL?????
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.*;

public class Connect {

public Connection getConnection()
throws SQLException, ClassNotFoundException {
String dbUrl = "jdbc:postgresql://localhost/workflow";
String user ="postgres";
String password = "workflow";
Class.forName("org.postgresql.Driver"); //Driver
Connection c = DriverManager.getConnection(dbUrl, user, password);
//Statement s = c.createStatement();
System.out.println( " la connection est etabli, bravo !!!!");

return c;
}

public static void main(String[] args)throws Exception, SQLException,
ClassNotFoundException {
Connect m = new Connect();
Connection c = m.getConnection();
Statement instruction = c.createStatement();

}
}

merci beaucoup c très urgent


anahouana
nov. 07
Suivant
REPONSES
anahouana
nov. 07
Mahmoud
11 nov.
Version Web
Réalisé par RedShift
no save