Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class TestClient {
- static Connection dbConnection = null;
- public static void main(String[] args) throws ClassNotFoundException {
- try {
- Class.forName("org.firebirdsql.jdbc.FBDriver");
- String dbURL = "jdbc:firebirdsql://127.0.0.1:3050/C:\databases2\TESTDB.FDB";
- String user = "sysdba";
- String password = "masterkey";
- dbConnection = DriverManager.getConnection(dbURL,user, password);
- dbConnection.setAutoCommit(false);
- PreparedStatement stmt = dbConnection.prepareStatement("SELECT * FROM test_table");
- ResultSet rs = stmt.executeQuery();
- int j = 0;
- int i = 0;
- String s = "";
- while (rs.next()) {
- i++;
- j = rs.getInt("id");
- s = rs.getString("text_col");
- }
- System.out.println(String.format("Finished reading %d rows.", i));
- rs.close();
- stmt.close();
- dbConnection.close();
- } catch (SQLException ex) {
- ex.printStackTrace();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement