Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

23
LINES

< > BotCompany Repo | #1011903 // Connect to internal H2 Database (OK)

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar

Download Jar. Uses 1780K of libraries. Click here for Pure Java version (869L/6K).

1  
!7
2  
3  
lib 1011900 // h2
4  
5  
import java.sql.*;
6  
7  
p {
8  
  Class.forName("org.h2.Driver");
9  
  Connection conn = DriverManager.getConnection("jdbc:h2:~/test", "sa", "");
10  
  
11  
  S sql = "SELECT * FROM triple";
12  
  ResultSet rs = conn.createStatement().executeQuery(sql);
13  
  while (rs.next()) {
14  
    S webID = rs.getString("globalID");
15  
    int a = rs.getInt("a");
16  
    int b = rs.getInt("b");
17  
    int c = rs.getInt("c");
18  
    print(webID + ": " + a + " " + b + " " + c);
19  
  }
20  
  rs.close();
21  
  
22  
  conn.close();
23  
}

Author comment

Began life as a copy of #1011901

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1011903
Snippet name: Connect to internal H2 Database (OK)
Eternal ID of this version: #1011903/2
Text MD5: 5648640f9144fd2d06607b9c59859ba2
Transpilation MD5: 3213f525f22b7aeb29ba65264358122e
Author: stefan
Category: javax / h2 database
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-11-09 10:22:44
Source code size: 509 bytes / 23 lines
Pitched / IR pitched: No / No
Views / Downloads: 381 / 730
Version history: 1 change(s)
Referenced in: [show references]