pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Anders Svensson <anders@simusoft.dk>
To: pgsql-interfaces@postgresql.org
Subject: JDBC, can't connect to postgres
Date: Tue, 21 Sep 1999 14:02:19 +0200
Message-ID: <v04020a00b40d2269e0b6@[192.168.1.3]> (raw)

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@simusoft.dk
tlf.	: +45 3583 8126




Message-ID: <v04020a00b40d2269e0b6@[192.168.1.3]>
Permalink:  ../v04020a00b40d2269e0b6@%5B192.168.1.3%5D/
Also on:    postgresql.org/message-id/v04020a00b40d2269e0b6@[192.168.1.3]

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-interfaces@postgresql.org
  Cc: anders@simusoft.dk
  Subject: Re: JDBC, can't connect to postgres
  In-Reply-To: <v04020a00b40d2269e0b6@[192.168.1.3]>
  References: <v04020a00b40d2269e0b6@[192.168.1.3]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox