Forums Register Login

preparestatment

+Pie Number of slices to send: Send
Hi,

I am doing like below.


It is not working. I am not getting the del cnt. It is throwing an exception.


Can anyone tell me what is wrong in the above code?

Thanks


+Pie Number of slices to send: Send
 

anvi kon wrote:Hi,... It is throwing an exception...

What does that exception say?
+Pie Number of slices to send: Send
Hi,

Exception says: you cannot rollback with autocommit set.


My question , Is the below code returns the int or not?




Thanks

+Pie Number of slices to send: Send
It returns the int on success.
+Pie Number of slices to send: Send
Yes, it returns int for INSERT,UPDATE,DELETE statements and 0 for DDL statements. Check out this link..
+Pie Number of slices to send: Send
Once Check you have delete permission or not..
+Pie Number of slices to send: Send
There's something confused in your instruction.

You get the PreparedStatement from the connection with the method



and you pass to this method the sql query String

Then you invoke the super interface (Statement) version of executeUpdate with another sql query.

If the query is



then don't even use a PreparedStatement, but just a Statement


+Pie Number of slices to send: Send
 

Nicola Garofalo wrote:There's something confused in your instruction.

You get the PreparedStatement from the connection with the method



and you pass to this method the sql query String

Then you invoke the super interface (Statement) version of executeUpdate with another sql query


Good catch!
If you have a bad day in October, have a slice of banana cream pie. And this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1378 times.
Similar Threads
tricky program
JSP code to complete a task
KeyListener multiple event generation
Reading a file and getting run time error
Crash when dataTable is empty
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 02:38:06.