Thread: Urgent : JDBC problem in PostgreSql for Linux

Urgent : JDBC problem in PostgreSql for Linux

From
"Kallol Nandi"
Date:
Hi All,
 
This is my first post to this mailing list.
I am facing an error in JDBC.
The linux version I am working on is 8.0, postgresql version is 7.2.2 and the jar file I am using is postgresql.jar.
 
This is the code :

import java.sql.*;
import java.util.*;
import org.postgresql.Driver;
 
public class JDBCConnection
{
public static void main(String args[])
  {
try
     {
     String server ="10.100.102.31";
     String port ="5432";
     String database="notes";
     String url="jdbc:postgresql://"+server+":"+port+"/"+database;
     String userid="postgres";
     String password="postgres";
     Class.forName("org.postgresql.Driver").newInstance();
     //Driver d = (org.postgresql.Driver)(DriverManager.getDriver(url));
     //DriverManager.registerDriver(d);
     Enumeration enum = DriverManager.getDrivers();
     while (enum.hasMoreElements())
     {
        System.out.println("Has Driver");
        System.out.println(enum.nextElement().toString());
     }
 
     System.out.println("Successful 1 ! ");
     java.sql.Connection con=DriverManager.getConnection(url,userid,password);
     java.sql.Statement stmt = con.createStatement();
     java.sql.ResultSet rset = stmt.executeQuery ("Select count(*) as c from testtable");
     rset.next();
     int currval = rset.getInt("c");
 
     System.out.println("Successful 2 ! ");
     System.out.println(currval);
     con.close();
     }
     catch(Exception ex) {
     System.out.println("Error problem!");
     System.out.println(ex.getMessage());
     ex.printStackTrace();
     return;
   }
 }
}
 
Here is the error :
 

Has Driver
org.postgresql.Driver@8071ea0
Successful 1 !
Error problem!
Driver not found for URL: jdbc:postgresql://10.100.102.31:5432/notes
java.sql.SQLException: Driver not found for URL:
jdbc:postgresql://10.100.102.31:5432/notes
   at 0x4028115f: java.lang.Throwable.Throwable(java.lang.String)(/usr/lib/libgcj.so.3)
   at 0x402740d2: java.lang.Exception.Exception(java.lang.String)(/usr/lib/libgcj.so.3)
   at 0x40316294: java.sql.SQLException.SQLException(java.lang.String,java.lang.String, int) (/usr/lib/libgcj.so.3)
   at 0x40316244: java.sql.SQLException.SQLException(java.lang.String)(/usr/lib/libgcj.so.3)
   at 0x40316102: java.sql.DriverManager.getConnection(java.lang.String,java.util.Properties) (/usr/lib/libgcj.so.3)
   at 0x4031603a: java.sql.DriverManager.getConnection(java.lang.String,java.lang.String, java.lang.String) (/usr/lib/libgcj.so.3)
   at 0x4039d347: ffi_call_SYSV (/usr/lib/libgcj.so.3)   at 0x4039d307: ffi_raw_call (/usr/lib/libgcj.so.3)
   at 0x40248528: _Jv_InterpMethod.continue1(_Jv_InterpMethodInvocation)(/usr/lib/libgcj.so.3)
   at 0x40248e34: _Jv_InterpMethod.run(ffi_cif, void, ffi_raw,_Jv_InterpMethodInvocation) (/usr/lib/libgcj.so.3)
   at 0x40246424: _Jv_InterpMethod.run_normal(ffi_cif, void, ffi_raw, void)(/usr/lib/libgcj.so.3)
   at 0x4039d1bc: ?? (??:0)   at 0x4025b308: gnu.gcj.runtime.FirstThread.call_main()(/usr/lib/libgcj.so.3)
   at 0x402c60b1: gnu.gcj.runtime.FirstThread.run() (/usr/lib/libgcj.so.3)
   at 0x40267fdc: _Jv_ThreadRun(java.lang.Thread) (/usr/lib/libgcj.so.3)
   at 0x4023478c: _Jv_RunMain(java.lang.Class, byte const, int, byte const,boolean) (/usr/lib/libgcj.so.3)
   at 0x08048900: ?? (??:0)
   at 0x420158d4: ?? (??:0)
   at 0x080486c1: ?? (??:0)
 

