wood burning stoves 2.0
The moose likes JDBC and Relational Databases and the fly likes Error at Execute Update Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Error at Execute Update" Watch "Error at Execute Update" New topic

Error at Execute Update

Lilyana Saputra

Joined: Feb 03, 2006
Posts: 20
i have some problem...
i create application to select, insert, update, delete database...

before when i create...it is work..either execute select, insert, update, delete
but now, when i try to check it...

select, delete - is working
insert, update - not working

i have been print the command and run it in EMS SQL, it is work, but in application, it is not work...

TO Connect:

TO INSERT: alway not null

TO UPDATE: it always return -1

Madhav Manish

Joined: Feb 28, 2006
Posts: 4
I've read your insert statements and from tehre itself ive seen your error!

in the insert, update,delete,select statement, you must always have a single quote for you values. eg.

statement.executeUpdate("update database.table set fieldname1 ='"+value1+"', fieldname2 ='"+value2+"', ... where keyname1 ='"+keyvalue+"'")
Lilyana Saputra

Joined: Feb 03, 2006
Posts: 20
but it doesn't work...

is it that single quote, just only used for field's type varchar or date and time at mysql (i use mysql, and EMS)....

pls, help me...
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33107

You are correct that the single quote is only needed for character or time based fields.

Did you check that the values you are adding to the SQL don't have any special characters?

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Lilyana Saputra

Joined: Feb 03, 2006
Posts: 20
sory.. i think i am wrong...
i have been known what is wrong...

1. when i do some double check (insert mode)... i do some select and i check it, if (rs==null), data will be inserted... if not it will show a message...
but, the application always said that rs always not null... so, data message always appear and data cannot inserted...
so, i try another way , i check with count the row...if (row==0), data will be inserted.. but it is very strange because any select is working with null...

2. insert and update it work... but it always return -1...how can i know that it work or not??? or has effect or not??

I agree. Here's the link: http://aspose.com/file-tools
subject: Error at Execute Update
It's not a secret anymore!