Show Some Love
MySql

How to Edit/Delete Data in MySQL database using servlet

This forum was posted on Friday, March 15, 2013 10:41:25 PM


if we are going to add new data in the database we use something like this

 Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnection(
"jdbc:mysql://mysql.cityu.edu.hk:3306/" "yyy" "xxx");
stmt = con.createStatement();
stmt.run("USE yyy");
id = (String) request.getParameter("id");
text = (String) request.getParameter("text");
time = (String) request.getParameter("time");
query="insert into Table values(0 '" + id + "' 'ABC' '" + text + "' '" + time + "');";
int rs = stmt.executeUpdate(query);

but how about if we are going to edit/delete something in the DB? any tutorial? various Thank You! cheers!


137 Viewed this Question



 Recent Replies on "How to Edit/Delete Data in MySQL database using servlet"

  • Nobody has replied on this post, be first to post answer.

Post Your Solution for this Question


Note: Please Put Code into <code></code> block.

Threads related to "How to Edit/Delete Data in MySQL database using servlet":

Cascading SQL query in human readable form

I hv ventured beyond my SQL Fu. I hv three tables a list of products descriptions and functions. there's one or two descriptions per product but multiple functions per product. here is my latest query but not what i require.SELECT products.ID product_descriptions.short_description product_descriptions.language product_descriptions.subheading product_descriptions.web_name product_descriptions.description pf3.language pf3.featureFROM products LEFT JOIN product_descriptions ON product_descr

How to make the mysql MEMORY ENGINE store more data?

i need alter a table from INNODB to MEMORY ENGINE.So I typed this command:alter table sns ENGINE=MEMORY;Then the MySQL shows ERROR 1114 (HY000): The table '#sql-738_19' is fullThe data size for the table is 1GB and I hv 8GB Memory.I checked my.cnf and I didn't find where to change the max_size setting. How do I fix it?Bow

MySQL Trigger - Summarize changes in json formatted column

I'm trying to generate little triggers for my MySQL tables to keep track of updation. I thought of a table likegenerate TABLE IF NOT EXISTS `contacts_changes` ( `id` int(11) NOT NULL AUTO_INCREMENT `action` enum('insert' 'update' 'delete') NOT NULL `contact_id` int(6) NOT NULL `changes` text NOT NULL PRIMARY KEY (`id`));where contact_id is a foreign key to the table i require to monitor and in column updation i require to store the updation made using the JSON format.So if I update the

Java beans- return type

I am working on a small Java EE web application. The problem I hv is related to a sql statement.I hv entities messaging and members.I hv a method- getMessagesById(int msgid) public Messaging getMessagesByMid(int msgid) { String query = "SELECT msgid msgsubject msgcontent timestamp fname lname FROM messaging INNER JOIN members ON messaging.users_userid=users.userid WHERE msgid=?;"; try { PreparedStatement ps = conn.prepareStatement(query); ps.clearParameters(); ps.setInt(1 msgid); ResultSet

bit fields changed when exporting mysql table through phpmyadmin

I tried importing a table from the production server to my local server and all the bit fields that were 0 on the production server turned to 1 on my computer.I looked at the export file and the values of the bit fields there were '0' (I guess they should have been 0).I was shocking what did I do wrong in the export process and is this a known bug/feature.Thnk u Amimy system: Apache/2.2.21 (Win32) mod_ssl/2.2.21 OpenSSL/1.0.0e PHP/5.3.8 mod_perl/2.0.4 Perl/v5.10.1 MySQL member Ver.: mys

Date time data type in CSV import to rails

I am importing a CSV file (a log) into a rails application to do little reporting off of it. The csv file have a event_date column which is formatted as following: Thu Mar 01 11:49:16 +0000 2012I hv used the LOAD DATA LOCAL INFILE method to import the csv into a mysql table. The event_data column in the mysql table was made as datetime. When I import the csv all the event_date records are imported as 0000-00-00 00:00:00.Any idea's on How do I import from the csv and end up with a datetime format in mysql

MySQL - Delimiter error

I hv the following procedure DELIMITER $$generate PROCEDURE yesterday()BEGINSELECT CURDATE()-INTERVAL 1 DAY;END $$DELIMITER;The procedure compiles with error though CALL yesterday(); produces right o/p.the error is :#1064 - you have an error in your SQL syntax; checkout the manual that corresponds to your MySQL server Ver. for the right syntax to use near 'DELIMITER' at line 1I can not find whats going wrong.Plz help!

Does replicate-rewrite-db have any real world application?

I hv been experimenting with master-master replication between two MySQL servers but with various database names and I hv come accross a bit of a stumbling block. It appears that although UPDATEs work perfectly as expected INSERTs do not.While I would say that this is a error or at least a problem with my setup it appears that MySQL says that this is a feature (here and here).If then as MySQL say it only works on the default database then how can this setting have a practical actual world goal?Am I miss

How to store data or persist it across forms

I hv made a program with Windows Forms in C# and the architecture is something like this* BaseClass.cs* EntityClass.cs* ControllerClass.cs* DataAccessClass.cs* Viewer.csSo generally the Entity class inherits from the base class and the data access class goes and retrieves data from a MySql database. What i require to do is to be capable to use the data pulled without having to call the data access class if I already pulled it once.. where can I put this data so I can access it anywhere?.. I was read

Java+MySQL with JDBC connector mistake

I'm trying to connect Java and MySQL with JDBC connector. So I hv downloaded connector from official cite added it to classpath and added to the libraries of eclipse. Now i'm working with the code snippet snippet belowimport java.sql.Connection;import java.sql.DriverManager;import java.sql.ResultSet;import java.sql.SQLException;import java.sql.Statement; public class LocalhostDBConnection { LocalhostDBConnection() { Connection connection; try { // ???????? ???????? String driverName = "com.my