If I uncomment the following lines
     //Driver d = (org.postgresql.Driver)(DriverManager.getDriver(url));
     //DriverManager.registerDriver(d);
and run the application I get null pointer exception as DriverManager.getDriver(url) does not get a driver for the corresponding Url.
 
This is the error :
Error problem!
null
java.lang.NullPointerException
   at 0x4028112c: java.lang.Throwable.Throwable() (/usr/lib/libgcj.so.3)
   at 0x402740af: java.lang.Exception.Exception() (/usr/lib/libgcj.so.3)
   at 0x402779b3: java.lang.RuntimeException.RuntimeException() (/usr/lib/libgcj.so.3)
   at 0x402770a7: java.lang.NullPointerException.NullPointerException() (/usr/lib/libgcj.so.3)
   at 0x40233547: _Jv_ThrowNullPointerException (/usr/lib/libgcj.so.3)
   at 0x40315eb4: java.sql.DriverManager.getDriver(java.lang.String) (/usr/lib/libgcj.so.3)
   at 0x4039d347: ffi_call_SYSV (/usr/lib/libgcj.so.3)
   at 0x4039d307: ffi_raw_call (/usr/lib/libgcj.so.3)
   at 0x40248528: _Jv_InterpMethod.continue1(_Jv_InterpMethodInvocation) (/usr/lib/libgcj.so.3)
   at 0x40248e34: _Jv_InterpMethod.run(ffi_cif, void, ffi_raw, _Jv_InterpMethodInvocation) (/usr/lib/libgcj.so.3)
   at 0x40246424: _Jv_InterpMethod.run_normal(ffi_cif, void, ffi_raw, void) (/usr/lib/libgcj.so.3)
   at 0x4039d1bc: ?? (??:0)
   at 0x4025b308: gnu.gcj.runtime.FirstThread.call_main() (/usr/lib/libgcj.so.3)
   at 0x402c60b1: gnu.gcj.runtime.FirstThread.run() (/usr/lib/libgcj.so.3)
   at 0x40267fdc: _Jv_ThreadRun(java.lang.Thread) (/usr/lib/libgcj.so.3)
   at 0x4023478c: _Jv_RunMain(java.lang.Class, byte const, int, byte const, boolean) (/usr/lib/libgcj.so.3)
   at 0x08048900: ?? (??:0)
   at 0x420158d4: ?? (??:0)
   at 0x080486c1: ?? (??:0)
 

But DriverManager.getDrivers() works fine and also returns the available postgresql driver which I want i.e. org.postgresql.Driver@8071ea0 
Is there any problem with the url format that I am passing?
Please do reply me asap.
Thanks and Regards,
Kallol Nandi,
Systems Analyst,
Indus Software - A Division of R Systems International Ltd.,
Tidel Park, Taramani, Chennai-600113, India.
Phone: +91-44-22540014/6 Extn: 209
Fax: +91-44-22540017
Email: Kallol.Nandi@indussoft.com
Visit us @ http://www.indussoft.com/

"The information in this email is confidential, and intended solely for the addressee. Access to this email by anyone else is unauthorized. If you are the addressee, the contents of this email are intended for your use only and it must not be forwarded to any third party, without first obtaining written authorization from the originator, or Indus Software. It may contain information, which is confidential and legally privileged, and the same shall not be used, or dealt with, by any third party, in any manner whatsoever, without the specific consent of Indus Software.

The opinions expressed are those of the sender, and do not necessarily reflect those of the Indus Software."

Re: Urgent : JDBC problem in PostgreSql for Linux

From
Thomas Kellerer
Date:
Instead of posting this again you should really try to use Sun's JDK first!

Kallol Nandi schrieb:
>
> Hi All,
>
> This is my first post to this mailing list.
> I am facing an error in JDBC.
> The linux version I am working on is 8.0, postgresql version is 7.2.2
> and the jar file I am using is postgresql.jar.
> **
> *This is the code :*
> **********
> import java.sql.*;
> import java.util.*;
> import org.postgresql.Driver;
>
> [...]


Re: Urgent : JDBC problem in PostgreSql for Linux

From
"Kallol Nandi"
Date:
I am using jdk1.4.1 provided by blackdown.
It was strongly recommended to me by one of the members of the mailing list.
Can you send me the exact link of the sun jdk you are using.

Thanks and Regards,
Kallol.

