ClassPath: MEng.System.Runtime.DBConnect Parent ClassPath: MEng.Object Copyable: No Final: Yes MEng.System.Runtime.DBConnect provides access to ODBC databases. This class represents the database connection and must be used to establish the connection before any database I/O can be done. You will pass the a DBConnect object to the methods of the DBStatement class.
Nested Classes:
Enum=DBConnErrors AlreadyConnected : "The database connection has already been made"; ConnErr : ""; DisconnErr : ""; GenError : ""; NotConnected : "The database connection has not been made"; EndEnum;This enumerated type provides the errors that this class can throw. Some of them don't have any text since they are just assigned the text of the underlying C++ error that caused them.
VectorOf[KVPair] SrcList;A vector of key/value pairs used in some methods. Any vector of KVPair objects will work. This one is just required for the method parameter declarations below.
Constructors:
Constructor();There is just a default constructor available.
Final, Const Methods:
GetSrcList([Out] SrcList ToFill);Returns a list of available database sources. Each key/value pair contains the source name in the key and the description in the value. The key is what you will use later to connect to a particular source. The value is the human readable name for display.
GetSrcName() Returns MEng.String;Returns the name of the currently connected data source. If the connection has not been made yet, then this will throw the NotConnected exception.
Final, Non-Const Methods:
Connect([In] MEng.String SourceName);Attempts to connect to the indicated database source. If already connected, this will throw the AlreadyConnected exception. If the connection fails, the ConnErr exception will be thrown. Note that this connection method assumes that no user credentials are required, which generally means you are using Windows authentication for the database. If not, and you need to provide login information, use Connect2() below.
Connect2 ( [In] MEng.String SourceName , [In] MEng.String UserName , [In] MEng.String Password );Attempts to connect to the indicated database source. If already connected, this will throw the AlreadyConnected exception. If the connection fails, the ConnErr exception will be thrown. This connect method assumes you need to provide explicit user name and password information. If not, then use Connect() above.
Disconnect();Disconnects from the current database source.