Example #1
0
  public void t1estDataSource() {
    Connection con = null;
    Statement st = null;
    try {
      P6TestUtil.unloadDrivers();

      // try to do a simple test using the datasourcey stuff
      Properties props = P6TestUtil.loadProperties("P6Test.properties");
      String user = props.getProperty("user");
      String password = props.getProperty("password");
      String url = props.getProperty("url");

      P6DriverManagerDataSource ds = new P6DriverManagerDataSource();

      ds.setUrl(url);

      con = ds.getConnection(user, password);
      st = con.createStatement();
      st.execute("create table foo (col1 varchar2(255))");
      st.execute("insert into table foo values ('1')");

      ResultSet rs = st.executeQuery("select count(*) from foo");
      // assertTrue(rs.

    } catch (Exception e) {
      e.printStackTrace(System.out);
      fail("unexpected exception: " + e);
    } finally {

    }
  }
Example #2
0
  public void testMajorVersion() {
    try {
      Properties props = P6TestUtil.loadProperties("P6Test.properties");
      String url = props.getProperty("url");

      Driver driver = DriverManager.getDriver(url);

      // make sure you have a p6 driver
      if (!(driver instanceof P6SpyDriverCore)) {
        fail("Expected to get back a p6spy driver, got back a " + driver);
      }

      // but make sure it's bound to something
      // these numbers will likely change over time :)
      assertEquals(1, driver.getMajorVersion());
      assertEquals(0, driver.getMinorVersion());

    } catch (Exception e) {
      e.printStackTrace(System.out);
      fail("unexpected exception: " + e);
    } finally {
    }
  }