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
(SQLExceptione) { 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@retep.org.uk, peter@retepdigital.com, me@petermount.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@netasol.com>
> To: <pgsql-interfaces@postgreSQL.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
> >