HAVE POSTGRESQL JDBC 2.0 ??? HELPPPPPPPPPPP

i am using jdbc7.0-1.2.jar
this jdbc driver implements the jdbc 2.0 api ????
when i run this code above a \n error ocurrs
SQLEXCEPTION: this method is not yet implemented
here is the code:
stmt = con.createStatement( ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
Content[] aContent = new Content[iRows];
rs.absolute(1);
while (rs.next()) {
aContent[i] = new Content(rs.getInt(1), rs.getString(2),rs.getString(3),rs.getString(4),rs.getString(5),rs.getString(6),rs.getString(7),rs.getString(8),rs.getString(9),rs.getInt(10),rs.getInt(11));      i++;
}

i found where the error but i can't solve this ....
i changed the line above
stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
and it still having problem
im using java 1.4 and its features is since the 1.2 ... i am using jakarta
4.0 ....
whats is the problem ????? i cant understand ....

Similar Messages

  • PostgreSql JDBC from Red Hat Linux works on Windows not on Linux

    I started using ODI from a Windows XP box in development and Beta, and was successfully connecting to and loading data from several different database platforms including a PostgreSql database. I copied the PostgreSql JDBC driver to the ODI drivers folder, set up the connection information and it worked. When I moved from Windows XP to "Red Hat Enterprise Linux AS release 4 (Nahant Update 6)", I could no longer connect to this PostgreSql database. I put the same driver jar file "postgresql-8.3-603.jdbc3.jar" in the drivers folder and used the same connection string. All of the other drivers (Oracle, MS SQL, etc.) in that driver folder work correctly on this Linux box. I can even tell ODI to connect to the PostgreSql through the agent on the Windows XP machine and it works. That suggests that the URL must be OK, but for some reason it can't connect from the Linux box. I also tried updating to the newest driver"postgresql-8.3-604.jdbc3.jar" with no success.
    Any Ideas on what I may have missed?

    I started using ODI from a Windows XP box in development and Beta, and was successfully connecting to and loading data from several different database >>>>platforms including a PostgreSql database. I copied the PostgreSql JDBC driver to the ODI drivers folder, set up the connection information and it worked.
    When I moved from Windows XP to "Red Hat Enterprise Linux AS release 4 (Nahant Update 6)", I could no longer connect to this PostgreSql database. I >>>>put the same driver jar file "postgresql-8.3-603.jdbc3.jar" in the drivers folder and used the same connection string.
    All of the other drivers (Oracle, MS SQL, etc.) in that driver folder work correctly on this Linux box. I can even tell ODI to connect to the PostgreSql through >>>>the agent on the Windows XP machine and it works.
    That suggests that the URL must be OK, but for some reason it can't connect from the Linux box. I also tried updating to the newest driver
    "postgresql-8.3-604.jdbc3.jar" with no success.
    Any Ideas on what I may have missed?Hi,
    I'm having a problem in connecting to a PostGreSQL database, I was just wondering how you did it? I'm using a Windows Server 2003 R2 Standard Edition.
    Thanks,
    Randy

  • Postgresql-jdbc on Suse Linux

    Hi,
    I am writing a Java Swing application on Suse Linux and want to add Embedded SQL to it. The application should interact with a PostgreSQL database running on my local machine. The compiler complains that it cannot find the org.postgresql package included in the code. I'm guessing the problem is that the classpath is not set properly. But when I try to add the postgresql-jdbc driver to the classpath using "export CLASSPATH=$CLASSPATH:/usr/share/pgsql/pg73b1jdbc1.jar", the program stops recognizing the other Java files it uses. How do I set the classpath up properly?
    Code sample:
    import java.awt.*;
    import javax.swing*;
    import java.sql.*;
    import org.postgresql.*;
    public class MyClass
    public static void main (String [] args)
    MyFrame frame = new MyFrame();
    MyPanel panel = new MyPanel();
    // more code here
    MyClass.java:4: package org.postgresql does not exist
    import org.postgresql.*;
    ^
    1 error
    Any help is much appreciated.
    Marina.

    Hi, I figured it out - thanks to JimDinosaur's response, although to a different thread. I am posting a reply in case other people had the same question.
    So, I had two problems: first, the package wasn't recognized; second, the rest of the Java files used by the code.
    Jim suggested to use javac -classpath, listing all the directories needed, for the packages and the files. So I did, with the files directory being my current directory:
    javac -classpath /usr/share/pgsql/pg73b1jdbc1.jar:. CloningGUI.java
    Jim, you rock! :)

  • PostgreSQL JDBC Timeout

    Hello... how can i set a timeout to my PostgreSQL jdbc connections? My application cant wait the large solaris default tcp timeout....
    thanks...

    I tryed to use the loginTimeout propertie and it appear work fine, but when the timeout occurs he keeps locked a thread called "PostgreSQL JDBC driver connection thread" that confuses my thread counter based on ThreadGroup.... i think that this loginTimeout does not use the setSOTimeout....

  • Installing Postgresql JDBC Driver WLS 8.1

    Hi,
    Can somebody explain how I install the JDBC Driver for postgresql? I have WLS
    8.1.2 on Win XP. I think the solution would be to set the CLASSPATH to the appropriate
    location. But how do I do this permanently?
    Thanks,
    Oliver

    Oliver wrote:
    Hi,
    Can somebody explain how I install the JDBC Driver for postgresql? I have WLS
    8.1.2 on Win XP. I think the solution would be to set the CLASSPATH to the appropriate
    location. But how do I do this permanently?
    Thanks,
    OliverHi. Read the startWeblogic script to see how it constructs the -classpath argument for
    the weblogic JVM. You can either add the postgres classes to an environment variable
    PRE_CLASSPATH, or edit the startup script etc.
    Joe

  • BLOB support in standard postgresql jdbc driver - OutOfMemoryError

    Hi all,
    I have a problem with PostgreSQL and BLOBs.
    Small BLOBs work, but with BLOBs of a certain size my code throws a java.lang.OutOfMemoryError.
    The file I tried has about 2-3 MB.
    Environment:
    - PostgreSQL 7.2 on i686-pc-linux-gnu, compiled by GCC 2.96
    - Mandrake 8.2
    - 192 MB RAM
    - blob column created as datatype "bytea" (maybe that is the problem)
    - code posted below (BlobPostgresTest.java)
    - console output posted below
    - java command to run program:
        java -verbose:gc -Xmx128m -classpath .:pgjdbc2.jar BlobPostgresTest- java version as follows from "java -version" command:
        java version "1.4.0_01"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0_01-b03)
        Java HotSpot(TM) Client VM (build 1.4.0_01-b03, mixed mode)do you have an idea how to solve this problem ?
    Console output (including GC activities):
    =========================================
    java -verbose:gc -Xmx128m -classpath .:pgjdbc2.jar BlobPostgresTest
    BLOB/PostgreSQL Demo started
    [GC 511K->230K(1984K), 0.0163708 secs]
    preparing statement
    setting binary stream
    [GC 402K->273K(1984K), 0.0092325 secs]
    [Full GC 273K->273K(1984K), 0.0771294 secs]
    [GC 4351K->4058K(4908K), 0.0046329 secs]
    [Full GC 4058K->3770K(4908K), 0.0831070 secs]
    [GC 4922K->4922K(6860K), 0.0009556 secs]
    [Full GC 4922K->4346K(6860K), 0.0890570 secs]
    [GC 6650K->6650K(7820K), 0.0011110 secs]
    [Full GC 6650K->5496K(7820K), 0.1420860 secs]
    [GC 10104K->10104K(14480K), 0.0012827 secs]
    [Full GC 10104K->7800K(14480K), 0.1236744 secs]
    [GC 17016K->17016K(24084K), 0.0015421 secs]
    [Full GC 17016K->12408K(24084K), 0.1688843 secs]
    [GC 30840K->30840K(43224K), 0.0020800 secs]
    [Full GC 30840K->21624K(43224K), 0.2547274 secs]
    [GC 76920K->74616K(81500K), 0.0041685 secs]
    [Full GC 74616K->49272K(81500K), 0.5688448 secs]
    [GC 67704K->67704K(88332K), 0.0033407 secs]
    [Full GC 67704K->58488K(88332K), 0.2558231 secs]
    executing update
    [GC 95352K->95352K(104844K), 0.0932741 secs]
    [Full GC 95352K->40056K(104844K), 0.9644251 secs]
    [GC 69245K->69245K(104844K), 0.0036631 secs]
    [Full GC 69245K->69245K(104844K), 0.0814962 secs]
    [Full GC 69245K->66324K(129728K), 1.1439123 secs]
    Exception in thread "main" java.lang.OutOfMemoryError
    BlobPostgresTest.java
    =====================
    import java.sql.*;
    import java.io.*;
    drop table blobdemo;
    drop sequence blobdemo_id_seq;
    create table blobdemo(
      id serial not null primary key,
      name varchar(50),
      content bytea);
    public final class BlobPostgresTest {
        private final static String NAME = "TEST";
        //private final static String FILE_NAME = "/tmp/blob/2mb.xxx";
        private final static String FILE_NAME = "BlobPostgresTest.java";
        public final static void main(String[] args) throws Throwable {
         Connection con = null;
         Statement statement = null;
         PreparedStatement insertStatement = null;
         ResultSet rs = null;
         File file = null;
         FileInputStream fis = null;
         BufferedInputStream bis = null;
         try {
             System.out.println("BLOB/PostgreSQL Demo started");
             Class.forName("org.postgresql.Driver");
             con = DriverManager.getConnection
              ("jdbc:postgresql://localhost/template1",
               "postgres", "");
             con.setAutoCommit(true);
             statement = con.createStatement();
             // cleanup
             statement.executeUpdate("delete from blobdemo");
             // file
             file = new File(FILE_NAME);
             fis = new FileInputStream(file);
             bis = new BufferedInputStream(fis);
             // insert one record
             System.out.println("preparing statement");
             insertStatement = con.prepareStatement
              ("insert into blobdemo ( name, content ) values ( ?, ? )");
             insertStatement.setString(1, NAME);
             System.out.println("setting binary stream");
             insertStatement.setBinaryStream(2, bis, (int)file.length());
             System.out.println("executing update");
             insertStatement.executeUpdate();
             // retrieve
             rs = statement.executeQuery
              ("select id, name, content from blobdemo");
             while(rs.next()) {
              System.out.println("id=" + rs.getObject(1));
              System.out.println("name=" + rs.getObject(2));
              byte[] bytes = rs.getBytes(3);
              String content = new String(bytes);
              //System.out.println(content);
              System.out.println("retrieved " + bytes.length +  " bytes");
         } finally {
             if(rs != null) rs.close();
             if(statement != null) statement.close();
             if(insertStatement != null) insertStatement.close();
             if(con != null) con.close();
             if(fis != null) fis.close();
             if(bis != null) bis.close();
         System.out.println("BLOB/PostgreSQL Demo complete");
    }

    FYI: I'm in contact with the postgres team to work on the problem. it is caused by the way blobs are implemented in the jdbc driver.
    http://archives.postgresql.org/pgsql-jdbc/2002-08/msg00096.php

  • Postgresql,jdbc PLEASE HELP

    hi
    I have downloaded and installed and built ant, but i don't know how to continue, please help

    try here: http://jdbc.postgresql.org/doc.html

  • PostgreSQL & JDBC - ClassNotFoundException

    I'm trying to get my servlet to play nicely with postgresql, but I keep getting a ClassNotFoundException at compile time. I have added only one line (Class.forName("org.postgresql.Driver");) to a previously working servlet - it should initialize the driver as per the postgresql documentation, but it keeps throwing this error.
    I recognize that this should have to do with the classpath, but I've tried many different configurations and it's still broken. $CLASSPATH currently looks like this:
    :/usr/local/tomcat/webapps/test/WEB-INF/servlet-api.jar:/usr/local/tomcat/webapps/test/WEB-INF/postgresql-8.1-405.jdbc3.jar:/usr/local/tomcat/webapps/test/WEB-INF/classes/i looked into that postgresql-8.1-405.jdbc3.jar file, and the org.postgresql.Driver is present. running simply "java org.postgresql.Driver" successfully finds the class. I've tried setting the classpath at the command line when running javac too, and i still get the same error. I'm out of ideas!
    Below is (the relevant part of) my code. Any help is most appreciated!
    package mypackage;
    import java.io.IOException;
    import java.io.PrintWriter;
    import java.util.*;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import java.sql.*;
    public final class Map extends HttpServlet {
       List<Location> aList = new ArrayList<Location>(2);
       Location a = new Location("Apartment #1","Residence"," West 4th St", -74.001634, 40.732889);
       Location b = new Location("Apartment #2","Residence","Bank St", -74.003161, 40.737430);
       public void doGet(HttpServletRequest request,
                          HttpServletResponse response)
          throws IOException, ServletException {
             aList.add(0, a);
             aList.add(1, b);
         Class.forName("org.postgresql.Driver");
         response.setContentType("text/html");
         PrintWriter writer = response.getWriter();
         writer.println("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"");
    //And it goes on for a while like that, then ends with...
    }

    I'm trying to get my servlet to play nicely with
    postgresql, but I keep getting a
    ClassNotFoundException at compile time. "at compile time" - now I see.
    Putting the JAR file in the WEB-INF/lib of your app or Tomcat's common/lib only affects runtime behavior. At compile time you have to tell the compiler where to find what you need.
    The Class.forName() call doesn't actually cause the PostgreSQL driver class to be loaded - that's runtime behavior. The compiler was complaining about the lack of the try/catch block.
    The thing is that javac.exe doesn't give a hoot about your system CLASSPATH. Use the -classpath option to add paths to classes and JAR files that you need.
    I kept thinking that you were having a runtime problem.
    %

  • How to have remote jdbc connection to timeten?

    I think our admin have set up a timeten daemon , can I connect it remotely using JDBC connection? How the connection should be? Is it like
    jdbc:timesten:192.168.1.2:dsn=my_dsn
    ??

    To create a JDBC connection, you need to specify a TimesTen connection URL. The format of a TimesTen connection URL is: </br></br>
    jdbc:timesten:{direct | client}:dsn=DSNname;[DSNattributes;]
    </br></br>
    For example, to create a client connection to the demo data store, the URL looks similar to the following:
    String URL = "jdbc:timesten:client:dsn=demoCS";
    </br></br>
    For more information, please refer to the section "Connecting to a TimesTen data store" in the Oracle TimesTen In-Memory Database Java Developer's and Reference Guide.

  • SAP BI 4.0 SP2 on Linux and Postgresql Datasource via JDBC drivers

    Hi,
    I installed SAP BI Platform 4.0 SP2 on Redhat 5.2 and i try to access as a universe datasource a postgresql database (v8.4). But i don't know how to configure the postgresql JDBC driver on linux server.
    does anyone have a step by step procedure to configure this JDBC postgresql driver on linux ?
    I download this driver : http://jdbc.postgresql.org/download/postgresql-8.4-703.jdbc3.jar
    I read the SAP Data Access document for SAP BI 4.0 SP2 about JDBC connexions, they talk about a SBO file located in $ROOT_DIR/sap_bobj/enterprise_xi40/dataAccess/connectionServer/jdbc , but there isn't any SBO file for postgresql database ?
    Thanks in advance
    JP
    Edited by: Jean-Philippe ARNALOT on Oct 6, 2011 6:58 PM

    Hi
    I found a solution alone, this note 1347514 helps me :
    My conf : Redhat 5.2 + SAP BI 4.0 SP2 + postgresql 8.4 datasource + jdbc drivers
    My solution :
    1) Download JDBC drivers on client side (http://jdbc.postgresql.org/download/postgresql-8.4-703.jdbc3.jar)
    2) Create and export a JDBC connexion for postgresql8
    3) Create and export a universe using this connexion (test a query in universe design tool tools/Querybuilder)
    4) install JDBC drivers on server side, i copied the jar file in this location : $ROOT_DIR/sap_bobj/enterprise_xi40/dataAccess/connectionServer/drivers/java/postgresql-8.4-703.jdbc3.jar
    5) Set your classpath in your .profile : CLASSPATH=$CLASSPATH:/export/logiciels/tes-boxi/sap_bobj/enterprise_xi40/dataAccess/connectionServer/drivers/java/postgresql-8.4-703.jdbc3.jar; export CLASSPATH
    6) Source your .profile
    7) Restart servers (i think restarting only webi server would be ok)
    8) Open BI LaunchPad, start Webi and execute a query on postgresql universe
    It Works with my configuration
    Thanks for your help 
    JP

  • How to add new JDBC driver ?

    OS - Linux
    SunAppServ 9.1
    Hi, I want to create in AdminPanel on 4848 port new ConnectionPool in Resources/JDBC.
    To do this I can chose Postgres Vendor but I want to use my new Postgres driver because default is not work.
    I hava postgresql-8.2-505.jdbc4.jar file
    in this file there is a directories org/postgresql/ds/PGPoolingDataSource.class which I want to use.
    Where I should copy this postgresql-8.2...jar file
    I tried copy to JEE5_HOME/lib/. and in secend step i write class postgresql-8.2-505.jdbc4.org.postgresql.ds.PGPoolingDataSource
    but this doesn't work.
    BTW this driver work in NetBeans (I have jdbc connection in Runtime and linked this driver)

    Please Refer :
    1) http://blogs.sun.com/JagadishPrasath/entry/creating_jdbc_connection_pool_resource
    2) http://blogs.sun.com/JagadishPrasath/entry/jdbc_connection_pool_templates_glassfish

  • Intalling Postgresql in solaris 10

    I have downloaded the postgresql package from
    www.postgresql.org/download/bittorent
    i have unziped the files. i dont know how to continue with the installation.

    Here is some documentation to get you started......It available online.
    Author : Chris Drawater
    Date
    : May 2005
    Version : 1.2
    PostgreSQL 8.0.02 for J2EE applications on Solaris 10
    Abstract
    Advance planning enables PostgreSQL 8 and its associated JDBC driver to be quickly deployed in a
    basic but resilient and IO efficient manner.
    Minimal change is required to switch JDBC applications from Oracle to PostgreSQL.
    Document Status
    This document is Copyright � 2005 by Chris Drawater.
    This document is freely distributable under the license terms of the GNU Free Documentation License
    (http://www.gnu.org/copyleft/fdl.html). It is provided for educational purposes only and is NOT
    supported.
    Introduction
    This paper documents how to deploy PostgreSQL 8 and its associated JDBC driver in a basic but both
    resilient and IO efficient manner. Guidance for switching from Oracle to PostgreSQL is also provided.
    It is based upon experience with the following configurations =>
    PostgreSQL 8.0.2 on Solaris 10
    PostgreSQL JDBC driver on Windows 2000
    using the PostgreSQL distributions =>
    postgresql-base-8.0.2.tar.gz
    postgresql-8.0-311.jdbc3.jar
    � Chris Drawater, 2005
    PostgreSQL 8.0.2 on Solaris, v1.2
    p1/10
    Page 2
    Background for Oracle DBAs
    For DBAs coming from an Oracle background, PostgreSQL has a number of familiar concepts including
    Checkpoints
    Tablespaces
    MVCC concurrency model
    Write ahead log (WAL)+ PITR
    Background DB writer
    Statistics based optimizer
    Recovery = Backup + archived WALs + current WALs
    However , whereas 1 Oracle instance (set of processes) services 1 physical database, PostgreSQL differs in
    that
    1 PostgreSQL �cluster� services n * physical DBs
    1 cluster has tablespaces (accessible to all DBs)
    1 cluster = 1 PostgreSQL instance = set of server processes etc ( for all DBs) + 1 tuning config +
    1 WAL
    User accts are cluster wide by default
    There is no undo or BI file � so to support MVCC, the �consistent read� data is held in the tables
    themselves and once obsolete needs to be cleansed out using the �vacuum� utility.
    The basic PostgreSQL deployment guidelines for Oracle aware DBAs are to =>
    Create only 1 DB per cluster
    Have 1 superuser per cluster
    Let only the superuser create the database
    Have one user to create/own the DB objects + n* endusers with appropriate read/write access
    Use only ANSI SQL datatypes and DDL.
    Wherever possible avoid DB specific SQL extensions to ensure cross-database portability
    IO distribution & disc layouts
    It is far better to start out with good disc layouts rather than reto-fix for a production database.
    As with any DBMS, for resilience, the recovery components ( eg. backups , WAL, archived WAL logs)
    should kept on devices separate from the actual data.
    So the basic rules for resilience are as follows.
    For non disc array or JBOD systems =>
    keep recovery components separate from data on dedicated discs etc
    keep WAL and data on separate disc controllers
    mirror WAL across discs ( preferably across controllers) for protection against WAL spindle loss
    For SAN based disc arrays (eg HP XP12000) =>
    keep recovery components separate from data on dedicated LUNs etc
    use Host Adapter Multipathing drivers (such as mpxio) with 2 or more HBAs for access to SAN .
    Deploy application data on mirrored/striped (ie RAID 1+0) or write-cache fronted RAID 5 storage.
    The WAL log IO should be configured to be osync for resilience (see basic tuning in later section).
    Ensure that every PostgreSQL component on disc is resilient (duplexed) !
    Recovery can be very stressful�
    Moving onto IO performance, it is worth noting that WAL IO and general data IO access have different IO
    characteristics.
    � Chris Drawater, 2005
    PostgreSQL 8.0.2 on Solaris, v1.2
    p2/10
    Page 3
    WAL sequential access (write mostly)
    Data sequential scan, random access write/read
    The basic rules for good IO performance �.
    use tablespaces to distribute data and thus IO across spindles or disc array LUNs
    keep WAL on dedicated spindles/LUNs (mirror/stripe in preference to RAID 5)
    keep WAL and arch WAL on separate spindles to reduce IO on WAL spindles.
    RAID or stripe data across discs/LUNs in 1 Mb chunks/units if unsure as what chunk size to use.
    For manageability, keep the software distr and binaries separate from the database objects.
    Likewise, keep the system catalogs and non-application data separate from the application specific data.
    5 distinct storage requirements can be identified =>
    Software tree (Binaries, Source, distr)
    Shared PG sys data
    WAL logs
    Arch WAL logs
    Application data
    For the purposes of this document , the following minimal set of FS are suggested =>
    /opt/postgresql/8.0.2
    # default 4 Gb for software tree
    /var/opt/postgresql
    # default 100 Mb
    /var/opt/postgresql/CLUST/sys
    # default size 1Gb for shared sys data
    /var/opt/postgresql/CLUST/wal
    # WAL location # mirrored/striped
    /var/opt/postgresql/CLUST/archwal
    # archived WALs
    /var/opt/postgresql/CLUST/data
    # application data + DB sys catalogs # RAID 5
    where CLUST is your chosen name for the Postgres DB cluster
    For enhanced IO distribution , a number of �/data FS (eg data01, data02 etc) could be deployed.
    Pre-requisites !
    The GNU compiler and make software utilities (available on the Solaris 10 installation CDs) =>
    gcc (compiler) ( $ gcc --version => 3.4.3 )
    gmake (GNU make)
    are required and should be found in
    /usr/sfw/bin
    Create the Unix acct
    postgres
    in group dba
    with a home directory of say /export/home/postgresql
    using
    $ useradd utility
    or hack
    /etc/group then /etc/passwd then run pwconv and then passwd postgres
    Assuming the following FS have been created =>
    � Chris Drawater, 2005
    PostgreSQL 8.0.2 on Solaris, v1.2
    p3/10
    Page 4
    /opt/postgresql/8.0.2
    # default 4 Gb for the PostgreSQL software tree
    /var/opt/postgresql
    # default 100 Mb
    create directories
    /opt/postgresql/8.0.2/source
    # source code
    /opt/postgresql/8.0.2/distr
    # downloaded distribution
    all owned by user postgres:dba with 700 permissions
    To ensure, there are enough IPC resources to use PostgreSQL, edit /etc/system and add the following lines
    =>
    set shmsys:shminfo_shmmax=1300000000
    set shmsys:shminfo_shmmin=1
    set shmsys:shminfo_shmmni=200
    set shmsys:shminfo_shmseg=20
    set semsys:seminfo_semmns=800
    set semsys:seminfo_semmni=70
    set semsys:seminfo_semmsl=270 # defaults to 25
    set rlim_fd_cur=1024
    # per process file descriptor soft limit
    set rlim_fd_max=4096
    # per process file descriptor hard limit
    Thenn on the console (log in as root) =>
    $ init 0
    {a} ok boot -r
    Download Source
    Download the source codes from http://www.postgresql.org (and if downloaded via Windows, remember
    to ftp in binary mode) =>
    Distributions often available include =>
    postgresql-XXX.tar.gz => full source distribution.
    postgresql-base-XXX.tar.gz => Server and the essential client interfaces
    postgresql-opt-XXX.tar.gz => C++, JDBC, ODBC, Perl, Python, and Tcl interfaces, as well as multibyte
    support
    postgresql-docs-XXX.tar.gz => html docs
    postgresql-test-XXX.tar.gz => regression test
    For a working, basic PostgreSQL installation supporting JDBC applications, simply use the �base�
    distribution.
    Create Binaries
    Unpack Source =>
    $ cd /opt/postgresql/8.0.2/distr
    $ gunzip postgresql-base-8.0.2.tar.gz
    $ cd /opt/postgresql/8.0.2/source
    $ tar -xvof /opt/postgresql/8.0.2/distr/postgresql-base-8.0.2.tar
    � Chris Drawater, 2005
    PostgreSQL 8.0.2 on Solaris, v1.2
    p4/10
    Page 5
    Set Unix environment =>
    TMPDIR=/tmp
    PATH=/usr/bin:/usr/ucb:/etc:.:/usr/sfw/bin:usr/local/bin:n:/usr/ccs/bin:$PATH
    export PATH TMPDIR
    Configure the build options =>
    $ cd /opt/postgresql/8.0.2/source/postgresql-8.0.2
    $ ./configure prefix=/opt/postgresql/8.0.2 with-pgport=5432 --without-readline
    CC=/usr/sfw/bin/gcc
    Note => --enable-thread-safety option failed
    And build =>
    $ gmake
    $ gmake install
    On an Ultra 5 workstation, this gives 32 bit executables
    Setup Unix environment
    Add to environment =>
    LD_LIBRARY_PATH=/opt/postgresql/8.0.2/lib
    PATH=/opt/postgresql/8.0.2/bin:$PATH
    export PATH LD_LIBRARY_PATH
    Create Database(Catalog) Cluster
    Add to Unix environment =>
    PGDATA=/var/opt/postgresql/CLUST/sys
    # PG sys data , used by all DBs
    export PGDATA
    Assuming the following FS has been created =>
    /var/opt/postgresql/CLUST/sys
    # default size 1Gb
    where CLUST is your chosen name for the Postgres DB cluster,
    initialize database storage area, create shared catalogs and template database template1 =>
    $ initdb -E UNICODE -A password
    -W
    # DBs have default Unicode char set, user basic passwords, prompt for super user password
    Startup, Shutdown and basic tuning of servers
    Check servers start/shutdown =>
    $ pg_ctl start -l /tmp/logfile
    $ pg_ctl stop
    Next, tune the PostgreSQL instance by editing the configuration file $PGDATA/postgresql.conf .
    � Chris Drawater, 2005
    PostgreSQL 8.0.2 on Solaris, v1.2
    p5/10
    Page 6
    First take a safety copy =>
    $ cd $PGDATA
    $ cp postgresql.conf postgresql.conf.orig
    then make the following (or similar changes) to postgresql.conf =>
    # listener
    listen_addresses = 'localhost'
    port = 5432
    # data buffer cache
    shared_buffers = 10000
    # each 8Kb so depends upon memory available
    #checkpoints
    checkpoint_segments = 3
    # default
    checkpoint_timeout = 300
    # default
    checkpoint_warning = 30
    # default � logs warning if ckpt interval < 30s
    # log related
    fsync = true
    # resilience
    wal_sync_method = open_sync
    # resilience
    commit_delay = 10
    # group commit if works
    archive_command = 'cp "%p" /var/opt/postgresql/CLUST/archwal/"%f"'
    # server error log
    log_line_prefix = '%t :'
    # timestamp
    log_min_duration_statement = 1000
    # log any SQL taking more than 1000ms
    log_min_messages = info
    #transaction/locks
    default_transaction_isolation = 'read committed'
    Restart the servers =>
    $ pg_ctl start -l /tmp/logfile
    Create the Database
    This requires the FS =>
    /var/opt/postgresql/CLUST/wal
    # WAL location
    /var/opt/postgresql/CLUST/archwal
    # archived WALs
    /var/opt/postgresql/CLUST/data
    # application data + DB sys catalogs
    plus maybe also =>
    /var/opt/postgresql/CLUST/backup
    # optional for data and config files etc as staging
    area for tape
    Create the clusterwide tablespaces (in this example, a single tablespace named �appdata�) =>
    $ psql template1
    � Chris Drawater, 2005
    PostgreSQL 8.0.2 on Solaris, v1.2
    p6/10
    Page 7
    template1=# CREATE TABLESPACE appdata LOCATION '/var/opt/postgresql/CLUST/data';
    template1=# SELECT spcname FROM pg_tablespace;
    spcname
    pg_default
    pg_global
    appdata
    (3 rows)
    and add to the server config =>
    default_tablespace = 'appdata'
    Next, create the database itself (eg name = db9, unicode char set) =>
    $ createdb -D appdata -E UNICODE -e db9
    # appdata = default TABLESPACE
    $ createlang -d db9 plpgsql
    # install 'Oracle PL/SQL like' language
    WAL logs are stored in the directory pg_xlog under the data directory. Shut the server down & move the
    directory pg_xlog to /var/opt/postgresql/CLUST/wal and create a symbolic link from the original location in
    the main data directory to the new path.
    $ pg_ctl stop
    $ cd $PGDATA
    $ mv pg_xlog /var/opt/postgresql/CLUST/wal
    $ ls /var/opt/postgresql/CLUST/wal
    $ ln -s /var/opt/postgresql/CLUST/wal/pg_xlog $PGDATA/pg_xlog
    # soft link as across FS
    $ pg_ctl start -l /tmp/logfile
    Assuming all is now working OK, shutdown PostgreSQL & backup up all the PostgreSQL related FS
    above� just in case�!
    � Chris Drawater, 2005
    PostgreSQL 8.0.2 on Solaris, v1.2
    p7/10
    Page 8
    User Accounts
    Create 1 * power user to create/own/control the tables (using psql) =>
    $ pgsql template1
    create user cxd with password 'abc';
    grant create on tablespace appdata to cxd;
    Do not create any more superusers or users that can create databases!
    Now create n* enduser accts to work against the data =>
    $pgsql template1
    CREATE GROUP endusers;
    create user enduser1 with password 'xyz';
    ALTER GROUP endusers ADD USER enduser1;
    $ psql db9 cxd
    grant select. on <table>. to group endusers;
    JDBC driver
    A pure Java (Type 4) JDBC driver implementation can be downloaded from
    http://jdbc.postgresql.org/
    Assuming the use of the SDK 1.4 or 1.5, download
    postgresql-8.0-311.jdbc3.jar
    and include this in your application CLASSPATH.
    (If moving JAR files between different hardware types, always ftp in BIN mode).
    Configure PostgreSQL to accept JDBC Connections
    To allow the postmaster listener to accept TCP/IP connections from client nodes running the JDBC
    applications, edit the server configuration file and change
    listen_addresses = '*'
    # * = any IP interface
    Alternatively, this parameter can specify only selected IP interfaces ( see documentation).
    In addition, the client authetication file will need to edited to allow access to our database server.
    First take a backup of the file =>
    $ cp pg_hba.conf pg_hba.conf.orig
    Add the following line =>
    host db9
    cxd
    0.0.0.0/0
    password
    where , for this example, database db9, user cxd, auth password
    � Chris Drawater, 2005
    PostgreSQL 8.0.2 on Solaris, v1.2
    p8/10
    Page 9
    Switching JDBC applications from Oracle to PostgreSQL
    The URL used to connect to the PostgreSQL server should be of the form
    jdbc:postgresql://host:port/database
    If used, replace the line (used to load the JDBC driver)
    Class.forName ("oracle.jdbc.driver.OracleDriver");
    with
    Class.forName("org.postgresql.Driver");
    Remove any Oracle JDBC extensions, such as
    ((OracleConnection)con2).setDefaultRowPrefetch(50);
    Instead, the row pre-fetch must be specified at an individual Statement level =>
    eg.
    PreparedStatement pi = con1.prepareStatement(�select�.�);
    pi.setFetchSize(50);
    If not set, the default fetch size = 0;
    Likewise, any non ANSI SQL extensions will need changing.
    For example sequence numbers
    Oracle => online_id.nextval
    should be replaced by
    PostgreSQL => nextval('online_id')
    Oracle �hints� embedded within SQL statements are ignored by PostgreSQL.
    Now test your application!
    Concluding Remarks
    At this stage, you should now have a working PostgreSQL database fronted by a JDBC based application,
    and the foundations will have been laid for :
    A reasonably level of resilience (recoverability)
    A good starting IO distribution
    The next step is to tune the system under load� and that�s another doc�
    Chris Drawater has been working with RDBMSs since 1987 and the JDBC API since late 1996, and can
    be contacted at [email protected] or [email protected] .
    � Chris Drawater, 2005
    PostgreSQL 8.0.2 on Solaris, v1.2
    p9/10
    Page 10
    Appendix 1 � Example .profile
    TMPDIR=/tmp
    export TMPDIR
    PATH=/usr/bin:/usr/ucb:/etc:.:/usr/sfw/bin:usr/local/bin:n:/usr/ccs/bin:$PATH
    export PATH
    # PostgreSQL 802 runtime
    LD_LIBRARY_PATH=/opt/postgresql/8.0.2/lib
    PATH=/opt/postgresql/8.0.2/bin:$PATH
    export PATH LD_LIBRARY_PATH
    PGDATA=/var/opt/postgresql/CLUST/sys
    export PGDATA
    � Chris Drawater, 2005
    PostgreSQL 8.0.2 on Solaris, v1.2
    p10/10

  • J2EE with JDeveloper and postgresql

    Hi folks,
    I'm creating a j2ee app (struts) with jdev with oracle9i
    and this work fine...
    but I have try connect with another database
    (postgresql 7.4) to recovery some data
    and the local container of jdev is not recognizing
    the postgresql driver...
    where I do to make the internal container
    work with jdbc postgre driver ?

    To configure the the PostgreSQL JDBC driver:
    1. Select Tools>Preferences in JDeveloper.
    2. In the Preferences frame, select the Database Connections node. Select Library New button.
    3. Select the Registered JDBC Drivers field New button.
    4. In the Driver Class field specify org.postgresql.Driver
    5. Select Library field New button.
    6. In the Create Library frame specify a Library Name, and add the PostgreSQL JDBC jar file pg74.215.jdbc2.jar to the Class Path field.
    The PostgreSQL JDBC driver library gets added to the Preferences frame.

  • Datasource Postgresql problem

    Dear colleagues,
    We want to create a new Datasource in order to connect our Portal Application with a Postgresql DB.
    We had been creating Datasources with Oracle before and everything was ok , but with Postgresql we are
    experiencing some problems.
    Firstly, we created a new jdbc driver in visual administrator console.
    Secondly, we were trying to create a new datasource using the Postgresql driver but finished with error.
    I would appreciate if someone have a clue to solve our problem.
    Thanks in advance.
    Oscar
    This is a piece of error dump.
    java.rmi.RemoteException: com.sap.engine.services.dbpool.exceptions.BaseRemoteException: Error during start of application "sap.com/JDBCConnector_DS_POST.xml". [id = StartupError]
         at com.sap.engine.services.dbpool.deploy.DataSourceManagerImpl.startApplication(DataSourceManagerImpl.java:608)
         at com.sap.engine.services.dbpool.deploy.DataSourceManagerImpl.deploy(DataSourceManagerImpl.java:285)
         at com.sap.engine.services.dbpool.deploy.DataSourceManagerImpl.createDataSource(DataSourceManagerImpl.java:342)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at com.sap.pj.jmx.introspect.DefaultMBeanInvoker.invoke(DefaultMBeanInvoker.java:58)
         at com.sap.pj.jmx.mbeaninfo.AdditionalInfoProviderMBean.invoke(AdditionalInfoProviderMBean.java:289)
         at com.sap.pj.jmx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:944)
         at com.sap.pj.jmx.server.interceptor.MBeanServerWrapperInterceptor.invoke(MBeanServerWrapperInterceptor.java:288)
         at com.sap.engine.services.jmx.CompletionInterceptor.invoke(CompletionInterceptor.java:409)
         at com.sap.pj.jmx.server.interceptor.BasicMBeanServerInterceptor.invoke(BasicMBeanServerInterceptor.java:277)
         at com.sap.jmx.provider.ProviderInterceptor.invoke(ProviderInterceptor.java:258)
         at com.sap.engine.services.jmx.RedirectInterceptor.invoke(RedirectInterceptor.java:340)
         at com.sap.pj.jmx.server.interceptor.MBeanServerInterceptorChain.invoke(MBeanServerInterceptorChain.java:330)
         at com.sap.engine.services.jmx.MBeanServerSecurityWrapper.invoke(MBeanServerSecurityWrapper.java:287)
         at com.sap.engine.services.jmx.MBeanServerInvoker.invokeMbs(MBeanServerInvoker.java:131)
         at com.sap.engine.services.jmx.ClusterInterceptor.invokeMbs(ClusterInterceptor.java:212)
         at com.sap.engine.services.jmx.ClusterInterceptor.invoke(ClusterInterceptor.java:766)
         at com.sap.engine.services.jmx.MBeanServerInterceptorInvoker.invokeMbs(MBeanServerInterceptorInvoker.java:102)
         at com.sap.engine.services.jmx.connector.p4.P4ConnectorServerImpl.invokeMbs(P4ConnectorServerImpl.java:61)
         at com.sap.engine.services.jmx.connector.p4.P4ConnectorServerImplp4_Skel.dispatch(P4ConnectorServerImplp4_Skel.java:64)
         at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:319)
         at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:200)
         at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:136)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
         at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:104)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:176)
    Caused by: java.rmi.RemoteException: Error occurred while starting application in whole cluster and wait.; nested exception is:
         com.sap.engine.services.deploy.exceptions.ServerDeploymentException: Clusterwide exception: server ID 6280550:com.sap.engine.services.dbpool.exceptions.BaseDeploymentException: Cannot create DataSource "DS_POST".
         at com.sap.engine.services.dbpool.deploy.ContainerImpl.startDataSources(ContainerImpl.java:1843)
         at com.sap.engine.services.dbpool.deploy.ContainerImpl.prepareStart(ContainerImpl.java:489)
         at com.sap.engine.services.deploy.server.application.StartTransaction.prepareCommon(StartTransaction.java:223)
         at com.sap.engine.services.deploy.server.application.StartTransaction.prepare(StartTransaction.java:171)
         at com.sap.engine.services.deploy.server.application.ApplicationTransaction.makeAllPhasesOnOneServer(ApplicationTransaction.java:301)
         at com.sap.engine.services.deploy.server.application.ParallelAdapter.makeAllPhasesImpl(ParallelAdapter.java:342)
         at com.sap.engine.services.deploy.server.application.ParallelAdapter.runInTheSameThread(ParallelAdapter.java:126)
         at com.sap.engine.services.deploy.server.application.ParallelAdapter.makeAllPhasesAndWait(ParallelAdapter.java:245)
         at com.sap.engine.services.deploy.server.DeployServiceImpl.startApplicationAndWait(DeployServiceImpl.java:4712)
         at com.sap.engine.services.deploy.server.DeployCommunicatorImpl.startApplicationAndWait(DeployCommunicatorImpl.java:661)
         at com.sap.engine.services.deploy.server.DeployCommunicatorImpl.startApplicationAndWait(DeployCommunicatorImpl.java:645)
         at com.sap.engine.services.dbpool.deploy.DataSourceManagerImpl.startApplication(DataSourceManagerImpl.java:606)
         at com.sap.engine.services.dbpool.deploy.DataSourceManagerImpl.deploy(DataSourceManagerImpl.java:285)
         at com.sap.engine.services.dbpool.deploy.DataSourceManagerImpl.createDataSource(DataSourceManagerImpl.java:342)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at com.sap.pj.jmx.introspect.DefaultMBeanInvoker.invoke(DefaultMBeanInvoker.java:58)
         at com.sap.pj.jmx.mbeaninfo.AdditionalInfoProviderMBean.invoke(AdditionalInfoProviderMBean.java:289)
         at com.sap.pj.jmx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:944)
         at com.sap.pj.jmx.server.interceptor.MBeanServerWrapperInterceptor.invoke(MBeanServerWrapperInterceptor.java:288)
         at com.sap.engine.services.jmx.CompletionInterceptor.invoke(CompletionInterceptor.java:409)
         at com.sap.pj.jmx.server.interceptor.BasicMBeanServerInterceptor.invoke(BasicMBeanServerInterceptor.java:277)
         at com.sap.jmx.provider.ProviderInterceptor.invoke(ProviderInterceptor.java:258)
         at com.sap.engine.services.jmx.RedirectInterceptor.invoke(RedirectInterceptor.java:340)
         at com.sap.pj.jmx.server.interceptor.MBeanServerInterceptorChain.invoke(MBeanServerInterceptorChain.java:330)
         at com.sap.engine.services.jmx.MBeanServerSecurityWrapper.invoke(MBeanServerSecurityWrapper.java:287)
         at com.sap.engine.services.jmx.MBeanServerInvoker.invokeMbs(MBeanServerInvoker.java:131)
         at com.sap.engine.services.jmx.ClusterInterceptor.invokeMbs(ClusterInterceptor.java:212)
         at com.sap.engine.services.jmx.ClusterInterceptor.invoke(ClusterInterceptor.java:766)
         at com.sap.engine.services.jmx.MBeanServerInterceptorInvoker.invokeMbs(MBeanServerInterceptorInvoker.java:102)
         at com.sap.engine.services.jmx.connector.p4.P4ConnectorServerImpl.invokeMbs(P4ConnectorServerImpl.java:61)
         at com.sap.engine.services.jmx.connector.p4.P4ConnectorServerImplp4_Skel.dispatch(P4ConnectorServerImplp4_Skel.java:64)
         at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:319)
         at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:200)
         at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:136)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
         at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:104)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:176)
    Caused by: com.sap.engine.services.dbpool.exceptions.BaseInstantiationException: Cannot create instance ManagedConnectionFactoryImpl.
         at com.sap.engine.services.dbpool.spi.ManagedConnectionFactoryImpl.<init>(ManagedConnectionFactoryImpl.java:83)
         at com.sap.engine.services.dbpool.deploy.ContainerImpl.startDataSources(ContainerImpl.java:1779)
         ... 42 more
    Caused by: java.lang.ClassNotFoundException: postgresql.jdbc.driver.PostgresqlDriver
    Loader Info -
    ClassLoader name: [library:postgresql.jdbc.driver.PostgresqlDriver]
    Parent loader name: [Frame ClassLoader]
    No references !
    Resources:
       /usr/sap/EPD/JC00/j2ee/cluster/server0/bin/core_lib/opensqlport.jar
       /usr/sap/EPD/JC00/j2ee/cluster/server0/bin/ext/postgresql.jdbc.driver.PostgresqlDriver/postgresql-8.4-701.jdbc3.jar
    Loading model: {parent,local,references}
         at com.sap.engine.frame.core.load.ReferencedLoader.loadClass(ReferencedLoader.java:382)
         at com.sap.engine.services.dbpool.spi.ManagedConnectionFactoryImpl.<init>(ManagedConnectionFactoryImpl.java:74)
         ... 43 more
         at com.sap.engine.services.deploy.server.DeployCommunicatorImpl.startApplicationAndWait(DeployCommunicatorImpl.java:663)
         at com.sap.engine.services.deploy.server.DeployCommunicatorImpl.startApplicationAndWait(DeployCommunicatorImpl.java:645)
         at com.sap.engine.services.dbpool.deploy.DataSourceManagerImpl.startApplication(DataSourceManagerImpl.java:606)
         ... 31 more
    Caused by: com.sap.engine.services.deploy.exceptions.ServerDeploymentException: Clusterwide exception: server ID 6280550:com.sap.engine.services.dbpool.exceptions.BaseDeploymentException: Cannot create DataSource "DS_POST".
         at com.sap.engine.services.dbpool.deploy.ContainerImpl.startDataSources(ContainerImpl.java:1843)
         at com.sap.engine.services.dbpool.deploy.ContainerImpl.prepareStart(ContainerImpl.java:489)
         at com.sap.engine.services.deploy.server.application.StartTransaction.prepareCommon(StartTransaction.java:223)
         at com.sap.engine.services.deploy.server.application.StartTransaction.prepare(StartTransaction.java:171)

    Hi Oscar,
    Your problem seems to be:
    > Caused by: java.lang.ClassNotFoundException: postgresql.jdbc.driver.PostgresqlDriver
    There might be different JDBC drivers for PostgreSQL, but for the one I know (http://jdbc.postgresql.org/) the driver class is: org.postgresql.Driver
    Hope it helps
    Detlev

  • Newbie help on JDBC, please

    Hi,
    I am new to Java Programming,and JDBC. I have installed jdbc driver for Postgresql, and is working fine. I have the following code (which I can compile, but when I run I gets many lines of error messages):
    import java.io.*;
    import java.sql.*;
    import java.util.*;
    public class ContactInput {
    public static void main(String args[]) {
         int serial = 2;
         String name ="Patty Thapa";
         String email ="[email protected]";
         String homepage ="www.damars.net/~pat";
         String tel = "2334 2747";
         String add = "Hong kong";
         String url = "jdbc:postgresql:contacts";
         Connection con;
         PreparedStatement pprStmt;
         try {
         Class.forName("org.postgresql.Driver");
         } catch(java.lang.ClassNotFoundException e) {
                   System.err.print("ClassNotFoundException: ");
                   System.err.println(e.getMessage());
         try {
              con = DriverManager.getConnection(url,"damar", "");
              pprStmt=con.prepareStatement("INSERT INTO address(serial, name, email, homepage, telephone, postaladdress)"
              + "values(?,?,?,?,?,?)");
              pprStmt.clearParameters();
              pprStmt.setInt(1,serial);
              pprStmt.setString(2,name);
              pprStmt.setString(3,email);
              pprStmt.setString(4,homepage);
              pprStmt.setString(5,tel);
              pprStmt.setString(6,add);
              pprStmt.executeUpdate();
              pprStmt.close();
              con.close();
              } catch(SQLException ex) {
                   System.err.println("SQLException: " + ex.getMessage());
    Can any one please points me what I have done wrong here?
    Thanks
    Damar

    Hi,
    Further to my previous problem of PreparedStatement, I have the following code:
    import java.sql.*;
    import java.util.*;
    public class AddressDisp{
    public static void main(String[] args){
         try{
         Class.forName("org.postgresql.Driver");
         catch (ClassNotFoundException e){
         System.out.println("Unable to load Driver Class");
         return;
         try{
         Connection con = DriverManager.getConnection("jdbc:postgresql:contacts","damar","");
         Statement stmt=con.createStatement();
         ResultSet rs = stmt.executeQuery("Select name from address");
         while(rs.next()){
              System.out.print(rs.getString("name"));
              System.out.print(rs.getInt("ser"));
              System.out.print(", " +rs.getString("email"));
              System.out.print(", " + rs.getString("telephone"));
              System.out.println(", " + rs.getString("postaladdress"));
         rs.close();
         stmt.close();
         con.close();
         catch(SQLException se){
         System.out.println("SQL Exception : " + se.getMessage());
         se.printStackTrace(System.out);
    In address table, there is 6 fields namely, ser (int), name (char(20)), email (varchar(24)), homepage (varchar(25)), telephone (char(15)), postaladdress (varchar(30)). The above code works properly only with "System.out.print(rs.getString("name"))" ie I can get all names, but all other fields end up with following message:
    SQL Exception : The column name ser not found.
    The column name ser not found.
    at 0x4017224b: java.lang.Throwable.Throwable(java.lang.String) (/usr/lib/libgcj.so.2)
    at 0x4016885b: java.lang.Exception.Exception(java.lang.String) (/usr/lib/libgcj.so.2)
    at 0x401e0a40: java.sql.SQLException.SQLException(java.lang.String, java.lang.String, int) (/usr/lib/libgcj.so.2)
    at 0x401e09cb: java.sql.SQLException.SQLException() (/usr/lib/libgcj.so.2)
    at 0x4023925f: ffi_call_SYSV (/usr/lib/libgcj.so.2)
    at 0x40239227: ffi_raw_call (/usr/lib/libgcj.so.2)
    at 0x4014c8db: JvInterpMethod.continue1(_Jv_InterpMethodInvocation) (/usr/lib/libgcj.so.2)
    at 0x40150703: JvInterpMethod.run(ffi_cif, void, ffi_raw, JvInterpMethodInvocation) (/usr/lib/libgcj.so.2)
    at 0x4014c671: JvInterpMethod.run_normal(ffi_cif, void, ffi_raw, void) (/usr/lib/libgcj.so.2)
    at 0x40239114: ?? (??:0)
    at 0x4023925f: ffi_call_SYSV (/usr/lib/libgcj.so.2)
    at 0x40239227: ffi_raw_call (/usr/lib/libgcj.so.2)
    at 0x4014c8db: JvInterpMethod.continue1(_Jv_InterpMethodInvocation) (/usr/lib/libgcj.so.2)
    at 0x40150703: JvInterpMethod.run(ffi_cif, void, ffi_raw, JvInterpMethodInvocation) (/usr/lib/libgcj.so.2)
    at 0x4014c671: JvInterpMethod.run_normal(ffi_cif, void, ffi_raw, void) (/usr/lib/libgcj.so.2)
    at 0x40239114: ?? (??:0)
    at 0x4023925f: ffi_call_SYSV (/usr/lib/libgcj.so.2)
    at 0x40239227: ffi_raw_call (/usr/lib/libgcj.so.2)
    at 0x4014c8db: JvInterpMethod.continue1(_Jv_InterpMethodInvocation) (/usr/lib/libgcj.so.2)
    at 0x40150703: JvInterpMethod.run(ffi_cif, void, ffi_raw, JvInterpMethodInvocation) (/usr/lib/libgcj.so.2)
    at 0x4014c671: JvInterpMethod.run_normal(ffi_cif, void, ffi_raw, void) (/usr/lib/libgcj.so.2)
    at 0x40239114: ?? (??:0)
    at 0x4023925f: ffi_call_SYSV (/usr/lib/libgcj.so.2)
    at 0x40239227: ffi_raw_call (/usr/lib/libgcj.so.2)
    at 0x4014c8db: JvInterpMethod.continue1(_Jv_InterpMethodInvocation) (/usr/lib/libgcj.so.2)
    at 0x40150703: JvInterpMethod.run(ffi_cif, void, ffi_raw, JvInterpMethodInvocation) (/usr/lib/libgcj.so.2)
    at 0x4014c671: JvInterpMethod.run_normal(ffi_cif, void, ffi_raw, void) (/usr/lib/libgcj.so.2)
    at 0x40239114: ?? (??:0)
    at 0x4015365f: gnu.gcj.runtime.FirstThread.run() (/usr/lib/libgcj.so.2)
    at 0x4015db63: java.lang.Thread.run_(java.lang.Object) (/usr/lib/libgcj.so.2)
    at 0x402386a4: ?? (??:0)
    at 0x403def76: GC_start_routine (/usr/lib/libgcjgc.so.1)
    at 0x403f70ba: ?? (??:0)
    at 0x4050bd4a: __clone (/lib/libc.so.6)
    In "System.out.print(rs.getString("name"))", why only name field works, but others end up with column name not found error message? Is not name, or other fields are, the field/s in the database table? Is my system working?
    Any pointers would be highly appreciated.
    Damar

Maybe you are looking for