Oracle® Objects for OLE Developer's Guide 10g Release 1 (10.1) Part Number B10118-01 |
|
See Also |
Example |
Description
This method establishes a user session to the database. It creates a new OraDatabase object using the given database name, connect string and specified options.
Usage
Set oradatabase = orasession.OpenDatabase(database_name, connect_string,options)
Set oradatabase = oraserver.OpenDatabase(connect_string, options)
Arguments |
Description |
---|---|
database_name |
The Oracle Network specifier used when connecting the data control to a database. |
connect_string |
The username and password to be used when connecting to an Oracle database. |
options |
A bit flag word used to set the optional modes of the database. If options = 0, the default mode settings will apply. The following table shows the different modes you can use, which can be combined by adding their respective values: |
Constants
Constant |
Value |
Description |
---|---|---|
ORADB_DEFAULT |
&H0& |
Visual Basic Mode (Default) Field (column) values not explicitly set are set to NULL when using AddNew or Edit. The NULL values override any server column defaults. Wait on row locks when using Edit ("SELECT... FOR UPDATE"). Non-blocking SQL functionality will not be enabled. |
ORADB_ORAMODE |
&H1& |
Oracle Mode Let Oracle database set the default field (column) values when using AddNew. The Oracle default column values are fetched again from database immediately after the insert or add operation. Note: If you use triggers, you should fetch the data again using the full Oracle Mode. |
ORADB_NOWAIT |
&H2& |
Lock No-Wait Mode Do not wait on row locks. When you use Edit to update a row that is locked by another user or process, Lock No Wait mode results in an immediate return of an error code. Note: This option only applies to OraDynaset. It has no effect on OraSqlStmt objects or ExecuteSQL calls. It only raises an error in the case of a locked row. |
ORADB_NO_REFETCH |
&H4& |
Oracle Mode (No Refetch) Like Oracle Mode, but data is not refetched to the local cache, boosting performance. Caution: Use the No Refetch mode only when you intend to insert rows without editing them, because server column defaults will cause inconsistencies between server data and the local cache. Attempting to edit after inserting in this mode will cause a "Data has been modified" (4119) error. |
ORADB_NONBLK |
&H8& |
Non-Blocking Mode This mode turns on Non-Blocking mode on SQL statement execution. Non-Blocking mode affects the SQL statements processed using the ExecuteSQL, CreateDynaset or CreateSQL methods. Note: This feature has been deprecated. |
ORADB_ENLIST_IN_MTS |
&H10& |
Enlist in MTS Mode This mode determines whether the OraDatabase object enlists in the Microsoft Transaction Server (MTS) mode. |
ORADB_ENLIST_FOR_ CALLLBACK |
&H20& |
Enlist For Callbacks Mode This mode turns on the event notification. This mode has to be enabled to receive Failover Notifications. |
These values can be found in the file oraconst.txt
. For creating a valid database alias please refer to the Oracle Net Services Administrator's Guide's Guide.
Examples of valid connect_string arguments include:
· "scott/tiger"
· "system/manager"
· "/"
Remarks
An OraConnection object is created automatically and appears within the OraConnections collection of the session. Opening a database has the effect of opening a connection but does not perform any SQL actions.
One possible connection error that could be returned is:
ORA-28001 "the password has expired"
The user may change the password using the ChangePassword method.