-----Original Message-----
From: pgsql-jdbc-owner@postgresql.org
[mailto:pgsql-jdbc-owner@postgresql.org]On Behalf Of Thomas Kellerer
Sent: Saturday, June 21, 2003 6:09 PM
To: pgsql-jdbc@postgresql.org
Subject: Re: [JDBC] Urgent : JDBC problem in PostgreSql for Linux


Instead of posting this again you should really try to use Sun's JDK first!

Kallol Nandi schrieb:
>
> Hi All,
>
> This is my first post to this mailing list.
> I am facing an error in JDBC.
> The linux version I am working on is 8.0, postgresql version is 7.2.2
> and the jar file I am using is postgresql.jar.
> **
> *This is the code :*
> **********
> import java.sql.*;
> import java.util.*;
> import org.postgresql.Driver;
>
> [...]



---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
      joining column's datatypes do not match


Re: Urgent : JDBC problem in PostgreSql for Linux

From
"Rodrigo F. Baroni"
Date:
 --- Kallol Nandi <kallol.nandi@indussoft.com>
escreveu: > Hi All,
>
> This is my first post to this mailing list.
> I am facing an error in JDBC.

<cut>

> Driver not found for URL:
> jdbc:postgresql://10.100.102.31:5432/notes
> java.sql.SQLException: Driver not found for URL:
> jdbc:postgresql://10.100.102.31:5432/notes
>    at 0x4028115f:

<cut>


     Seems that the JVM isn't finding your jar class
driver. Set your CLASSPATH variable at the enviroment
:

    "$export
CLASSPATH=/path/to/you/driver/driver_jdbc_postgres_.jar:."


    Try to run your app again. I have had some like
problem, that I resolve of another way : my app is a
applet, so, I put my app.jar and driver_jdbc.jar at
the html file, so it worked.

    Back this message again, when you resolve your
problem, saying what it was.


 Regards
Rodrigo F Baroni


_______________________________________________________________________
Yahoo! Mail
Mais espaço, mais segurança e gratuito: caixa postal de 6MB, antivírus, proteção contra spam.
http://br.mail.yahoo.com/

Re: Urgent : JDBC problem in PostgreSql for Linux

From
Fernando Nasser
Date:
Hi Kallol,

You may have set your JAVA_HOME variable to point to the Sun Java 1.4.1
but you forgot to add the Java bin directory to the front of your PATH.
  As a result you are getting the GNU java instead.

Try

which java

When you get something like:
/usr/java/j2sdk1.4.1_02/bin/javac

things will go much better.

Good luck,
Fernando


