set up jdbc

Поиск
Список
Период
Сортировка
Искать

set up jdbc

От:
"Pingdong Ai" <pingdong@cs.pdx.edu>
Дата:
hi, everyone

I am a beginner. I want to set up jdbc driver for Postgres 7.2.   Can
someone give me
a step-by-step suggestion.  Btw, I have the Postgres DBA account, but I
don't have the
system administrator account. (I am not sure whether this will make
difference).

Thanks a lot in advance!

Pingdong Ai
Portland, OR

Re: set up jdbc

От:
Thomas O'Dowd <tom@nooper.com>
Дата:
Have a peek at

http://jdbc.postgresql.org/doc.html#load

Tom.

On Mon, May 06, 2002 at 04:21:04PM -0700, Pingdong Ai wrote:
> hi, everyone
> 
> I am a beginner. I want to set up jdbc driver for Postgres 7.2.   Can
> someone give me
> a step-by-step suggestion.  Btw, I have the Postgres DBA account, but I
> don't have the
> system administrator account. (I am not sure whether this will make
> difference).
> 
> Thanks a lot in advance!
> 
> Pingdong Ai
> Portland, OR
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)

-- 
Thomas O'Dowd. - Nooping - http://nooper.com
tom@nooper.com - Testing - http://nooper.co.jp/labs

Re: set up jdbc

От:
"Tim Lucia" <Tim.Lucia@storigen.com>
Дата:
Here is a simple program which takes 4 arguments:

javac DBTest.java      # don't forget to put the jdbc jar in the classpath
java DBTest jdbc:postgresql:your-database-name username password table-name

It connects to the jdbc URL (1st arg) using the username and password (2nd/3rd) and dumps the data in table-name (4th arg)

Enjoy,
Tim Lucia

import java.sql.*;
public class DBTest
{
    public static void main(String[] args)
    {
        try {
            Class.forName("org.postgresql.Driver");
        }
        catch (Exception e) {
            e.printStackTrace();
        }
        try {
            Connection conn =
                DriverManager.getConnection(args[0], args[1], args[2]);
            Statement s = conn.createStatement(); 
            dumpSQLTable(s, args[3]);

        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }
    private static void dumpSQLTable(Statement dump, String tableName)
    {
        try {
            int rowCount = 0;
            String query = "SELECT * FROM " + tableName;
            java.sql.ResultSet rs = dump.executeQuery(query);
            ResultSetMetaData rsm = rs.getMetaData();
            final int columns = rsm.getColumnCount();
            System.out.println("");
            System.out.println("");
            System.out.println("");
            for (int i = 1; i <= columns; i++) {
                System.out.println("");
            }
            System.out.println("");
            while (rs.next()) {
                System.out.println("");
                for (int i = 1 ; i <= columns; i++) {
                    System.out.println("");
                }
                rowCount++;
                System.out.println("");
            }
            System.out.println("");
            System.out.println("
" + tableName + "
" + rsm.getColumnLabel(i) + "
" + rs.getObject(i) + "
Rows = " + rowCount + "
"); } catch (SQLException sqle) { System.out.println("Exception: " + sqle.getMessage()); } } } -----Original Message----- From: Pingdong Ai [mailto:pingdong@cs.pdx.edu] Sent: Monday, May 06, 2002 7:21 PM To: pgsql-jdbc@postgresql.org Subject: [JDBC] set up jdbc hi, everyone I am a beginner. I want to set up jdbc driver for Postgres 7.2. Can someone give me a step-by-step suggestion. Btw, I have the Postgres DBA account, but I don't have the system administrator account. (I am not sure whether this will make difference). Thanks a lot in advance! Pingdong Ai Portland, OR ---------------------------(end of broadcast)--------------------------- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)

Re: set up jdbc

От:
"Nick Fankhauser" <nickf@ontko.com>
Дата:

Although it is not a complete set of setup instructions, you'll find notes
about commonly encountered problems here:

http://www.fankhausers.com/postgresql/jdbc/

-Nick

> -----Original Message-----
> From: pgsql-jdbc-owner@postgresql.org
> [mailto:pgsql-jdbc-owner@postgresql.org]On Behalf Of Pingdong Ai
> Sent: Monday, May 06, 2002 6:21 PM
> To: pgsql-jdbc@postgresql.org
> Subject: [JDBC] set up jdbc
>
>
> hi, everyone
>
> I am a beginner. I want to set up jdbc driver for Postgres 7.2.   Can
> someone give me
> a step-by-step suggestion.  Btw, I have the Postgres DBA account, but I
> don't have the
> system administrator account. (I am not sure whether this will make
> difference).
>
> Thanks a lot in advance!
>
> Pingdong Ai
> Portland, OR
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>

FAQ