@Test public void testOdbc() { assertThat( builder .withAccessType( TYPE_ACCESS_ODBC ) .withDatabaseName( "mydatabase" ) .build().getURL(), containsString( "jdbc:odbc:mydatabase" ) ); }
public String getURL() { Integer portNumber; if ( isNullOrEmpty( port ) ) { portNumber = defaultPort; } else { portNumber = Integer.valueOf( port ); } if ( isNullOrEmpty( databaseName ) ) { databaseName = DEFAULT_DB; } switch ( accessType ) { case DatabaseMeta.TYPE_ACCESS_ODBC: { return String.format( JDBC_ODBC_S, databaseName ); } case DatabaseMeta.TYPE_ACCESS_JNDI: { return URL_IS_CONFIGURED_THROUGH_JNDI; } case DatabaseMeta.TYPE_ACCESS_NATIVE: default: { Integer authMethod = 0; StringBuilder additional = new StringBuilder(); String userName = username; String password = this.password; if ( isKerberos ) { authMethod = 1; } else if ( !isNullOrEmpty( userName ) ) { additional.append( ";UID=" ); additional.append( userName ); if ( !isNullOrEmpty( password ) ) { authMethod = 3; additional.append( ";PWD=" ); additional.append( password ); } else { authMethod = 2; } } return String.format( jdbcUrlTemplate, hostname, portNumber, databaseName, authMethod, additional ); } } }
SimbaUrl { public String getURL() { Integer portNumber; if ( isNullOrEmpty( port ) ) { portNumber = defaultPort; } else { portNumber = Integer.valueOf( port ); } if ( isNullOrEmpty( databaseName ) ) { databaseName = DEFAULT_DB; } switch ( accessType ) { case DatabaseMeta.TYPE_ACCESS_ODBC: { return String.format( JDBC_ODBC_S, databaseName ); } case DatabaseMeta.TYPE_ACCESS_JNDI: { return URL_IS_CONFIGURED_THROUGH_JNDI; } case DatabaseMeta.TYPE_ACCESS_NATIVE: default: { Integer authMethod = 0; StringBuilder additional = new StringBuilder(); String userName = username; String password = this.password; if ( isKerberos ) { authMethod = 1; } else if ( !isNullOrEmpty( userName ) ) { additional.append( ";UID=" ); additional.append( userName ); if ( !isNullOrEmpty( password ) ) { authMethod = 3; additional.append( ";PWD=" ); additional.append( password ); } else { authMethod = 2; } } return String.format( jdbcUrlTemplate, hostname, portNumber, databaseName, authMethod, additional ); } } } }
SimbaUrl { public String getURL() { Integer portNumber; if ( isNullOrEmpty( port ) ) { portNumber = defaultPort; } else { portNumber = Integer.valueOf( port ); } if ( isNullOrEmpty( databaseName ) ) { databaseName = DEFAULT_DB; } switch ( accessType ) { case DatabaseMeta.TYPE_ACCESS_ODBC: { return String.format( JDBC_ODBC_S, databaseName ); } case DatabaseMeta.TYPE_ACCESS_JNDI: { return URL_IS_CONFIGURED_THROUGH_JNDI; } case DatabaseMeta.TYPE_ACCESS_NATIVE: default: { Integer authMethod = 0; StringBuilder additional = new StringBuilder(); String userName = username; String password = this.password; if ( isKerberos ) { authMethod = 1; } else if ( !isNullOrEmpty( userName ) ) { additional.append( ";UID=" ); additional.append( userName ); if ( !isNullOrEmpty( password ) ) { authMethod = 3; additional.append( ";PWD=" ); additional.append( password ); } else { authMethod = 2; } } return String.format( jdbcUrlTemplate, hostname, portNumber, databaseName, authMethod, additional ); } } } SimbaUrl( Builder builder ); }
SimbaUrl { public String getURL() { Integer portNumber; if ( isNullOrEmpty( port ) ) { portNumber = defaultPort; } else { portNumber = Integer.valueOf( port ); } if ( isNullOrEmpty( databaseName ) ) { databaseName = DEFAULT_DB; } switch ( accessType ) { case DatabaseMeta.TYPE_ACCESS_ODBC: { return String.format( JDBC_ODBC_S, databaseName ); } case DatabaseMeta.TYPE_ACCESS_JNDI: { return URL_IS_CONFIGURED_THROUGH_JNDI; } case DatabaseMeta.TYPE_ACCESS_NATIVE: default: { Integer authMethod = 0; StringBuilder additional = new StringBuilder(); String userName = username; String password = this.password; if ( isKerberos ) { authMethod = 1; } else if ( !isNullOrEmpty( userName ) ) { additional.append( ";UID=" ); additional.append( userName ); if ( !isNullOrEmpty( password ) ) { authMethod = 3; additional.append( ";PWD=" ); additional.append( password ); } else { authMethod = 2; } } return String.format( jdbcUrlTemplate, hostname, portNumber, databaseName, authMethod, additional ); } } } SimbaUrl( Builder builder ); String getURL(); }
SimbaUrl { public String getURL() { Integer portNumber; if ( isNullOrEmpty( port ) ) { portNumber = defaultPort; } else { portNumber = Integer.valueOf( port ); } if ( isNullOrEmpty( databaseName ) ) { databaseName = DEFAULT_DB; } switch ( accessType ) { case DatabaseMeta.TYPE_ACCESS_ODBC: { return String.format( JDBC_ODBC_S, databaseName ); } case DatabaseMeta.TYPE_ACCESS_JNDI: { return URL_IS_CONFIGURED_THROUGH_JNDI; } case DatabaseMeta.TYPE_ACCESS_NATIVE: default: { Integer authMethod = 0; StringBuilder additional = new StringBuilder(); String userName = username; String password = this.password; if ( isKerberos ) { authMethod = 1; } else if ( !isNullOrEmpty( userName ) ) { additional.append( ";UID=" ); additional.append( userName ); if ( !isNullOrEmpty( password ) ) { authMethod = 3; additional.append( ";PWD=" ); additional.append( password ); } else { authMethod = 2; } } return String.format( jdbcUrlTemplate, hostname, portNumber, databaseName, authMethod, additional ); } } } SimbaUrl( Builder builder ); String getURL();  }