Sign in or 

[ODBC_datasource_name]
Driver = driver_name
Description = description_of_data_source
attribute1 = value
.
.
attributex = value
ServerPort = myhost:1521
TargetDSN = address of database
LogonUser = username
LoginAuth = password
UID = dbuser
A sample connection in PHP would look like[myDatabase]
Driver = OOB
ServerPort = mydatabase.oracle.com:1521
TargetDSN = mydatabase
LoginUser = userID
LoginAuth = password
A sample connection in C for the same ODBC driver would look likemy $CONNECT = "DRIVER={OOB};ServerPort=mydatabase.oracle.com:1521" . "TargetDSN=mydatabase;LoginUser=userID;LoginAuth=password;"; my $db->connect("dbi:ODBC:$CONNECT", "dbuser", "dbpassword"); if (!$db) { print "$DBI::error\n$DBI::errstr\n$DBI::state"; } else { print "Successful connection"; }
You can configure the ODBC driver to fail over another database using the attribute AlternateServers to define secondary or standby databases in the event that the first database connection goes down. This feature also needs to be configured in the ODBC Driver Manager to enable failover and define the number of retry attempts and timeouts before the secondary site is selected. The failover is not limited to a single server but can be a chain of servers.#include <stdio.h> #include <sql.h> #include <sqlext.h> main() { SQLHENV env; SQLHDBC dbc; SQLSTMT stmt; SQLRETURN ret; SQLCHAR out_str[1024]; int len_out_str; /* allocate handle */ SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env); /* connect ODBC 3.x */ SQLSetEnvAttr(env, SQL_ATTR_ODBC_VERSION, (void *) SQL_OV-ODBC3, 0); /* allocate active handle */ SQLAllocHandle(SQL_HANDLE_DBC, env, &dbc); /* connect to database */ ret = SQLDriverConnect(dbc, NULL, "DSN=mydatabase", SQL_HTS, outstr, sizeof(outstr), &len_out_str), SQL_DRIVER_COMPLETE); if (SQL_SUCCEEDED(ret)) { printf(" good connection\n"); } else { printf(" connection failed\n"); }
|
pshuff |
Latest page update: made by pshuff
, Feb 18 2008, 2:05 PM EST
(about this update
About This Update
78 words added view changes - complete history) |
|
Keyword tags:
ODBC
More Info: links to this page
|
| Started By | Thread Subject | Replies | Last Post | ||
|---|---|---|---|---|---|
| sure006 | Updates to Oracle Client 10.2.0.1 ? | 1 | Dec 22 2008, 6:44 AM EST by dbapaavalan | ||
|
Thread started: Dec 17 2008, 3:59 PM EST
Watch
Are there an update/patchset to patch Oracle client 10.2.0.1 to 10.2.0.4? I have looked through Metalink but could not find anything.
|
|||||