From: | Anders Svensson <anders(at)simusoft(dot)dk> |
---|---|
To: | pgsql-interfaces(at)postgresql(dot)org |
Subject: | JDBC, can't connect to postgres |
Date: | 1999-09-21 12:02:19 |
Message-ID: | v04020a00b40d2269e0b6@[192.168.1.3] |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-interfaces |
I am trying to use postgres as database server on a servlet run under
Apache and jserv
Problem is when I isue the Class.forName("postgresql.Driver")
I get an ClassNotFound Exception.
The latest driver for jdbc (jdbc6.5-1.2.jar) is the only path in my
CLASSPATH.
The java-program compiles just fine, and postmaster is started with the -i
option.
I am running the java program for a test without apache and servlet, on the
same machine as postmaster is on, but as a different user.
the config file for postmaster includes
local all trust
Any suggestions????
import java.io.*;
import java.net.*;
import java.sql.*;
public class test {
public static void main (String args[]) {
try {
Class.forName("postgresql.Driver");
System.out.println("Class.forName OK!");
String url = "jdbc:postgresql://192.168.1.1/fraggi";
String usr ="root";
String pwd ="";
Connection db = DriverManager.getConnection (url,usr,pwd);
if (db !=null)
System.out.println("Connected OK to database");
else
System.out.println("Faild to connect");
}
catch (Exception e) {
System.out.println(e.toString());
}
}
}
Simu Soft
v/Anders Svensson
Frederikssundsvej 20, 2 th
DK-2400 København NV
e-mail : Anders(at)simusoft(dot)dk
tlf. : +45 3583 8126
From | Date | Subject | |
---|---|---|---|
Next Message | Geeta Mahesh | 1999-09-21 12:24:26 | Table name of a select query. |
Previous Message | Antonio Pires | 1999-09-21 11:51:11 | pg_database |