@Test public void testCreateThinDriverConnection() { Connection conn = createTestThinDriverConnection(); Assert.assertNotNull(conn); OracleSpecifics.testConnection(conn); SQLUtil.closeQuietly(conn); conn = createSystemThinDriverConnection(); Assert.assertNotNull(conn); OracleSpecifics.testConnection(conn); SQLUtil.closeQuietly(conn); String database = TEST_PROPS.getStringProperty("thin.database"); String user = TEST_PROPS.getStringProperty("thin.user"); String password = TEST_PROPS.getStringProperty("thin.password"); String host = TEST_PROPS.getStringProperty("thin.host"); String port = TEST_PROPS.getStringProperty("thin.port"); conn = OracleSpecifics.createThinDriverConnection(new Builder().setHost(host) .setPort(port).setDatabase(database).setUser(user).setPassword( new GuardedString(password.toCharArray())).build(), TestHelpers .createDummyMessages()); Assert.assertNotNull(conn); SQLUtil.closeQuietly(conn); }
static Connection createThinDriverConnection(OracleDriverConnectionInfo connInfo, ConnectorMessages cm) { String url = connInfo.getUrl(); if (url == null) { StringBuilder urlBuilder = new StringBuilder(); urlBuilder.append("jdbc:oracle:thin:@"); if (connInfo.getHost() != null) { urlBuilder.append(" if (connInfo.getPort() != null) { urlBuilder.append(":").append(connInfo.getPort()); } } urlBuilder.append("/").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_THIN_CONNECTION_ERROR, null, getCauseMessage(e)), getCause(e)); } }
OracleSpecifics { static Connection createThinDriverConnection(OracleDriverConnectionInfo connInfo, ConnectorMessages cm) { String url = connInfo.getUrl(); if (url == null) { StringBuilder urlBuilder = new StringBuilder(); urlBuilder.append("jdbc:oracle:thin:@"); if (connInfo.getHost() != null) { urlBuilder.append(" if (connInfo.getPort() != null) { urlBuilder.append(":").append(connInfo.getPort()); } } urlBuilder.append("/").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_THIN_CONNECTION_ERROR, null, getCauseMessage(e)), getCause(e)); } } }
OracleSpecifics { static Connection createThinDriverConnection(OracleDriverConnectionInfo connInfo, ConnectorMessages cm) { String url = connInfo.getUrl(); if (url == null) { StringBuilder urlBuilder = new StringBuilder(); urlBuilder.append("jdbc:oracle:thin:@"); if (connInfo.getHost() != null) { urlBuilder.append(" if (connInfo.getPort() != null) { urlBuilder.append(":").append(connInfo.getPort()); } } urlBuilder.append("/").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_THIN_CONNECTION_ERROR, null, getCauseMessage(e)), getCause(e)); } } private  OracleSpecifics(); }
OracleSpecifics { static Connection createThinDriverConnection(OracleDriverConnectionInfo connInfo, ConnectorMessages cm) { String url = connInfo.getUrl(); if (url == null) { StringBuilder urlBuilder = new StringBuilder(); urlBuilder.append("jdbc:oracle:thin:@"); if (connInfo.getHost() != null) { urlBuilder.append(" if (connInfo.getPort() != null) { urlBuilder.append(":").append(connInfo.getPort()); } } urlBuilder.append("/").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_THIN_CONNECTION_ERROR, null, getCauseMessage(e)), getCause(e)); } } private  OracleSpecifics();  }
OracleSpecifics { static Connection createThinDriverConnection(OracleDriverConnectionInfo connInfo, ConnectorMessages cm) { String url = connInfo.getUrl(); if (url == null) { StringBuilder urlBuilder = new StringBuilder(); urlBuilder.append("jdbc:oracle:thin:@"); if (connInfo.getHost() != null) { urlBuilder.append(" if (connInfo.getPort() != null) { urlBuilder.append(":").append(connInfo.getPort()); } } urlBuilder.append("/").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_THIN_CONNECTION_ERROR, null, getCauseMessage(e)), getCause(e)); } } private  OracleSpecifics();   }