@Test public void testCreateOciDriverConnection() { Connection conn = null; try { conn = createTestOciDriverConnection(); } catch (UnsatisfiedLinkError e) { return; } Assert.assertNotNull(conn); OracleSpecifics.testConnection(conn); SQLUtil.closeQuietly(conn); conn = createSystemOciDriverConnection(); Assert.assertNotNull(conn); OracleSpecifics.testConnection(conn); SQLUtil.closeQuietly(conn); String database = TEST_PROPS.getStringProperty("oci.database"); String user = TEST_PROPS.getStringProperty("oci.user"); String password = TEST_PROPS.getStringProperty("oci.password"); conn = OracleSpecifics.createOciDriverConnection(new Builder().setDatabase(database) .setUser(user).setPassword(new GuardedString(password.toCharArray())) .build(), TestHelpers.createDummyMessages()); Assert.assertNotNull(conn); SQLUtil.closeQuietly(conn); }
static Connection createOciDriverConnection(OracleDriverConnectionInfo connInfo, ConnectorMessages cm) { String url = connInfo.getUrl(); if (url == null) { StringBuilder urlBuilder = new StringBuilder(); urlBuilder.append("jdbc:oracle:oci:@"); if (connInfo.getHost() != null) { urlBuilder.append(" if (connInfo.getPort() != null) { urlBuilder.append(":").append(connInfo.getPort()); } urlBuilder.append("/").append(connInfo.getDatabase()); } else { urlBuilder.append(connInfo.getDatabase()); } url = urlBuilder.toString(); } try { return SQLUtil.getDriverMangerConnection(THIN_AND_OCI_DRIVER_CLASSNAME, url, connInfo .getUser(), connInfo.getPassword()); } catch (RuntimeException e) { throw new ConnectorException(cm.format(MSG_OCI_CONNECTION_ERROR, null, getCauseMessage(e)), getCause(e)); } }
OracleSpecifics { static Connection createOciDriverConnection(OracleDriverConnectionInfo connInfo, ConnectorMessages cm) { String url = connInfo.getUrl(); if (url == null) { StringBuilder urlBuilder = new StringBuilder(); urlBuilder.append("jdbc:oracle:oci:@"); if (connInfo.getHost() != null) { urlBuilder.append(" if (connInfo.getPort() != null) { urlBuilder.append(":").append(connInfo.getPort()); } urlBuilder.append("/").append(connInfo.getDatabase()); } else { urlBuilder.append(connInfo.getDatabase()); } url = urlBuilder.toString(); } try { return SQLUtil.getDriverMangerConnection(THIN_AND_OCI_DRIVER_CLASSNAME, url, connInfo .getUser(), connInfo.getPassword()); } catch (RuntimeException e) { throw new ConnectorException(cm.format(MSG_OCI_CONNECTION_ERROR, null, getCauseMessage(e)), getCause(e)); } } }
OracleSpecifics { static Connection createOciDriverConnection(OracleDriverConnectionInfo connInfo, ConnectorMessages cm) { String url = connInfo.getUrl(); if (url == null) { StringBuilder urlBuilder = new StringBuilder(); urlBuilder.append("jdbc:oracle:oci:@"); if (connInfo.getHost() != null) { urlBuilder.append(" if (connInfo.getPort() != null) { urlBuilder.append(":").append(connInfo.getPort()); } urlBuilder.append("/").append(connInfo.getDatabase()); } else { urlBuilder.append(connInfo.getDatabase()); } url = urlBuilder.toString(); } try { return SQLUtil.getDriverMangerConnection(THIN_AND_OCI_DRIVER_CLASSNAME, url, connInfo .getUser(), connInfo.getPassword()); } catch (RuntimeException e) { throw new ConnectorException(cm.format(MSG_OCI_CONNECTION_ERROR, null, getCauseMessage(e)), getCause(e)); } } private  OracleSpecifics(); }
OracleSpecifics { static Connection createOciDriverConnection(OracleDriverConnectionInfo connInfo, ConnectorMessages cm) { String url = connInfo.getUrl(); if (url == null) { StringBuilder urlBuilder = new StringBuilder(); urlBuilder.append("jdbc:oracle:oci:@"); if (connInfo.getHost() != null) { urlBuilder.append(" if (connInfo.getPort() != null) { urlBuilder.append(":").append(connInfo.getPort()); } urlBuilder.append("/").append(connInfo.getDatabase()); } else { urlBuilder.append(connInfo.getDatabase()); } url = urlBuilder.toString(); } try { return SQLUtil.getDriverMangerConnection(THIN_AND_OCI_DRIVER_CLASSNAME, url, connInfo .getUser(), connInfo.getPassword()); } catch (RuntimeException e) { throw new ConnectorException(cm.format(MSG_OCI_CONNECTION_ERROR, null, getCauseMessage(e)), getCause(e)); } } private  OracleSpecifics();  }
OracleSpecifics { static Connection createOciDriverConnection(OracleDriverConnectionInfo connInfo, ConnectorMessages cm) { String url = connInfo.getUrl(); if (url == null) { StringBuilder urlBuilder = new StringBuilder(); urlBuilder.append("jdbc:oracle:oci:@"); if (connInfo.getHost() != null) { urlBuilder.append(" if (connInfo.getPort() != null) { urlBuilder.append(":").append(connInfo.getPort()); } urlBuilder.append("/").append(connInfo.getDatabase()); } else { urlBuilder.append(connInfo.getDatabase()); } url = urlBuilder.toString(); } try { return SQLUtil.getDriverMangerConnection(THIN_AND_OCI_DRIVER_CLASSNAME, url, connInfo .getUser(), connInfo.getPassword()); } catch (RuntimeException e) { throw new ConnectorException(cm.format(MSG_OCI_CONNECTION_ERROR, null, getCauseMessage(e)), getCause(e)); } } private  OracleSpecifics();   }