| Author |
preparestatment
|
anvi kon
Ranch Hand
Joined: Jan 08, 2010
Posts: 133
|
|
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
|
 |
Jan Cumps
Bartender
Joined: Dec 20, 2006
Posts: 2343
|
|
anvi kon wrote:Hi,... It is throwing an exception...
What does that exception say?
|
OCUP UML fundamental
ITIL foundation
|
 |
anvi kon
Ranch Hand
Joined: Jan 08, 2010
Posts: 133
|
|
Hi,
Exception says: you cannot rollback with autocommit set.
My question , Is the below code returns the int or not?
Thanks
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26193
|
|
|
It returns the int on success.
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
YogeshS Pandit
Greenhorn
Joined: May 10, 2010
Posts: 9
|
|
|
Yes, it returns int for INSERT,UPDATE,DELETE statements and 0 for DDL statements. Check out this link..
|
 |
lokesh pattajoshi
Ranch Hand
Joined: Jul 29, 2009
Posts: 130
|
|
|
Once Check you have delete permission or not..
|
 |
Nicola Garofalo
Ranch Hand
Joined: Apr 10, 2010
Posts: 308
|
|
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
|
Bye,
Nicola
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26193
|
|
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!
|
 |
 |
|
|
subject: preparestatment
|
|
|