PageRenderTime 28ms CodeModel.GetById 20ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/tst/org/diffkit/db/tst/TestDBConnection.java

http://diffkit.googlecode.com/
Java | 39 lines | 31 code | 5 blank | 3 comment | 0 complexity | 41b5deb623ed9e95ab5267cd6b417e4d MD5 | raw file
 1package org.diffkit.db.tst;
 2
 3import java.sql.Connection;
 4import java.sql.DatabaseMetaData;
 5
 6import org.diffkit.db.DKDBConnectionInfo;
 7import org.diffkit.db.DKDatabase;
 8import org.diffkit.db.DKDBFlavor;
 9
10public class TestDBConnection {
11
12   public static void main(String[] args_) {
13      try {
14         // DKDBConnectionInfo connectionInfo = new DKDBConnectionInfo("test",
15         // DKDBConnectionInfo.Kind.H2, "mem:test", null, null, "test", "test");
16         DKDBConnectionInfo connectionInfo = new DKDBConnectionInfo("db204",
17            DKDBFlavor.DB2, "LRMDB", "db204.95g.jec.us.ml.com",
18            (Long) 50000L, "analytic", "merrill");
19         // 'jdbc:db2://unit_host:unit_port/unit_server'
20         testConnectionInfo(connectionInfo);
21      }
22      catch (Exception e) {
23         e.printStackTrace();
24      }
25   }
26
27   private static void testConnectionInfo(DKDBConnectionInfo connectionInfo_)
28      throws Exception {
29      System.out.println("connectionInfo->" + connectionInfo_);
30      System.out.println("JDBCUrl->" + connectionInfo_.getJDBCUrl());
31      System.out.println("driverName->" + connectionInfo_.getDriverName());
32      System.out.println("connectionInfo->" + connectionInfo_);
33      DKDatabase connectionSource = new DKDatabase(connectionInfo_);
34      Connection connection = connectionSource.getConnection();
35      System.out.println("connection->" + connection);
36      DatabaseMetaData meta = connection.getMetaData();
37      System.out.println("meta->" + meta);
38   }
39}