01: /*
02: * Copyright (C) CollabraSpace Inc. All rights reserved.
03: */
04: package adhoc;
05:
06: import java.math.BigDecimal;
07: import java.sql.Connection;
08: import java.sql.DriverManager;
09: import java.sql.ResultSet;
10: import java.sql.SQLException;
11: import java.sql.Statement;
12:
13: public class HSQLBigDecimalTest {
14:
15: String jdbcUrl = "jdbc:hsqldb:file:/tools/hsqldb-1_8_0_2/data/dbcopydest";
16:
17: String user = "sa";
18:
19: String pass = "";
20:
21: Connection con = null;
22:
23: String testSQL = "select nr from test";
24:
25: public HSQLBigDecimalTest() throws Exception {
26: init();
27: }
28:
29: public void init() throws Exception {
30: Class.forName("org.hsqldb.jdbcDriver");
31: con = DriverManager.getConnection(jdbcUrl, user, pass);
32: }
33:
34: /**
35: * This fails with a Connection failure - java.io.EOFException
36: * @throws SQLException
37: */
38: public void doTest() throws SQLException {
39: Statement stmt = con.createStatement();
40: ResultSet rs = stmt.executeQuery(testSQL);
41: if (rs.next()) {
42: BigDecimal d = rs.getBigDecimal(1);
43: System.out.println("d=" + d);
44: }
45: stmt.close();
46: }
47:
48: public void shutdown() throws SQLException {
49: con.close();
50: }
51:
52: /**
53: * @param args
54: */
55: public static void main(String[] args) throws Exception {
56: // TODO Auto-generated method stub
57: PointbaseBLOBTest test = new PointbaseBLOBTest();
58:
59: test.doTest();
60:
61: test.shutdown();
62: }
63:
64: }
|