Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Other Java > Java Databases
Password Reminder
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Java Databases Discussion specific to working with Java Databases. For other Java topics, please see related Java forums. For database discussions not specific to Java, please see the Database category.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Java Databases section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Display Modes
  #1 (permalink)  
Old November 24th, 2004, 11:33 AM
Authorized User
Join Date: Oct 2004
Location: , , .
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Default problem in prepared Statement

I have a jsp page

i have used following prepared Statement for the update in database.

Can any one tell me that,How can i use date in following method.

I have 4 field for date as given below:(BOLD shown)

I have used String in that place.

It is not working.

PreparedStatement pstatement = conn.prepareStatement(
"UPDATE sec_mast SET catg_code=?, vou_no=?, vou_date=?, vou_amt=?, due_date1=?, due_date2=?, mat_date=? where sec_no=? ");

pstatement.setInt(1,Integer.parseInt(request.getPa rameter("catg_code")));
pstatement.setString(2,request.getParameter("vou_n o"));
pstatement.setString(3,request.getParameter("vou_d ate"));
pstatement.setInt(4,Integer.parseInt(request.getPa rameter("vou_amt")));
pstatement.setString(5,request.getParameter("due_d ate1"));
pstatement.setString(6,request.getParameter("due_d ate2"));
pstatement.setString(7,request.getParameter("mat_d ate"));
pstatement.setInt(8,Integer.parseInt(request.getPa rameter("sec_no")));

int rowCount = pstatement.executeUpdate();

plz help me

  #2 (permalink)  
Old February 11th, 2005, 07:28 AM
Friend of Wrox
Join Date: Jul 2004
Location: , , India.
Posts: 345
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to gokul_blr Send a message via Yahoo to gokul_blr

Check your Data type conversion like java.sql.Date & Date

Gokulan Ethiraj
  #3 (permalink)  
Old March 23rd, 2006, 08:34 AM
Authorized User
Join Date: Mar 2006
Location: , , .
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts

U can set date by using this method :-
void setDate(int parameterIndex, Date x)
Sets the designated parameter to the given java.sql.Date value.

Have a look on this URL for more details on java.sql.PreparedStatement :-


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
prepared statement sanqry J2EE 0 April 16th, 2006 02:58 AM
Prepared SQL VS. Regular Queries nikotromus Pro VB 6 0 January 17th, 2006 07:37 PM
Prepared SQL VS. Regular Queries nikotromus Access VBA 2 January 14th, 2006 05:56 PM
problem in prepared statement abhit_kumar JSP Basics 1 November 25th, 2004 03:22 AM

All times are GMT -4. The time now is 01:03 AM.

Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.