aspose file tools*
The moose likes JDBC and the fly likes Error at Execute Update Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Error at Execute Update" Watch "Error at Execute Update" New topic
Author

Error at Execute Update

Lilyana Saputra
Greenhorn

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




thx
Madhav Manish
Greenhorn

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
Greenhorn

Joined: Feb 03, 2006
Posts: 20
thx...
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
internet detective
Marshal

Joined: May 26, 2003
Posts: 29287
    
140

Lilyana,
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?


[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
Lilyana Saputra
Greenhorn

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??

thx
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error at Execute Update
 
Similar Threads
Need help about delete data
data insert problem
doubt in update
(jdbc+oracle) urgent please!!
Failed to load JDBC/ODBC driver.