pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Re: query
3+ messages / 3 participants
[nested] [flat]

* Re: query
@ 2017-04-29 16:12 Chuck Davis <cjgunzel@gmail.com>
  2017-04-29 16:45 ` Re: query Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 3+ messages in thread

From: Chuck Davis @ 2017-04-29 16:12 UTC (permalink / raw)
  To: pgsql-jdbc

I am attempting to move a database from DB2 to Postgres and I program with
java.  Using 9.6.2 with JDBC driver 42 on jdk 8u121 on Linux.

I have a statement as follows:
            rs = stat.executeQuery("SELECT U.CONO, CONAME, EMPNO, USERID
FROM INFOSYS.USERS U, INFOSYS.COMPANY  C WHERE USERID='infosysadmin' AND
PASSWORD = 'infosyasdmin' AND U.CONO = C.CONO");

If I execute the select statement in psql it works as expected:
nordic=# SELECT U.CONO, CONAME, EMPNO, USERID FROM INFOSYS.USERS U,
INFOSYS.COMPANY  C WHERE USERID='infosysadmin' AND PASSWORD ='infosysadmin'
AND U.CONO = C.CONO;
 cono |                       coname                       | empno |
userid
------+----------------------------------------------------+-------+--------------
    5 | Nordic Services, Inc.                              |     0 |
infosysadmin
(1 row)


If I execute the statement in my program (and this has been working for
years on DB2) I get the following exception:
 org.postgresql.util.PSQLException: ERROR: relation "infosys.company" does
not exist
  Position: 60
        at
org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2412)
        at
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2125)
        at
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:297)
        at
org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:428)
        at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:354)
        at
org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:301)
        at
org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:287)
        at
org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:264)
        at
org.postgresql.jdbc.PgStatement.executeQuery(PgStatement.java:231)
        at
com.yakridge.server.QFQueries.QFQueryUsers.runQueryFormatQuery(QFQueryUsers.java:63)

It clearly does exist and it does work via psql.  I'm at a loss.....Is
there a bug in JDBC driver?

Thanks for any pointers.

Chuck

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: query
  2017-04-29 16:12 Re: query Chuck Davis <cjgunzel@gmail.com>
@ 2017-04-29 16:45 ` Tom Lane <tgl@sss.pgh.pa.us>
  2017-05-01 02:32   ` Re: query Dave Cramer <pg@fastcrypt.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Tom Lane @ 2017-04-29 16:45 UTC (permalink / raw)
  To: Chuck Davis <cjgunzel@gmail.com>; +Cc: pgsql-jdbc

Chuck Davis <cjgunzel@gmail.com> writes:
> If I execute the select statement in psql it works as expected:
> ...
> If I execute the statement in my program (and this has been working for
> years on DB2) I get the following exception:
>  org.postgresql.util.PSQLException: ERROR: relation "infosys.company" does
> not exist

I'd lay pretty long odds that that means the program is connecting to a
different database than you're connecting to in psql.  Double-check the
connection URL it's using.

(A common variant of that is "program is using a different search_path",
but since you're failing on a schema-qualified relation name, search
path doesn't enter into it.)

			regards, tom lane


-- 
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: query
  2017-04-29 16:12 Re: query Chuck Davis <cjgunzel@gmail.com>
  2017-04-29 16:45 ` Re: query Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-05-01 02:32   ` Dave Cramer <pg@fastcrypt.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Dave Cramer @ 2017-05-01 02:32 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Chuck Davis <cjgunzel@gmail.com>; pgsql-jdbc

Ya, I'm with Tom on this. While there may be bugs in the driver there is
nothing this simple

Dave Cramer

davec@postgresintl.com
www.postgresintl.com

On 29 April 2017 at 12:45, Tom Lane <tgl@sss.pgh.pa.us> wrote:

> Chuck Davis <cjgunzel@gmail.com> writes:
> > If I execute the select statement in psql it works as expected:
> > ...
> > If I execute the statement in my program (and this has been working for
> > years on DB2) I get the following exception:
> >  org.postgresql.util.PSQLException: ERROR: relation "infosys.company"
> does
> > not exist
>
> I'd lay pretty long odds that that means the program is connecting to a
> different database than you're connecting to in psql.  Double-check the
> connection URL it's using.
>
> (A common variant of that is "program is using a different search_path",
> but since you're failing on a schema-qualified relation name, search
> path doesn't enter into it.)
>
>                         regards, tom lane
>
>
> --
> Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-jdbc
>

^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2017-05-01 02:32 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-04-29 16:12 Re: query Chuck Davis <cjgunzel@gmail.com>
2017-04-29 16:45 ` Tom Lane <tgl@sss.pgh.pa.us>
2017-05-01 02:32   ` Dave Cramer <pg@fastcrypt.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox