Skip site navigation (1) Skip section navigation (2)

JDBC, can't connect to postgres

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@[] (view raw, whole thread or download thread mbox)
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

The java-program compiles just fine, and postmaster is started with the -i
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.sql.*;

public class test {

    public static void main (String args[]) {

        try {
            System.out.println("Class.forName OK!");

            String url = "jdbc:postgresql://";
            String usr ="root";
            String pwd ="";

            Connection db = DriverManager.getConnection (url,usr,pwd);

            if (db !=null)
                System.out.println("Connected OK to database");
                System.out.println("Faild to connect");

        catch (Exception e) {

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

pgsql-interfaces by date

Next:From: Geeta MaheshDate: 1999-09-21 12:24:26
Subject: Table name of a select query.
Previous:From: Antonio PiresDate: 1999-09-21 11:51:11
Subject: pg_database

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group