import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; /** * * @author raminorujov */ public class Bug76623 { /** * @param args the command line arguments */ public static void main(String[] args) { try { Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306", "raminorujov", "test"); PreparedStatement st = con.prepareStatement( " select 1--1 + ?\n" + " , 2 + ?\n" + " from dual" ); st.setInt(1, 10); st.setInt(2, 20); ResultSet rs = st.executeQuery(); if(rs.next()) { System.out.println(rs.getInt(1) + " " + rs.getInt(2)); } rs.close(); st.close(); con.close(); } catch (SQLException ex) { ex.printStackTrace(); } } }