Problem with Java-SQL connection, postgresql.conf file - Mailing list pgsql-jdbc

From Christopher Bruhn
Subject Problem with Java-SQL connection, postgresql.conf file
Date
Msg-id 001b01c6d820$e51157f0$5e9fac51@chris
Whole thread Raw
Responses Re: Problem with Java-SQL connection, postgresql.conf file
Re: Problem with Java-SQL connection, postgresql.conf file
List pgsql-jdbc
Hallo,
 
I want to establish a connection to an SQL Database from a
Java Applet which is situated on the same server. I used the
interface postgresql-8.2dev-503.jdbc3.jar. I use
NetBeans IDE 5.0 (Sum Microsystems) for the development of
Java Code. I copied postgresql-8.2dev-503.jdbc3.jar into the
build/classes folder of the project containing the Applet
and made it accessible for Compile and Run as a Library of
the project
(Project -> Properties -> Libraries -> added
postgresql-8.2dev-503.jdbc3.jar to Run and Compile). I also
added postgresql-8.2dev-503.jdbc3.jar as a driver
(Runtime -> Databases -> Drivers -> Add Driver -> PostgreSQL
(v7.0 and later) is accessible).
Moreover I unpacked the jar file into the build/classes folder
and uploaded all files contained in the build folder to the
server (SERVER_SOFTWARE: Apache/2.0.54 (Fedora)).
 
I used essentially the following Java code (Java 1.5.0_07)...
 
////////////////////////////
import java.applet.Applet;
import java.sql.*;
 
public class O17 extends Applet implements Runnable {
    private Thread worker;
 
    public synchronized void start() {
 if (worker == null) { 
            worker = new Thread(this);
     worker.start();
 }
    }
   
    public void run() {
 String url = "jdbc:postgresql://localhost/<DB>";
  
 try {
     Class.forName("org.postgresql.Driver");
 } catch(Exception ex) {
     setError("Can't find Database driver class: " + ex);
     return;
 }
 
 try {
     Connection con = DriverManager.getConnection(url,
      rightuser, rightpassword);
     Statement stmt = con.createStatement();
     stmt.executeUpdate(createTableCoffees);
    
     stmt.close();
     con.close();
 
 } catch(SQLException ex) {
     setError("SQLException: " + ex);
 }
    } 
}
////////////////////////////
 
... and different variations of the url which produced the following error codes:
 
jdbc:postgresql://localhost:5432/<DB>
jdbc:postgresql://localhost/<DB>
jdbc:postgresql://<DB>
->org.postgresql.util.PSQLException: Etwas Ungewöhnliches ist passiert,
das den Treiber fehlschlagen liess. Bitte teilen Sie diesen Fehler mit.
 
jdbc:postgresql://molekuelkueche.de/usr_web593_1
->org.postgresql.util.PSQLException: Der Verbindungsversuch schlug fehl.
(SERVER_NAME = www.molekuelkueche.de)
 
Moreover I searched for the postgresql.conf file but I could not find it
among the files extracted from postgresql-8.2dev-503.jdbc3.jar.
 
Can you tell me if I use the Driver in a wrong way, where I can find
the postgresql.conf file and if I need to make changes in this file?
 
Thank you very much for your help!
With kind regards,
Christopher Bruhn

pgsql-jdbc by date:

Previous
From: Marc Herbert
Date:
Subject: Re: about monitoring the input stream
Next
From: Roland Walter
Date:
Subject: Re: Problem with Java-SQL connection, postgresql.conf file