X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3DFBA3A6AC8 for ; Tue, 14 Dec 2004 15:17:06 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 13052-08 for ; Tue, 14 Dec 2004 15:16:52 +0000 (GMT) Received: from webmail.muc.domeus.com (mail.ecircle.de [195.140.186.200]) by svr1.postgresql.org (Postfix) with ESMTP id 50E863A6AC1 for ; Tue, 14 Dec 2004 15:16:58 +0000 (GMT) Received: from localhost (localhost [127.0.0.1]) by webmail.muc.domeus.com (READY) with ESMTP id A429D44ECF; Tue, 14 Dec 2004 16:16:59 +0100 (CET) Received: from webmail.muc.domeus.com ([127.0.0.1]) by localhost (webmail.muc.domeus.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 03881-04; Tue, 14 Dec 2004 16:16:58 +0100 (CET) Received: from [192.168.1.110] (unknown [192.168.1.110]) by webmail.muc.domeus.com (READY) with ESMTP id 69A5E44EC5; Tue, 14 Dec 2004 16:16:58 +0100 (CET) Subject: Re: query not working with JDBC driver From: Csaba Nagy To: Jeffrey A Cheak Cc: Postgres JDBC In-Reply-To: References: Content-Type: text/plain Message-Id: <1103037417.15213.5.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Tue, 14 Dec 2004 16:16:58 +0100 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200412/120 X-Sequence-Number: 11786 You are connected to a Postgres data base, but are you sure you connect to the right one ? The error you see means the "cities" table does not exist. It also could be that you have a "CITIES" table - beware that postgres is case sensitive under certain circumstances. Are you sure you typed the query exactly the same way in pgadmin ? My bet would be though that you connect to a different database or schema with pgadmin than with Java :-) HTH, Csaba. On Tue, 2004-12-14 at 15:52, Jeffrey A Cheak wrote: > > > 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. > ---------------------------------------------------------------------------------------- > > > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faqs/FAQ.html