Kallol Nandi wrote:
> Hi All,
>
> This is my first post to this mailing list.
> I am facing an error in JDBC.
> The linux version I am working on is 8.0, postgresql version is 7.2.2
> and the jar file I am using is postgresql.jar.
> **
> *This is the code :*
> **********
> import java.sql.*;
> import java.util.*;
> import org.postgresql.Driver;
>
> public class JDBCConnection
> {
> public static void main(String args[])
>   {
> try
>      {
>      String server ="10.100.102.31";
>      String port ="5432";
>      String database="notes";
>      String url="jdbc:postgresql://"+server+":"+port+"/"+database;
>      String userid="postgres";
>      String password="postgres";
>      Class.forName("org.postgresql.Driver").newInstance();
>      //Driver d = (org.postgresql.Driver)(DriverManager.getDriver(url));
>      //DriverManager.registerDriver(d);
>      Enumeration enum = DriverManager.getDrivers();
>      while (enum.hasMoreElements())
>      {
>         System.out.println("Has Driver");
>         System.out.println(enum.nextElement().toString());
>      }
>
>      System.out.println("Successful 1 ! ");
>      java.sql.Connection
> con=DriverManager.getConnection(url,userid,password);
>      java.sql.Statement stmt = con.createStatement();
>      java.sql.ResultSet rset = stmt.executeQuery ("Select count(*) as c
> from testtable");
>      rset.next();
>      int currval = rset.getInt("c");
>
>      System.out.println("Successful 2 ! ");
>      System.out.println(currval);
>      con.close();
>      }
>      catch(Exception ex) {
>      System.out.println("Error problem!");
>      System.out.println(ex.getMessage());
>      ex.printStackTrace();
>      return;
>    }
>  }
> }
>
> *Here is the error :*
>
>
> Has Driver
> org.postgresql.Driver@8071ea0 <mailto:org.postgresql.Driver@8071ea0>
> Successful 1 !
> Error problem!
> Driver not found for URL: jdbc:postgresql://10.100.102.31:5432/notes
> java.sql.SQLException: Driver not found for URL:
> jdbc:postgresql://10.100.102.31:5432/notes
>    at 0x4028115f:
> java.lang.Throwable.Throwable(java.lang.String)(/usr/lib/libgcj.so.3)
>    at 0x402740d2:
> java.lang.Exception.Exception(java.lang.String)(/usr/lib/libgcj.so.3)
>    at 0x40316294:
> java.sql.SQLException.SQLException(java.lang.String,java.lang.String,
> int) (/usr/lib/libgcj.so.3)
>    at 0x40316244:
> java.sql.SQLException.SQLException(java.lang.String)(/usr/lib/libgcj.so.3)
>    at 0x40316102:
> java.sql.DriverManager.getConnection(java.lang.String,java.util.Properties)
> (/usr/lib/libgcj.so.3)
>    at 0x4031603a:
> java.sql.DriverManager.getConnection(java.lang.String,java.lang.String,
> java.lang.String) (/usr/lib/libgcj.so.3)
>    at 0x4039d347: ffi_call_SYSV (/usr/lib/libgcj.so.3)   at 0x4039d307:
> ffi_raw_call (/usr/lib/libgcj.so.3)
>    at 0x40248528:
> _Jv_InterpMethod.continue1(_Jv_InterpMethodInvocation)(/usr/lib/libgcj.so.3)
>    at 0x40248e34: _Jv_InterpMethod.run(ffi_cif, void,
> ffi_raw,_Jv_InterpMethodInvocation) (/usr/lib/libgcj.so.3)
>    at 0x40246424: _Jv_InterpMethod.run_normal(ffi_cif, void, ffi_raw,
> void)(/usr/lib/libgcj.so.3)
>    at 0x4039d1bc: ?? (??:0)   at 0x4025b308:
> gnu.gcj.runtime.FirstThread.call_main()(/usr/lib/libgcj.so.3)
>    at 0x402c60b1: gnu.gcj.runtime.FirstThread.run() (/usr/lib/libgcj.so.3)
>    at 0x40267fdc: _Jv_ThreadRun(java.lang.Thread) (/usr/lib/libgcj.so.3)
>    at 0x4023478c: _Jv_RunMain(java.lang.Class, byte const, int, byte
> const,boolean) (/usr/lib/libgcj.so.3)
>    at 0x08048900: ?? (??:0)
>    at 0x420158d4: ?? (??:0)
>    at 0x080486c1: ?? (??:0)
>
>
> If I uncomment the following lines
>      //Driver d = (org.postgresql.Driver)(DriverManager.getDriver(url));
>      //DriverManager.registerDriver(d);
> and run the application I get null pointer exception as
> DriverManager.getDriver(url) does not get a driver for the corresponding
> Url.
>
> *This is the error :*
> Error problem!
> null
> java.lang.NullPointerException
>    at 0x4028112c: java.lang.Throwable.Throwable() (/usr/lib/libgcj.so.3)
>    at 0x402740af: java.lang.Exception.Exception() (/usr/lib/libgcj.so.3)
>    at 0x402779b3: java.lang.RuntimeException.RuntimeException()
> (/usr/lib/libgcj.so.3)
>    at 0x402770a7: java.lang.NullPointerException.NullPointerException()
> (/usr/lib/libgcj.so.3)
>    at 0x40233547: _Jv_ThrowNullPointerException (/usr/lib/libgcj.so.3)
>    at 0x40315eb4: java.sql.DriverManager.getDriver(java.lang.String)
> (/usr/lib/libgcj.so.3)
>    at 0x4039d347: ffi_call_SYSV (/usr/lib/libgcj.so.3)
>    at 0x4039d307: ffi_raw_call (/usr/lib/libgcj.so.3)
>    at 0x40248528: _Jv_InterpMethod.continue1(_Jv_InterpMethodInvocation)
> (/usr/lib/libgcj.so.3)
>    at 0x40248e34: _Jv_InterpMethod.run(ffi_cif, void, ffi_raw,
> _Jv_InterpMethodInvocation) (/usr/lib/libgcj.so.3)
>    at 0x40246424: _Jv_InterpMethod.run_normal(ffi_cif, void, ffi_raw,
> void) (/usr/lib/libgcj.so.3)
>    at 0x4039d1bc: ?? (??:0)
>    at 0x4025b308: gnu.gcj.runtime.FirstThread.call_main()
> (/usr/lib/libgcj.so.3)
>    at 0x402c60b1: gnu.gcj.runtime.FirstThread.run() (/usr/lib/libgcj.so.3)
>    at 0x40267fdc: _Jv_ThreadRun(java.lang.Thread) (/usr/lib/libgcj.so.3)
>    at 0x4023478c: _Jv_RunMain(java.lang.Class, byte const, int, byte
> const, boolean) (/usr/lib/libgcj.so.3)
>    at 0x08048900: ?? (??:0)
>    at 0x420158d4: ?? (??:0)
>    at 0x080486c1: ?? (??:0)
>
>
> But DriverManager.getDrivers() works fine and also returns the available
> postgresql driver which I want i.e. org.postgresql.Driver@8071ea0
> <mailto:org.postgresql.Driver@8071ea0>
> Is there any problem with the url format that I am passing?
> Please do reply me asap.
> Thanks and Regards,
> *Kallol Nandi,*
> *Systems Analyst,*
> *Indus Software - A Division of R Systems International Ltd.,*
> *Tidel Park, Taramani, Chennai-600113, India**.*
> *Phone**: +91-44-22540014/6 Extn: 209
> **Fax**: +91-44-22540017**
> **Email**:** Kallol.Nandi@indussoft.com
> <http://uk.f200.mail.yahoo.com/ym/Compose?To=Kallol.Nandi@indussoft.com>**
> **Visit us @** http://www.indussoft.com/*
>
> "The information in this email is confidential, and intended solely for
> the addressee. Access to this email by anyone else is unauthorized. If
> you are the addressee, the contents of this email are intended for your
> use only and it must not be forwarded to any third party, without first
> obtaining written authorization from the originator, or Indus Software.
> It may contain information, which is confidential and legally
> privileged, and the same shall not be used, or dealt with, by any third
> party, in any manner whatsoever, without the specific consent of Indus
> Software.
>
> The opinions expressed are those of the sender, and do not necessarily
> reflect those of the Indus Software."
>


--
Fernando Nasser
Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9


Re: Urgent : JDBC problem in PostgreSql for Linux

From
Thomas Kellerer
Date:
Kallol Nandi schrieb:
> I am using jdk1.4.1 provided by blackdown.
> It was strongly recommended to me by one of the members of the mailing list.
> Can you send me the exact link of the sun jdk you are using.
>
> Thanks and Regards,
> Kallol.
>
I don't know about blackdown, but we are using the JDK provided by Sun here:

http://java.sun.com/j2se/1.4.1/download.html

in a 24/7 app with Postgres and never had a problem.

There sure is something wrong with the way you start your program.
Fernandos reply seems to be pointing into the correct direction. If you are
using Blackdown's JDK, why do you get the GNU stuff in the exception?

Thomas


Re: Urgent : JDBC problem in PostgreSql for Linux

From
"Kallol Nandi"
Date:
It is working fine.Thanks for all the suggestions.
As Fernando said the problem was with the PATH variable.
It was referring to the GNU jdk not to the Blackdown jdk.
The reason being the path of blackdown jdk was in the variable after the
path of the GNU one.

Now I have another problem.
I am running the same JDBCConnection program from Lotus Domino Server
installed on Linux to connect to Postgresql in Linux.
But I am getting the following runtime error.
The code is included in a JAVA agent which is called on the click of a
button.

****************************************************************************
**********************************************
The postgresql.jar file does not contain the correct JDBC classes for this
JVM. Try rebuilding. If that fails, try forcing the version supplying it to
the command line using the argument -Djava.version=1.1 or -Djava.version=1.

****************************************************************************
**********************************************

Linux version is - 8.0
Postgresql version is - 7.2.2
Domino Server version(Linux) is - 5.0.10

What is the procedure for rebuilding the jar file?

Thanks and Regards,
Kallol.

-----Original Message-----
From: Fernando Nasser [mailto:fnasser@redhat.com]
Sent: Sunday, June 22, 2003 4:40 AM
To: Kallol Nandi
Cc: pgsql-jdbc@postgresql.org
Subject: Re: [JDBC] Urgent : JDBC problem in PostgreSql for Linux


Hi Kallol,

You may have set your JAVA_HOME variable to point to the Sun Java 1.4.1
but you forgot to add the Java bin directory to the front of your PATH.
  As a result you are getting the GNU java instead.

Try

which java

When you get something like:
/usr/java/j2sdk1.4.1_02/bin/javac

things will go much better.

Good luck,
Fernando


Kallol Nandi wrote:
> Hi All,
>
> This is my first post to this mailing list.
> I am facing an error in JDBC.
> The linux version I am working on is 8.0, postgresql version is 7.2.2
> and the jar file I am using is postgresql.jar.
> **
> *This is the code :*
> **********
> import java.sql.*;
> import java.util.*;
> import org.postgresql.Driver;
>
> public class JDBCConnection
> {
> public static void main(String args[])
>   {
> try
>      {
>      String server ="10.100.102.31";
>      String port ="5432";
>      String database="notes";
>      String url="jdbc:postgresql://"+server+":"+port+"/"+database;
>      String userid="postgres";
>      String password="postgres";
>      Class.forName("org.postgresql.Driver").newInstance();
>      //Driver d = (org.postgresql.Driver)(DriverManager.getDriver(url));
>      //DriverManager.registerDriver(d);
>      Enumeration enum = DriverManager.getDrivers();
>      while (enum.hasMoreElements())
>      {
>         System.out.println("Has Driver");
>         System.out.println(enum.nextElement().toString());
>      }
>
>      System.out.println("Successful 1 ! ");
>      java.sql.Connection
> con=DriverManager.getConnection(url,userid,password);
>      java.sql.Statement stmt = con.createStatement();
>      java.sql.ResultSet rset = stmt.executeQuery ("Select count(*) as c
> from testtable");
>      rset.next();
>      int currval = rset.getInt("c");
>
>      System.out.println("Successful 2 ! ");
>      System.out.println(currval);
>      con.close();
>      }
>      catch(Exception ex) {
>      System.out.println("Error problem!");
>      System.out.println(ex.getMessage());
>      ex.printStackTrace();
>      return;
>    }
>  }
> }
>
> *Here is the error :*
>
>
> Has Driver
> org.postgresql.Driver@8071ea0 <mailto:org.postgresql.Driver@8071ea0>
> Successful 1 !
> Error problem!
> Driver not found for URL: jdbc:postgresql://10.100.102.31:5432/notes
> java.sql.SQLException: Driver not found for URL:
> jdbc:postgresql://10.100.102.31:5432/notes
>    at 0x4028115f:
> java.lang.Throwable.Throwable(java.lang.String)(/usr/lib/libgcj.so.3)
>    at 0x402740d2:
> java.lang.Exception.Exception(java.lang.String)(/usr/lib/libgcj.so.3)
>    at 0x40316294:
> java.sql.SQLException.SQLException(java.lang.String,java.lang.String,
> int) (/usr/lib/libgcj.so.3)
>    at 0x40316244:
> java.sql.SQLException.SQLException(java.lang.String)(/usr/lib/libgcj.so.3)
>    at 0x40316102:
>
java.sql.DriverManager.getConnection(java.lang.String,java.util.Properties)
> (/usr/lib/libgcj.so.3)
>    at 0x4031603a:
> java.sql.DriverManager.getConnection(java.lang.String,java.lang.String,
> java.lang.String) (/usr/lib/libgcj.so.3)
>    at 0x4039d347: ffi_call_SYSV (/usr/lib/libgcj.so.3)   at 0x4039d307:
> ffi_raw_call (/usr/lib/libgcj.so.3)
>    at 0x40248528:
>
_Jv_InterpMethod.continue1(_Jv_InterpMethodInvocation)(/usr/lib/libgcj.so.3)
>    at 0x40248e34: _Jv_InterpMethod.run(ffi_cif, void,
> ffi_raw,_Jv_InterpMethodInvocation) (/usr/lib/libgcj.so.3)
>    at 0x40246424: _Jv_InterpMethod.run_normal(ffi_cif, void, ffi_raw,
> void)(/usr/lib/libgcj.so.3)
>    at 0x4039d1bc: ?? (??:0)   at 0x4025b308:
> gnu.gcj.runtime.FirstThread.call_main()(/usr/lib/libgcj.so.3)
>    at 0x402c60b1: gnu.gcj.runtime.FirstThread.run() (/usr/lib/libgcj.so.3)
>    at 0x40267fdc: _Jv_ThreadRun(java.lang.Thread) (/usr/lib/libgcj.so.3)
>    at 0x4023478c: _Jv_RunMain(java.lang.Class, byte const, int, byte
> const,boolean) (/usr/lib/libgcj.so.3)
>    at 0x08048900: ?? (??:0)
>    at 0x420158d4: ?? (??:0)
>    at 0x080486c1: ?? (??:0)
>
>
> If I uncomment the following lines
>      //Driver d = (org.postgresql.Driver)(DriverManager.getDriver(url));
>      //DriverManager.registerDriver(d);
> and run the application I get null pointer exception as
> DriverManager.getDriver(url) does not get a driver for the corresponding
> Url.
>
> *This is the error :*
> Error problem!
> null
> java.lang.NullPointerException
>    at 0x4028112c: java.lang.Throwable.Throwable() (/usr/lib/libgcj.so.3)
>    at 0x402740af: java.lang.Exception.Exception() (/usr/lib/libgcj.so.3)
>    at 0x402779b3: java.lang.RuntimeException.RuntimeException()
> (/usr/lib/libgcj.so.3)
>    at 0x402770a7: java.lang.NullPointerException.NullPointerException()
> (/usr/lib/libgcj.so.3)
>    at 0x40233547: _Jv_ThrowNullPointerException (/usr/lib/libgcj.so.3)
>    at 0x40315eb4: java.sql.DriverManager.getDriver(java.lang.String)
> (/usr/lib/libgcj.so.3)
>    at 0x4039d347: ffi_call_SYSV (/usr/lib/libgcj.so.3)
>    at 0x4039d307: ffi_raw_call (/usr/lib/libgcj.so.3)
>    at 0x40248528: _Jv_InterpMethod.continue1(_Jv_InterpMethodInvocation)
> (/usr/lib/libgcj.so.3)
>    at 0x40248e34: _Jv_InterpMethod.run(ffi_cif, void, ffi_raw,
> _Jv_InterpMethodInvocation) (/usr/lib/libgcj.so.3)
>    at 0x40246424: _Jv_InterpMethod.run_normal(ffi_cif, void, ffi_raw,
> void) (/usr/lib/libgcj.so.3)
>    at 0x4039d1bc: ?? (??:0)
>    at 0x4025b308: gnu.gcj.runtime.FirstThread.call_main()
> (/usr/lib/libgcj.so.3)
>    at 0x402c60b1: gnu.gcj.runtime.FirstThread.run() (/usr/lib/libgcj.so.3)
>    at 0x40267fdc: _Jv_ThreadRun(java.lang.Thread) (/usr/lib/libgcj.so.3)
>    at 0x4023478c: _Jv_RunMain(java.lang.Class, byte const, int, byte
> const, boolean) (/usr/lib/libgcj.so.3)
>    at 0x08048900: ?? (??:0)
>    at 0x420158d4: ?? (??:0)
>    at 0x080486c1: ?? (??:0)
>
>
> But DriverManager.getDrivers() works fine and also returns the available
> postgresql driver which I want i.e. org.postgresql.Driver@8071ea0
> <mailto:org.postgresql.Driver@8071ea0>
> Is there any problem with the url format that I am passing?
> Please do reply me asap.
> Thanks and Regards,
> *Kallol Nandi,*
> *Systems Analyst,*
> *Indus Software - A Division of R Systems International Ltd.,*
> *Tidel Park, Taramani, Chennai-600113, India**.*
> *Phone**: +91-44-22540014/6 Extn: 209
> **Fax**: +91-44-22540017**
> **Email**:** Kallol.Nandi@indussoft.com
> <http://uk.f200.mail.yahoo.com/ym/Compose?To=Kallol.Nandi@indussoft.com>**
> **Visit us @** http://www.indussoft.com/*
>
> "The information in this email is confidential, and intended solely for
> the addressee. Access to this email by anyone else is unauthorized. If
> you are the addressee, the contents of this email are intended for your
> use only and it must not be forwarded to any third party, without first
> obtaining written authorization from the originator, or Indus Software.
> It may contain information, which is confidential and legally
> privileged, and the same shall not be used, or dealt with, by any third
> party, in any manner whatsoever, without the specific consent of Indus
> Software.
>
> The opinions expressed are those of the sender, and do not necessarily
> reflect those of the Indus Software."
>


--
Fernando Nasser
Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9


Re: Urgent : JDBC problem in PostgreSql for Linux

From
Fernando Nasser
Date:
Kallol Nandi wrote:
>
> Now I have another problem.
> I am running the same JDBCConnection program from Lotus Domino Server
> installed on Linux to connect to Postgresql in Linux.
> But I am getting the following runtime error.
> The code is included in a JAVA agent which is called on the click of a
> button.
>
> ****************************************************************************
> **********************************************
> The postgresql.jar file does not contain the correct JDBC classes for this
> JVM. Try rebuilding. If that fails, try forcing the version supplying it to
> the command line using the argument -Djava.version=1.1 or -Djava.version=1.
>
> ****************************************************************************
> **********************************************
>
 > Linux version is - 8.0
 > Postgresql version is - 7.2.2
 > Domino Server version(Linux) is - 5.0.10
 >
 > What is the procedure for rebuilding the jar file?
 >


Maybe Domino is using yet another JVM, perhaps came packed with the product?

If this is so, note that IBM until very recently only had a 1.3.1 JVM,
which means you should be using the JDBC2 driver, not the JDBC3 one
(which seems to require 1.4 Java).

You can build a JDBC2 driver by installing a 1.3.1 Java SDK (yes, you
can have several JVMs installed), set your JAVA_HOME and PATH and build
(you'll have to configure the whole pgsql tree).  Don't forget to make
sure no other version of the driver is anywhere in your CLASSPATH, in
the JVM jre/lib/ext directory etc.

There is a pg73jdbc2.jar at

http://jdbc.postgresql.org/download.html

If that doesn't work because Domino uses some javax.sql stuff, then try
the pg73jdbc2ee.jar one (right below the above).


Regards,
Fernando



--
Fernando Nasser
Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9


Re: Urgent : JDBC problem in PostgreSql for Linux

From
"Kallol Nandi"
Date:
Ya Fernando it worked.
Putting the jar file compatible with Java 1.1 solved the problem.

Thanks All,
Kallol.

-----Original Message-----
From: Fernando Nasser [mailto:fnasser@redhat.com]
Sent: Tuesday, June 24, 2003 6:08 PM
Cc: Kallol Nandi
Subject: Re: [JDBC] Urgent : JDBC problem in PostgreSql for Linux


Did it work?

Fernando Nasser wrote:
> Kallol Nandi wrote:
>
>>
>> Now I have another problem.
>> I am running the same JDBCConnection program from Lotus Domino Server
>> installed on Linux to connect to Postgresql in Linux.
>> But I am getting the following runtime error.
>> The code is included in a JAVA agent which is called on the click of a
>> button.
>>
>>
****************************************************************************
>>
>> **********************************************
>> The postgresql.jar file does not contain the correct JDBC classes for
>> this
>> JVM. Try rebuilding. If that fails, try forcing the version supplying
>> it to
>> the command line using the argument -Djava.version=1.1 or
>> -Djava.version=1.
>>
>>
****************************************************************************
>>
>> **********************************************
>>
>  > Linux version is - 8.0
>  > Postgresql version is - 7.2.2
>  > Domino Server version(Linux) is - 5.0.10
>  >
>  > What is the procedure for rebuilding the jar file?
>  >
>
>
> Maybe Domino is using yet another JVM, perhaps came packed with the
> product?
>
> If this is so, note that IBM until very recently only had a 1.3.1 JVM,
> which means you should be using the JDBC2 driver, not the JDBC3 one
> (which seems to require 1.4 Java).
>
> You can build a JDBC2 driver by installing a 1.3.1 Java SDK (yes, you
> can have several JVMs installed), set your JAVA_HOME and PATH and build
> (you'll have to configure the whole pgsql tree).  Don't forget to make
> sure no other version of the driver is anywhere in your CLASSPATH, in
> the JVM jre/lib/ext directory etc.
>
> There is a pg73jdbc2.jar at
>
> http://jdbc.postgresql.org/download.html
>
> If that doesn't work because Domino uses some javax.sql stuff, then try
> the pg73jdbc2ee.jar one (right below the above).
>
>
> Regards,
> Fernando
>
>
>


--
Fernando Nasser
Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9