Обсуждение: JDBC

Поиск
Список
Период
Сортировка

JDBC

От
Elie Atallah
Дата:
Hello postgresql team,

I'am trying to connect to the posgresql database through JDBC and it
doesn't function.

1. I have made the postgresql.jar through the command "make jdbc2" -as
it is described in /src/interfaces/jdbc/  source- and it is copied to my
CLASSPATH
2. I have an access to the database through "psql" (the name of the
database is "test").
3.with this piece of code I'am trying to connect the data base:


 Class.forName("org.postgresql.Driver");    // load database interface
        // connect to the database
         String url = "jdbc:postgresql://gemini:6666/test";
         conn = DriverManager.getConnection(url);

/*gemini is the host where the postgresql had been started*/
/*I entered the the absolute location of gemini and it doesn't functions
too.*/
but during the running of my java code I get these Errors:

java.lang.NullPointerException
java.lang.NullPointerException
        at
org.postgresql.util.PSQLException.translate(PSQLException.java, Compiled
Code)
        at org.postgresql.util.PSQLException.<init>(PSQLException.java,
Compiled Code)
        at org.postgresql.Driver.connect(Driver.java, Compiled Code)
        at java.sql.DriverManager.getConnection(DriverManager.java,
Compiled Code)
        at java.sql.DriverManager.getConnection(DriverManager.java,
Compiled Code)
        at TestDBConnection.<init>(TestDBConnection.java, Compiled Code)

        at TestDBConnection.main(TestDBConnection.java, Compiled Code)



The port (6666)was defined during the installation.

Can you tell me please where could be the probleme


Thank you for your help in advance

Elie Atallah