Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Execute Update from Java to Access database problem...

Reply
Thread Tools

Execute Update from Java to Access database problem...

 
 
lalalala
Guest
Posts: n/a
 
      05-26-2006
public boolean addItem(String barcode, String style, String colour,
String size, String qty, String store){
boolean complete = false;
String addItem = "INSERT INTO items (barcode, style, colour, size,
qty, store) VALUES
('"+barcode+"','"+style+"','"+colour+"','"+size+"' ,'"+qty+"','"+store+"')";
Statement stmnt = null;
System.out.println(addItem);
try {
stmnt = conn01.createStatement();
stmnt.executeUpdate(addItem);
//stmnt.execute(addItem);
complete = true;
} catch (SQLException e) {
e.printStackTrace();
}

return complete;
}

-----The statement works but the executeUpdate isnt updating the
database, when i use the same query directly in access it works and the
connection works for other queries, that modify the information of an
already existant row of information, but for this im not getting any
errors its just not updating my database.
Any ideas on what it could be?
Any help would be greatly appreciated.
Thank you, and ignore last message i fixed that problem

 
Reply With Quote
 
 
 
 
ducnbyu
Guest
Posts: n/a
 
      05-26-2006
Do you need a commit?

 
Reply With Quote
 
 
 
 
lalalala
Guest
Posts: n/a
 
      05-26-2006
Well for previous update statements it wasnt required (SQL commit), and
they updated succesfully. Although perhaps it is because in this case
i'm trying to insert a new row in the table.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Database Database Database Database scott93727@gmail.com Computer Information 0 09-27-2012 02:43 AM
DataBase DataBase DataBase DataBase scott93727@gmail.com Computer Information 0 09-26-2012 09:40 AM
Java access to Microsoft Access database through Samba JC Java 3 06-18-2006 11:41 PM
[BUG?] Update database using stored procedure and OleDbDataAdapter.Update joun ASP .Net 9 11-30-2004 04:57 AM
Can i execute aspx file in my asp pag with server.execute method(sorry) Savas Ates ASP General 1 08-17-2004 04:52 PM



Advertisments