Results 1 to 5 of 5
Thread: update database
- 03-31-2012, 07:27 PM #1
Member
- Join Date
- Mar 2012
- Posts
- 2
- Rep Power
- 0
- 03-31-2012, 08:29 PM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,606
- Blog Entries
- 7
- Rep Power
- 17
Re: update database
What was the error message?
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 03-31-2012, 09:57 PM #3
Member
- Join Date
- Mar 2012
- Posts
- 2
- Rep Power
- 0
Re: update database
There is no error message, but when I click on update button my database is not updated
- 03-31-2012, 10:04 PM #4
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,606
- Blog Entries
- 7
- Rep Power
- 17
- 04-01-2012, 12:35 AM #5
Member
- Join Date
- Apr 2012
- Location
- Long Island, NY
- Posts
- 6
- Rep Power
- 0
Re: update database
Here try this, Add the MySQL JDBC library to your project and use this code:
private static String server_username = "";
private static String server_password = "";
private static String url = "jdbc:mysql://host/database";
Connection conn;
try {
Class.forName("com.mysql.jdbc.Driver").newInstance ();
conn = DriverManager.getConnection(url, server_username, server_password);
String query = "DELETE FROM IDENTIFICATION WHERE IDmalade = '" + ID.getText() + "'";
Statement st = (Statement) conn.createStatement();
st.executeUpdate(query);
st.close();
conn.close();
} catch (Exception e) {
System.err.println(e);
}
Similar Threads
-
Hi why is it my database never update/edit its data
By RichersooN in forum JDBCReplies: 4Last Post: 10-01-2011, 04:13 AM -
Update table in database
By CTheSky in forum JDBCReplies: 3Last Post: 01-30-2011, 04:18 AM -
Update a price in a database
By sandraW in forum New To JavaReplies: 14Last Post: 08-29-2010, 04:41 AM -
How to update database using Spring framework
By Java Tip in forum Java TipReplies: 0Last Post: 04-01-2008, 10:43 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks