String insertTableSQL = "INSERT INTO DBUSER (USER_ID, USERNAME) VALUES (1,'mkyong')"; 

So that instead of 1 and mkyong there are variables?

    2 answers 2

    IMHO is more suitable here PreparedStatement with Batch - see for example

      read what the Prepared Statement is, for example here .

       String selectSQL = "SELECT USER_ID, USERNAME FROM DBUSER WHERE USER_ID = ?"; PreparedStatement preparedStatement = dbConnection.prepareStatement(selectSQL); preparedStatement.setInt(1, 1001); ResultSet rs = preparedStatement.executeQuery(selectSQL );