Code for updating the database


In particular, the field "num_points" is a little unusual. Where mn='" + m + "'"); String(1, f); String(2, l); String(3, g); String(4, d); String(5, p); String(6, a); String(7, h); String(8, s); String(9, i); String(10, y); String(11, yp); String(12, pm); String(13, zp); String(14, al); String(15, ge); String(16, de); String(17, rk); Bytes(18, pi); String(19, fi); ps.execute Update(); JOption Message Dialog(null, "Data Updated Successfully", "Data Updated", JOption Pane. why are you using the safe proper way of assigning variables with prepared statements for fn and using the unsafe and susceptible to sql injection way of concatenating strings for mn?class, and a sample My SQL database table we can work with.Because of the amount of code written, I decided to insert just the code I wrote for the update of the database. Code for update private void up Action Performed(event.

The first thing we need for our Java UPDATE example is a sample My SQL database table.

To keep it simple — but also show several different data types — I've created the following My SQL database table: create table users ( id int unsigned auto_increment not null, first_name varchar(32) not null, last_name varchar(32) not null, date_created timestamp default now(), is_admin boolean, num_points int, primary key (id) ); -- insert some sample records insert into users (first_name, last_name) values ('Fred', 'Flinstone'); insert into users (first_name, last_name) values ('Barney', 'Rubble'); A few of these fields are a little contrived, but I wanted to show several different data types in one table, so this is what I came up with.

The update is successful but when I attempt to retrieve the updated record.

It gives me a null pointer exception(sets the value of the picture of the record to null).


I have a problem in updating a database in My SQL using java. To be specific this problem occurs after I update a score(the last score from a GUI Interface).


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>