Re: JDBC Query bug

From: Matt Fair <matt(at)netasol(dot)com>
To: Peter Mount <peter(at)retep(dot)org(dot)uk>
Cc: pgsql-interfaces(at)postgreSQL(dot)org
Subject: Re: JDBC Query bug
Date: 2000-07-16 19:36:37
Message-ID: 39720EC4.80D097C8@netasol.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

I query SELECT usename FROM pg_user WHERE usename ~* 'star_.*'; in the psql
command line. I get a result in the command line, but not one when I do the
same query in jdbc. It seems to screw up when I do a WHERE query.

I am only expecting 1 result to come back, but in the java code as seen below,
the rs is empty. So rs.next() == false.

ResultSet rs;
rs = null;
rs = this.executeQuery(SELECT usename FROM pg_user WHERE usename ~*
'star_.*')l
CarrotData.instance().assert("this i cannot allow (having a null
ResultSet)!", rs != null);
while (rs.next()) {
ret.addElement(rs.getString("usename"));
}
} catch (SQLException e) {
CarrotData.instance().error(e);
}

Thanks
Matt

Peter Mount wrote:

> Probably the backend. What do you get if you run this query from psql?
>
> JDBC currently does nothing to the SQL before passing it to the backend.
>
> Peter
>
> --
> Peter T Mount peter(at)retep(dot)org(dot)uk, peter(at)retepdigital(dot)com, me(at)petermount(dot)com
> Homepage: http://www.retep.org.uk Contact details @ http://petermount.com
> PostgreSQL JDBC: http://www.retep.org.uk/postgres/
> Java PDF generator: http://www.retep.org.uk/pdf/
>
> ----- Original Message -----
> From: Matt Fair <matt(at)netasol(dot)com>
> To: <pgsql-interfaces(at)postgreSQL(dot)org>
> Sent: Saturday, July 15, 2000 7:09 PM
> Subject: [INTERFACES] JDBC Query bug
>
> > This jdbc is messing up on basic select/where queries. For example:
> > SELECT usename FROM pg_user WHERE usename ~* 'star_.*';
> >
> > usename
> > ---------
> > star_admin
> >
> > But in jdbc I do:
> >
> > SELECT usename FROM pg_user WHERE usename ~* 'star_.*';
> >
> > I get an empty result set.
> > rs.next() is false.
> >
> > What would be causing this?
> > Matt
> >

In response to

Browse pgsql-interfaces by date

  From Date Subject
Next Message Matt Fair 2000-07-16 19:40:11 JDBC Source
Previous Message Geoff Healey 2000-07-16 12:10:44 Re: more ODBC driver