query not working with JDBC driver

From: Jeffrey A Cheak <jcheak(at)csc(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: query not working with JDBC driver
Date: 2004-12-14 14:52:46
Message-ID: OF8222929A.410136C8-ON86256F6A.00501D11-86256F6A.0051BC5F@csc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hi everyone,

I'm stuck on a little problem with what may be the JDBC driver or that I
don't fully understand the SQL syntax. I am connecting to the PostGreSQL
database with the JDBC Driver for PostGreSQL. When I run the following
command, I get this:

(java code) :
String query = "SELECT version( )";
ResultSet rs = st.executeQuery(query);

(output from standard output) :
Column Returned PostgreSQL 8.0.0beta5 on i686-pc-mingw32, compiled by GCC
gcc.exe (GCC) 3.3.1 (mingw special 20030804-1)

I assume that the output is a good sign...meaning I am connected to the
database and can "communicate" with it. Although, when I try to do a
simple SQL query on a table, I get an error. The table "cities" does
exist, because I can see it when I use pgAdminIII, in addition, when I use
pgAdminIII, I am able to click on the SQL query icon(bring up a new window)
and perform the simple SQL query from there.

(java code):
String query = "SELECT * FROM cities";
ResultSet rs = st.executeQuery(query);

(output from standard output):
Error somewhere in the query: java.sql.SQLException: ERROR: relation
"cities" does not exist

If anyone could help shed some light on this I would be very thankful.
Again, I apologize if this is not the best place to post this question.(I'm
not sure what category it best falls under)

Thank you all again and kind regards,
Jeffrey

----------------------------------------------------------------------------------------

This is a PRIVATE message. If you are not the intended recipient, please
delete without copying and kindly advise us by e-mail of the mistake in
delivery. NOTE: Regardless of content, this e-mail shall not operate to
bind CSC to any order or other contract unless pursuant to explicit written
agreement or government initiative expressly permitting the use of e-mail
for such purpose.
----------------------------------------------------------------------------------------

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Jeffrey A Cheak 2004-12-14 15:03:49 SQL not working with JDBC update
Previous Message Markus Schaber 2004-12-14 14:06:58 Re: [BUGS] BUG #1347: Bulk Import stopps after a while (