Re: getConnection() method of PreparedStatement - Mailing list pgsql-jdbc

From Sulakshana Awsarikar
Subject Re: getConnection() method of PreparedStatement
Date
Msg-id 005201c1aa4a$6e09c380$0500a8c0@vsnl.net.in
Whole thread Raw
In response to Re: JDBC batching  ("Tony DeWitt" <dewitt@eizel.com>)
Responses Re: getConnection() method of PreparedStatement
List pgsql-jdbc
Before testing my application with PostgreSQL, I have tested it with MySQL
and MS SQL Server 7.0 and their respective JDBC drivers.  The application
works without throwing any kind of exceptions.

The very basis of using drivers that are supposed to implement the JDBC API
specs is that the application can use any backend database without having to
modify code.

Clearly this is missing here if the ResultSet interface of Postgresql driver
does not give me a getRow() implementation or the PreparedStatement
interface does not give  me a getConnection() implementation.

Is there any postgresql driver which does provide these implemetations ?
Modifying the application because of lack of implementation of abstract
methods is not an option that can be considered.

regards
Sulakshana


----- Original Message -----
From: "Stefano Reksten" <sreksten@sdb.it>
To: "Sulakshana Awsarikar" <sulakshana@mithi.com>
Sent: Thursday, January 31, 2002 4:40 PM
Subject: Re: [JDBC] getConnection() method of PreparedStatement


> At 16.12 31/01/02 +0530, you wrote:
> >On using the getConnection() method from the PreparedStatement interface
the
> >java.lang.AbstractMethodError exception is thrown.
> >Similarly for methods like getRow() from the ResultSet interface.
>
> Sulakshana,
> you should not ask a connection from the PreparedStatement, but you should
do
> Class.forName("org.postgresql.Driver");
> DriverManager.getConnection("jdbc:postgresql:<database name>",
> "<user>", >"<password>");
> PreparedStatement pstmt = c.prepareStatement("<query>");
> ...
> ResultSet rs = pstmt.executeQuery();
>
> You will get a proper class that *implements* the interfaces. Interfaces
> are just a "contract" between classes. HTH
>
> Ciao,
>          Stefano
>
>
>
>


pgsql-jdbc by date:

Previous
From: "Sulakshana Awsarikar"
Date:
Subject: getConnection() method of PreparedStatement
Next
From: Ned Wolpert
Date:
Subject: Re: getConnection() method of PreparedStatement