import java.util.*; import java.sql.*; public class jdbc_test { protected static final String host = "localhost"; protected static final String db = "bernd"; protected static final String user = "bernd"; protected static final String port = "5447"; protected static Connection con = null; public static void main(String args[]) { try { // setting up JDBC connection PreparedStatement pstmt; Class.forName("org.postgresql.Driver"); con = DriverManager.getConnection("jdbc:postgresql://" + host + ":" + port + "/" + db + "?" + "user=" + user + "&loglevel=2&prepareThreshold=0"); con.setAutoCommit(false); pstmt = con.prepareStatement("SELECT ?::int"); pstmt.setInt(1, 100); pstmt.execute(); con.commit(); } catch(Exception e) { e.printStackTrace(); } } }