I think your url String should be
"jdbc:postgresql:testing"
and your Class.forName should be either
"org.postgresql.Driver" or "postgresql.Driver"

John L.

Quoting Bart <[EMAIL PROTECTED]>:

> Hi, 
> 
> I installed debian 2.2r2 with _all_ the postgres-packages,  I created a
> database and via psql I can do whatever I want with the DB. Now I'm
> trying to make a connection via a Java-program. I downloaded the
> jdbc-6.5-1.2.jar file and renamed it to jdbc.jar and moved it to
> ~/jdk1.3/lib, set the CLASSPATH to ~/jdk1.3/lib and used a program,
> found in the Deitel&Deitel Java book.
> After that, I tried to make a connection to the database I created
> (testing) and I keep getting error-messages. 
> 
> Can someone help me with this? I'm trying for 3 days now and still no
> luck.
> 
> Thanks,
> Bart
> 
> 
>  --- program from Deitel & Deitel ---
> 
> import java.sql.*;
> import javax.swing.*;
> import java.awt.*;
> import java.awt.event.*;
> import java.util.*;
> 
> public class TableDisplay extends JFrame
> {
>       private Connection connection;
>       private JTable table;
>       
>       public TableDisplay()
>       {
>               String url = "jdbc:odbc:testing";   // I also tried with <String url =
> "jdbc:postgres:testing";>
>               String username = "postgres";
>               String password = "notentered";
> 
>               
>               try
>               {
>                       Class.forName("jdbc.Driver");
>                       connection = DriverManager.getConnection(url, username, 
>password);
>               }
>               catch (ClassNotFoundException cnfex)
>               {
>                       System.err.println("Failed to load the JDBC/ODBC driver.");
>                       cnfex.printStackTrace();
>                       System.exit(1);
>               }
>               catch (SQLException sqlex)
>               {
>                       System.err.println("Unable to connect to database.");
>                       sqlex.printStackTrace();
>               }
> . . . . . . . . .
> 
> ---------------------------(end of
> broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to
> [EMAIL PROTECTED])
> 


-------------------------------------------------
This mail sent through IMP: www.netspace.net.au


---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

Reply via email to