/// <summary> /// Opens a connection to the specified database /// </summary> /// <param name="ADataBaseRDBMS">the database functions for the selected type of database</param> /// <param name="AServer">The Database Server</param> /// <param name="APort">the port that the db server is running on</param> /// <param name="ADatabaseName">the database to connect to</param> /// <param name="AUsername">The username for opening the connection</param> /// <param name="APassword">The password for opening the connection</param> /// <param name="AConnectionString">The connection string; if it is not empty, it will overrule the previous parameters</param> /// <param name="AStateChangeEventHandler">for connection state changes</param> /// <returns>Opened Connection (null if connection could not be established). /// </returns> public static DbConnection GetConnection(IDataBaseRDBMS ADataBaseRDBMS, String AServer, String APort, String ADatabaseName, String AUsername, ref String APassword, ref String AConnectionString, StateChangeEventHandler AStateChangeEventHandler) { return(ADataBaseRDBMS.GetConnection(AServer, APort, ADatabaseName, AUsername, ref APassword, ref AConnectionString, AStateChangeEventHandler)); }
/// <summary> /// Clears (empties) the Connection Pool that a RDBMS driver provides for all connections *that were created using /// the Connection String that is associated with <paramref name="ADBConnection"/>*. In case an RDBMS type doesn't /// provide a Connection Pool nothing is done and the Method returns no error. /// </summary> /// <remarks> /// THERE IS NORMALLY NO NEED TO EXECUTE THIS METHOD - IN FACT THIS METHOD SHOULD NOT GET CALLED as it will have a /// negative performance impact when subsequent DB Connections are opened! Use this Method only for 'unit-testing' /// DB Connection-related issues (such as that DB Connections are really closed when they ought to be). /// </remarks> public static void ClearConnectionPool(IDataBaseRDBMS ADataBaseRDBMS, DbConnection ADBConnection) { ADataBaseRDBMS.ClearConnectionPool(ADBConnection); }
/// <summary> /// Opens a connection to the specified database /// </summary> /// <param name="ADataBaseRDBMS">the database functions for the selected type of database</param> /// <param name="AServer">The Database Server</param> /// <param name="APort">the port that the db server is running on</param> /// <param name="ADatabaseName">the database to connect to</param> /// <param name="AUsername">The username for opening the connection</param> /// <param name="APassword">The password for opening the connection</param> /// <param name="AConnectionString">The connection string; if it is not empty, it will overrule the previous parameters</param> /// <param name="AStateChangeEventHandler">for connection state changes</param> /// <returns>Opened Connection (null if connection could not be established). /// </returns> public DbConnection GetConnection(IDataBaseRDBMS ADataBaseRDBMS, String AServer, String APort, String ADatabaseName, String AUsername, ref String APassword, String AConnectionString, StateChangeEventHandler AStateChangeEventHandler) { FConnectionString = AConnectionString; return ADataBaseRDBMS.GetConnection(AServer, APort, ADatabaseName, AUsername, ref APassword, ref FConnectionString, AStateChangeEventHandler); }