Unni Babu
0
Q:

jdbc prepared statement example

String query = "INSERT INTO artikel VALUES (?, ?, ?, ?, ?)";
try {
  PreparedStatement ps = con.prepareStatement(query);
  ps.setInt(1, aNumb);
  ps.setString(2, aName);
  ps.setFloat(3, aPrice);
  ps.setInt(4, aAvailable);
  ps.setString(5, aInfo);
  ps.executeUpdate();

  ps.close();
  disconnectDB();
}catch(SQLException e){
  System.out.println(e.getMessage());
}
1

New to Communities?

Join the community