Tnx.Maybe something like this?
static void connect() {
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
conn = DriverManager.getConnection("jdbc:mysql://localhost/prodaja", "root", "");
try {
connect();
PreparedStatement ps = conn.prepareStatement("delete from proizvod where proizvod_id = ?");
ps.setInt(1,0010);
ps.executeUpdate();
ps.close();
}
try {
connect();
PreparedStatement ps = conn.prepareStatement("update proizvod set naziv = ? where id = ?");
ps.setString(1,"candy");
ps.setString(2,0011);
ps.executeUpdate();
ps.close();
}
try {
connect();
PreparedStatement ps = conn.prepareStatement("insert into proizvod(id, naziv) values(?,?)");
ps.setInt(1,0021);
ps.setString(2,"ball");
ps.executeUpdate();
ps.close();
}
conn.close();
}
catch (Exception ex) {