PvOpenDatabase()
Opens a database by name and returns a handle that can be used to manipulate the database catalog.
Header File: catalog.h (See also
Header Files
)
Function First Available In Library: w3dbav90.dll (Windows), libpsqldti.so (Linux), libpsqldti.dylib (OS X) (See also
Link Libraries
)
Syntax
BTI_API PvOpenDatabase(
BTI_LONG
hConnection,
BTI_CHAR_PTR
dbName
,
BTI_CHAR_PTR
dbUser,
BTI_CHAR_PTR
dbPassword,
BTI_WORD_PTR
dbHandle
);
Arguments
In
hConnection
Connection handle that identifies the server. Connection handles are obtained with the
PvConnectServer()
function.
In
dbName
Name of the database.
In
dbUser
Database user name if security is defined.
In
dbPassword
Database password if security is defined.
Out
dbHandle
Returned handle to the database.
Return Values
P_OK
The operation was successful.
P_E_INVALID_HANDLE
Invalid connection handle.
P_E_NULL_PTR
Call with NULL pointer.
P_E_ACCESS_RIGHT
Insufficient access right for the operation.
P_E_FAIL
Failed to open the database for other reasons.
PCM_errSessionSecurityError
Invalid user name or password.
Remarks
The following preconditions must be met:
•
DTI session started by calling
PvStart()
•
Connection established by
PvConnectServer()
or if you are performing the operation on a local machine, P_LOCAL_DB_CONNECTION may be used as the connection handle.
•
If the database has security enabled, you must specify a valid database user name and password. Security for the returned database handle is enforced based on the access rights defined for the database, and should match behavior seen in SQL or ODBC access methods.
See Also
PvStart()
PvConnectServer()
PvGetDbFlags()
PvModifyDatabase()
PvCloseDatabase()
PvDropDatabase()
PvDisconnect()
PvStop()