Advertisement
Guest User

Untitled

a guest
May 25th, 2012
305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.40 KB | None | 0 0
  1.  static public void db_test()
  2.     {
  3.         Connection conn;
  4.         String strDatabasePath = "192.168.1.100:/data/nik/IBDATA.GDB";
  5.         String strURL="jdbc:firebirdsql:"+strDatabasePath;
  6.         String strUser="SYSDBA";
  7.         String strPassword="masterkey";
  8.         try
  9.         {Class.forName("org.firebirdsql.jdbc.FBDriver").newInstance();}
  10.         catch(IllegalAccessException | InstantiationException | ClassNotFoundException ex)
  11.         {Logger.getLogger(DM.class.getName()).log(Level.SEVERE, null, ex);}
  12.  
  13.         try
  14.         {
  15.                 Properties properties=new Properties();
  16.                 properties.put("user",strUser);
  17.                 properties.put("password",strPassword);
  18.                 conn = DriverManager.getConnection(
  19.                                 strURL + "?lc_ctype=WIN1251",properties);
  20.                 PreparedStatement q1 = conn.prepareStatement("select * from params");
  21.                 ResultSet r1 = q1.executeQuery();
  22.                 PreparedStatement q2 = conn.prepareStatement("select * from clients");
  23.                 ResultSet r2 = q2.executeQuery();
  24.                 r1.next(); r1.getObject(1); //<b>org.firebirdsql.jdbc.FBSQLException: The result set is closed</b>
  25.                 r2.next(); r2.getObject(1);
  26.  
  27.     }
  28.         catch(SQLException ex)
  29.         {
  30.             Logger.getLogger(DM.class.getName()).log(Level.SEVERE, null, ex);
  31.         }
  32.  
  33.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement