This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes JSP and the fly likes jsp and jdbc Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » JSP
Bookmark "jsp and jdbc" Watch "jsp and jdbc" New topic

jsp and jdbc

viral patel

Joined: Feb 25, 2003
Posts: 16
Hi..I have jsp page call sucess.jsp. which is basically get data from a form and stors in database. In my all table i created Sequences to generate accountID and stuff. Now when write my sql query..for example:
Insert into('"+accountId_sequence.NEXTVAL+"','"+viral+"'...);
it gives me error that it can find variable call accountID_squence...
SO my question is how can i store data from a form using Sequence from jsp page..
Praful Thakare
Ranch Hand

Joined: Feb 10, 2001
Posts: 641
Hi virla
try this out
Insert into.....("accountId_sequence.NEXTVAL"....)
i.e as accountId_sequence is defined in ur database give it in quotes !!!
or u can do this as well
rs=stmt.executeQuery("select accountId_sequence.NEXTVAL from dual");
String accountId_seq=rs.getString(1);
and then ur insert stuff ...
Hope this helps u
[ March 19, 2003: Message edited by: Praful Thakare ]

All desirable things in life are either illegal, banned, expensive or married to someone else !!!
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: jsp and jdbc
jQuery in Action, 3rd edition