pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dave Cramer <pg@fastcrypt.com>
To: wu xiao <zolawu@hotmail.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: a question, please help me.
Date: Wed, 20 Jul 2005 11:32:00 -0400
Message-ID: <7D171EB2-B1AF-4A72-A400-9074EA9B555E@fastcrypt.com> (raw)
In-Reply-To: <BAY13-F22AAE8F6AF0502ABEEFDAAD5D70@phx.gbl>
References: <BAY13-F22AAE8F6AF0502ABEEFDAAD5D70@phx.gbl>

What does the table definition look like ?

in the first example you don't get the result by name so it could be  
any column.

Dave
On 20-Jul-05, at 3:00 AM, wu xiao wrote:

> Dear Sir or Madam,
>    I am in trouble when I try to connect postgresql 8.03 to  
> JBuilder9 with JDBC3 8.1. When I use no-parameter sql, my project  
> runs well. For example,
>
> Connection db = DriverManager.getConnection(url,user,pwd);
> Statement st = db.createStatement();
> ResultSet rs = st.executeQuery("select * from operator");
> while(rs.next()) {
> System.out.println("ID: "+rs.getString(1));
> }
> rs.close();
> st.close();
>
> The results are:
> ID: 100
> ID: 101
> ...
>
> But when I try to use parameter sql, my project has sqlexceptions,  
> for example:
>
> Connection db = DriverManager.getConnection(url,user,pwd);
> PreparedStatement ps = db.prepareStatement("select * from operator  
> where ID=?");
> ps.setString(1,100);
> ResultSet rs = ps.executeQuery();
> if(rs!=null) {
> while(rs.next()) {
> System.out.println("ID: "+rs.getString(1)); }
> rs.close();
> }
> ps.close();
>
> The sqlexception is:....column 'id' is not exist..... What's the  
> reason please? All of the tables are created in Windows XP.
>
> Thank you for your any suggestion.
>
> Sincerely,
>                                          Thomas Wu
>
> _________________________________________________________________
> 享用世界上最大的电子邮件系统— MSN Hotmail。  http:// 
> www.hotmail.com
>
> ---------------------------(end of  
> broadcast)---------------------------
> TIP 6: explain analyze is your friend
>
>



Dave Cramer
davec@postgresintl.com
www.postgresintl.com
ICQ #14675561
jabber davecramer@jabber.org
ph (519 939 0336 )




view thread (3+ messages)  latest in thread

Message-ID: <7D171EB2-B1AF-4A72-A400-9074EA9B555E@fastcrypt.com>
Permalink:  ../7D171EB2-B1AF-4A72-A400-9074EA9B555E@fastcrypt.com/
Also on:    postgresql.org/message-id/7D171EB2-B1AF-4A72-A400-9074EA9B555E@fastcrypt.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: pg@fastcrypt.com, zolawu@hotmail.com
  Subject: Re: a question, please help me.
  In-Reply-To: <7D171EB2-B1AF-4A72-A400-9074EA9B555E@fastcrypt.com>
  References: <BAY13-F22AAE8F6AF0502ABEEFDAAD5D70@phx.gbl> <7D171EB2-B1AF-4A72-A400-9074EA9B555E@fastcrypt.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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