1 | public class HSQLBigDecimalTest {↵ | | 1 | public class MySQLDecimalTest {↵
|
|
2 | String jdbcUrl = "jdbc:hsqldb:file:/tools/hsqldb-1_8_0_2/data/dbcopydest";↵ | | 2 | String jdbcUrl = "jdbc:hsqldb:file:/tools/hsqldb-1_8_0_2/data/dbcopydest";↵
|
3 | ↵ | | 3 | ↵
|
4 | String user = "sa";↵ | | 4 | String user = "sa";↵
|
5 | ↵ | | 5 | ↵
|
6 | String pass = "";↵ | | 6 | String pass = "";↵
|
7 | ↵ | | 7 | ↵
|
8 | Connection con = null;↵ | | 8 | Connection con = null;↵
|
9 | ↵ | | 9 | ↵
|
10 | String testSQL = ↵ | | 10 | String testSQL = ↵
|
11 | "select nr from test";↵ | | 11 | "select nr from test";↵
|
|
12 | ↵ | | 12 | ↵
|
13 | public HSQLBigDecimalTest() throws Exception {↵ | | 13 | public MySQLDecimalTest() throws Exception {↵
|
14 | init();↵ | | 14 | init();↵
|
15 | }↵ | | 15 | }↵
|
16 | ↵ | | 16 | ↵
|
17 | public void init() throws Exception {↵ | | 17 | public void init() throws Exception {↵
|
18 | Class.forName("org.hsqldb.jdbcDriver");↵ | | 18 | Class.forName("org.hsqldb.jdbcDriver");↵
|
19 | con = DriverManager.getConnection(jdbcUrl,user, pass);↵ | | 19 | con = DriverManager.getConnection(jdbcUrl,user, pass);↵
|
20 | }↵ | | 20 | }↵
|
21 | ↵ | | 21 | ↵
|
|
22 | /**↵ | | 22 | /**↵
|
23 | * This fails with a Connection failure - java.io.EOFException↵ | | 23 | * This fails with a Connection failure - java.io.EOFException↵
|
24 | * @throws SQLException↵ | | 24 | * @throws SQLException↵
|
25 | */↵ | | 25 | */↵
|
26 | public void doTest() throws SQLException {↵ | | 26 | public void doTest() throws SQLException {↵
|
27 | Statement stmt = con.createStatement();↵ | | 27 | Statement stmt = con.createStatement();↵
|
28 | ResultSet rs = stmt.executeQuery(testSQL);↵ | | 28 | ResultSet rs = stmt.executeQuery(testSQL);↵
|
29 | if (rs.next()) {↵ | | 29 | if (rs.next()) {↵
|
30 | BigDecimal d = rs.getBigDecimal(1);↵ | | 30 | BigDecimal d = rs.getBigDecimal(1);↵
|
31 | System.out.println("d="+d);↵ | | 31 | System.out.println("d="+d);↵
|
32 | }↵ | | 32 | }↵
|
33 | stmt.close();↵ | | 33 | stmt.close();↵
|
34 | }↵ | | 34 | }↵
|
|
35 | ↵ | | 35 | ↵
|
36 | public void shutdown() throws SQLException {↵ | | 36 | public void shutdown() throws SQLException {↵
|
37 | con.close();↵ | | 37 | con.close();↵
|
38 | }↵ | | 38 | }↵
|
39 | ↵ | | 39 | ↵
|
40 | /**↵ | | 40 | /**↵
|
41 | * @param args↵ | | 41 | * @param args↵
|
42 | */↵ | | 42 | */↵
|
43 | public static void main(String[] args) throws Exception {↵ | | 43 | public static void main(String[] args) throws Exception {↵
|
|
44 | PointbaseBLOBTest test = new PointbaseBLOBTest();↵ | | 44 | PointbaseBLOBTest test = new PointbaseBLOBTest();↵
|
45 | ↵ | | 45 | ↵
|
46 | test.doTest();↵ | | 46 | test.doTest();↵
|
47 | ↵ | | 47 | ↵
|
48 | test.shutdown();↵ | | 48 | test.shutdown();↵
|
49 | | | 49 |
|