Thread: Further getLastOID() woes

Further getLastOID() woes

From
Zak McGregor
Date:
Hi all

I am trying to return the oid of the last inserted row, but nonoe of my casts
are liked by the compiler. I hgave tried all the variations found on this list &
I keep getting similar messages:

DBase.java:81: cannot resolve symbol
symbol  : class AbstractJdbc1Statement
location: class celerity.DBase
            return ((AbstractJdbc1Statement)(stmt)).getLastOID() ;


Any thoughts please? The jdbc version is postgresql-jdbc-7.2-12.2mdk


Thanks


ciao

Zak
--
========================================================================
http://www.carfolio.com/        Searchable database of 10 000+ car specs
Auctioning motoring-related items at eBay? http://www.carfolio.com/ebay/
========================================================================

Re: Further getLastOID() woes

From
Kris Jurka
Date:

On Mon, 1 Sep 2003, Zak McGregor wrote:

> Hi all
>
> I am trying to return the oid of the last inserted row, but nonoe of
> my casts are liked by the compiler. I hgave tried all the variations
> found on this list & I keep getting similar messages:
>
> DBase.java:81: cannot resolve symbol
> symbol  : class AbstractJdbc1Statement
> location: class celerity.DBase
>             return ((AbstractJdbc1Statement)(stmt)).getLastOID() ;
>

You must either import org.postgresql.jdbc1 or include the full
package/class name in your cast.

Kris Jurka


Re: Further getLastOID() woes

From
Zak McGregor
Date:
On Mon, 1 Sep 2003 06:27:20 -0400 (EDT)
Kris Jurka <books@ejurka.com> wrote:

> You must either import org.postgresql.jdbc1 or include the full
> package/class name in your cast.

Thanks, but it isn't that. Anything else I can try?

[zak@zak celerity]$ javac -classpath .:jdbc7.1-1.2.jar DBase.java
DBase.java:81: cannot resolve symbol
symbol  : class AbstractJdbc2Statement
location: package postgresql
            return ((org.postgresql.AbstractJdbc2Statement)(stmt)).getLastOID()
;
                                   ^
1 error
[zak@zak celerity]$ javac -classpath .:jdbc7.1-1.2.jar DBase.java
DBase.java:81: cannot resolve symbol
symbol  : method getLastOID ()
location: class org.postgresql.Statement
            return ((org.postgresql.Statement)stmt).getLastOID();
                   ^
1 error
[zak@zak celerity]$ javac -classpath .:jdbc7.1-1.2.jar DBase.java
DBase.java:81: cannot resolve symbol
symbol  : class PGStatement
location: package postgresql
            return ((org.postgresql.PGStatement)stmt).getLastOID();
                                   ^
1 error
[zak@zak celerity]$ javac -classpath .:jdbc7.1-1.2.jar DBase.java
DBase.java:81: cannot resolve symbol
symbol  : method getLastOID ()
location: class org.postgresql.jdbc2.Statement
            return ((org.postgresql.jdbc2.Statement)stmt).getLastOID();
                   ^
1 error



--
========================================================================
http://www.carfolio.com/        Searchable database of 10 000+ car specs
Auctioning motoring-related items at eBay? http://www.carfolio.com/ebay/
========================================================================

Re: Further getLastOID() woes

From
Dave Cramer
Date:
Zak,

I'm not sure a 7.1 jar had those classes in them, what does jar -tvf
jdbc7.1.1.2 say?

also why not upgrade, there have been lots of bugs fixed in the
meantime.

Dave
On Mon, 2003-09-01 at 10:28, Zak McGregor wrote:
> On Mon, 1 Sep 2003 06:27:20 -0400 (EDT)
> Kris Jurka <books@ejurka.com> wrote:
>
> > You must either import org.postgresql.jdbc1 or include the full
> > package/class name in your cast.
>
> Thanks, but it isn't that. Anything else I can try?
>
> [zak@zak celerity]$ javac -classpath .:jdbc7.1-1.2.jar DBase.java
> DBase.java:81: cannot resolve symbol
> symbol: class AbstractJdbc2Statement
> location: package postgresql
>             return ((org.postgresql.AbstractJdbc2Statement)(stmt)).getLastOID()
> ;
>                                    ^
> 1 error
> [zak@zak celerity]$ javac -classpath .:jdbc7.1-1.2.jar DBase.java
> DBase.java:81: cannot resolve symbol
> symbol: method getLastOID ()
> location: class org.postgresql.Statement
>             return ((org.postgresql.Statement)stmt).getLastOID();
>                    ^
> 1 error
> [zak@zak celerity]$ javac -classpath .:jdbc7.1-1.2.jar DBase.java
> DBase.java:81: cannot resolve symbol
> symbol: class PGStatement
> location: package postgresql
>             return ((org.postgresql.PGStatement)stmt).getLastOID();
>                                    ^
> 1 error
> [zak@zak celerity]$ javac -classpath .:jdbc7.1-1.2.jar DBase.java
> DBase.java:81: cannot resolve symbol
> symbol: method getLastOID ()
> location: class org.postgresql.jdbc2.Statement
>             return ((org.postgresql.jdbc2.Statement)stmt).getLastOID();
>                    ^
> 1 error
>
>
>
> --
> ========================================================================
> http://www.carfolio.com/        Searchable database of 10 000+ car specs
> Auctioning motoring-related items at eBay? http://www.carfolio.com/ebay/
> ========================================================================
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
>                http://archives.postgresql.org
>
--
Dave Cramer <Dave@micro-automation.net>


Re: Further getLastOID() woes

From
Paul Thomas
Date:
On 01/09/2003 15:28 Zak McGregor wrote:
> On Mon, 1 Sep 2003 06:27:20 -0400 (EDT)
> Kris Jurka <books@ejurka.com> wrote:
>
> > You must either import org.postgresql.jdbc1 or include the full
> > package/class name in your cast.
>
> Thanks, but it isn't that. Anything else I can try?
>
> [zak@zak celerity]$ javac -classpath .:jdbc7.1-1.2.jar DBase.java
> DBase.java:81: cannot resolve symbol
> symbol  : class AbstractJdbc2Statement
> location: package postgresql
>             return
> ((org.postgresql.AbstractJdbc2Statement)(stmt)).getLastOID()
> ;
>

Looking at the sources for the 7.1 JDBC driver, it looks like you should
be saying something like:

return ((org.postgresql.jdbc1.Statement)(stmt).getInsertedOID();

Later drivers would seem to use the format you've just tried. I think the
later drivers will work OK with Postgres 7.1 (I assume that's what you're
using).

HTH

--
Paul Thomas
+------------------------------+---------------------------------------------+
| Thomas Micro Systems Limited | Software Solutions for the Smaller
Business |
| Computer Consultants         |
http://www.thomas-micro-systems-ltd.co.uk   |
+------------------------------+---------------------------------------------+

Re: Further getLastOID() woes

From
Zak McGregor
Date:
On Mon, 1 Sep 2003 16:05:13 +0100
Paul Thomas <paul@tmsl.demon.co.uk> wrote:

> Looking at the sources for the 7.1 JDBC driver, it looks like you should
> be saying something like:
>
> return ((org.postgresql.jdbc1.Statement)(stmt).getInsertedOID();

Great, thanks Paul, s/jdbc1/jdbc2/  & that works very well indeed.

Thanks

Cheers

Zak

--
========================================================================
http://www.carfolio.com/        Searchable database of 10 000+ car specs
Auctioning motoring-related items at eBay? http://www.carfolio.com/ebay/
========================================================================