Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.sql.CallableStatement;
- import java.sql.Connection;
- import java.sql.DriverManager;
- import java.sql.ResultSet;
- import java.sql.Types;
- import java.sql.SQLException;
- import java.sql.Statement;
- import java.sql.PreparedStatement;
- import java.sql.CallableStatement;
- import java.sql.Struct;
- import java.sql.Array;
- public class testJava {
- public static void main(String[] args) throws Exception {
- Connection con = null;
- Statement st = null;
- ResultSet rs = null;
- Integer val=5;
- String url = "jdbc:edb://192.168.59.103:22222/richyen_test";
- String user = "enterprisedb";
- String password = "o1234";
- try {
- con = DriverManager.getConnection(url, user, password);
- Integer in;
- String sql = "call public.get_user_state_from_sat_id(?)";
- PreparedStatement cs = con.prepareStatement(sql);
- for ( int i = 0; i < 100; i++ ) {
- cs.setInt(1, 1112);
- cs.execute();
- ResultSet res = cs.getResultSet();
- while ( res.next() ){
- in = res.getInt(1);
- System.out.println(in);
- }
- }
- } catch (SQLException ex)
- {
- System.out.println(ex);
- }
- finally {
- try {
- if (con != null)
- {
- con.close();
- }
- } catch (SQLException ex)
- {
- System.out.println(ex);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement