Interface IJdbcConnectionProvider

All Known Subinterfaces:
IJdbcConnectionProvider2
All Known Implementing Classes:
AbstractJdbcConnectionProvider, HyperSqlFileJdbcConnectionProvider, HyperSqlServerJdbcConnectionProvider, MySql5JdbcConnectionProvider

public interface IJdbcConnectionProvider
An interface for generically providing JDBC connections. The intention of this interface is to encapsulate all database specific issues of constructing a URL or the driver name.

Clients of IJdbcConnectionProvider simply call getConnection(String, String, String, String, String, String...) in order to get a valid driver URL constructed and passed to DriverManager.

Author:
ralph
  • Method Summary

    Modifier and Type Method Description
    java.sql.Connection getConnection​(java.lang.String host, java.lang.String port, java.lang.String dbName, java.lang.String dbLogin, java.lang.String dbPassword, java.lang.String... addOnArgs)
    Provide and open the connection for the given arguments.
    java.lang.String getDbDriverClassName()
    Returns the class name of the database driver.
    java.lang.String getDriverUrl​(java.lang.String host, java.lang.String port, java.lang.String dbName, java.lang.String dbLogin, java.lang.String dbPassword, java.lang.String... addOnArgs)
    Constructs the driver's URL from the arguments.
  • Method Details

    • getConnection

      java.sql.Connection getConnection​(java.lang.String host, java.lang.String port, java.lang.String dbName, java.lang.String dbLogin, java.lang.String dbPassword, java.lang.String... addOnArgs) throws java.sql.SQLException
      Provide and open the connection for the given arguments.
      Parameters:
      host - the host of the database
      port - the port of the database (some DB use names as port information)
      dbName - name of database
      dbLogin - database login
      dbPassword - database password
      addOnArgs - additional arguments to be processed by the driver
      Returns:
      an opened connection if successful
      Throws:
      java.sql.SQLException - when the connection cannot be opened
    • getDbDriverClassName

      java.lang.String getDbDriverClassName()
      Returns the class name of the database driver. The method shall return null in case of any errors.
      Returns:
      the dbDriverClassName
      Since:
      1.2.9
    • getDriverUrl

      java.lang.String getDriverUrl​(java.lang.String host, java.lang.String port, java.lang.String dbName, java.lang.String dbLogin, java.lang.String dbPassword, java.lang.String... addOnArgs)
      Constructs the driver's URL from the arguments. The method shall return null in case of any problems or throw an exception.
      Parameters:
      host - the host of the database
      port - the port of the database (some DB use names as port information)
      dbName - name of database
      dbLogin - database login
      dbPassword - database password
      addOnArgs - additional arguments for the driver URL
      Returns:
      the URL for the driver or null