From: | "wu xiao" <zolawu(at)hotmail(dot)com> |
---|---|
To: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | a question, please help me. |
Date: | 2005-07-20 07:00:34 |
Message-ID: | BAY13-F22AAE8F6AF0502ABEEFDAAD5D70@phx.gbl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Dave Cramer | 2005-07-20 09:55:16 | Re: Timestamp Conversion Woes Redux |
Previous Message | Oliver Jowett | 2005-07-20 06:42:00 | Re: Timestamp Conversion Woes Redux |