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

Re: Connect via odbc from Windows to Linux

From: Bruce Hyatt <brucejhyatt(at)yahoo(dot)com>
To: Oliver Jowett <oliver(at)opencloud(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org, John R Pierce <pierce(at)hogranch(dot)com>
Subject: Re: Connect via odbc from Windows to Linux
Date: 2008-12-02 21:33:31
Message-ID: 910591.64100.qm@web34403.mail.mud.yahoo.com (view raw or flat)
Thread:
Lists: pgsql-jdbc
--- On Mon, 12/1/08, Oliver Jowett <oliver(at)opencloud(dot)com> wrote:

> I suggest you post your whole testcase to the list,
> it's too hard to guess at exactly what you're doing
> otherwise.

import java.sql.*;

public class TestPlatingShop {
    public static void main(String[] arguments) {
        String data = "jdbc:postgresql://192.168.1.199/platingshop";
        try {
            // call to Class.forName no longer necessary
            Class.forName("org.postgresql.Driver");
            Connection conn = DriverManager.getConnection(
                data, "", "");
            Statement st = conn.createStatement();
            ResultSet rec = st.executeQuery(
                "SELECT custname " +
                "FROM customers " +
                "WHERE " +
                "(acctnum = 'B20109')");
            System.out.println("Customer Name");
            while(rec.next()) {
                System.out.println(rec.getString(1));
            }
            st.close();
        } catch (SQLException s) {
            System.out.println("SQL Error: " + s.toString() + " "
                + s.getErrorCode() + " " + s.getSQLState());
        } catch (Exception e) {
            System.out.println("Error: " + e.toString()
                + e.getMessage());
        }
    }
}

This returns "Error: java.lang.ClassNotFoundException: org.postgresql.Driverorg.postgresql.Driver" when run.

Bruce


      

In response to

Responses

pgsql-jdbc by date

Next:From: Oliver JowettDate: 2008-12-02 21:37:27
Subject: Re: Connect via odbc from Windows to Linux
Previous:From: Oliver JowettDate: 2008-12-02 03:32:02
Subject: Re: Connect via odbc from Windows to Linux

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