Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within JDBC and Relational Databases
Search Coderanch
Advance search
Google search
Register / Login
Win a copy of
Cloud Application Architecture Patterns: Designing, Building, and Modernizing for the Cloud
this week in the
Cloud/Virtualization
forum!
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Tim Cooke
paul wheaton
Paul Clapham
Ron McLeod
Sheriffs:
Jeanne Boyarsky
Liutauras Vilda
Saloon Keepers:
Tim Holloway
Carey Brown
Roland Mueller
Piet Souris
Bartenders:
Forum:
JDBC and Relational Databases
PostgreSQL prepared statement failure
John Blunket
Greenhorn
Posts: 12
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi,
I have a prepared statement in my
java
code:
String updateMediaQuery = "UPDATE media SET id_project=$,type=$,name=$,importDate=$," + "comment=$ WHERE id_media=$"; PreparedStatement ps; ps = conn.prepareStatement(updateMediaQuery); ps.setInt(1, media.getIdProject()); ps.setInt(2, media.getIdType()); ps.setString(3, media.getMediaName()); ps.setString(4, media.getCreateDate()); ps.setString(5, media.getComment()); ps.setInt(6, media.getIdMedia()); ps.executeUpdate();
When I execute it, it throws an exception:
org.postgresql.util.PSQLException: The column index is out of range: 1, number of columns: 0.
Whats happening?
John.
Jan Cumps
Bartender
Posts: 2662
19
I like...
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
The placeholder is '?', not '$'.
OCUP UML fundamental and ITIL foundation
John Blunket
Greenhorn
Posts: 12
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Jan,
Thanks, what a fool I am!!
John.
Paul Sturrock
Bartender
Posts: 10336
I like...
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
David Blunket, please check your
private messages
.
JavaRanch FAQ
HowToAskQuestionsOnJavaRanch
Consider Paul's
rocket mass heater
.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Java Code does not recognize my sequence name
how to increase the number in oracle database automatically
parameter index out of bounds:3 is not valid value between 1 and 1
Inserting date into an MS Access DB
Prepared Statement
More...