Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Connection string from VC++ 5.0 to an Oracle Database

Re: Connection string from VC++ 5.0 to an Oracle Database

From: Ervin Fried <ervinf_at_netcom.ca>
Date: Wed, 15 Jul 1998 18:22:35 GMT
Message-ID: <6ois1b$25g_002@nntp.netcom.ca>


In article <6ohuqe$p0n$1_at_platane.wanadoo.fr>, "Macao" <alain.dourille.AENLEVER_NOSPAMMER_at_wanadoo.fr> wrote:
>I have to access a Oracle Database from a VC++ 5.0 program. I have, of
>course, to connect to that database
>What are the ways to do that ?
>I think I have to use ODBC, but I don't find the Connection string format to
>connect to.
>
>Can someone help me please ?
>

it depens upon your OBBC driver

look in the help file for your driver.

for MS Oracle driver ver 2.00.65... (msorcl10.hlp)

Connection String Attributes

Some applications may require a connection string that specifies data source connection information instead of using a dialog box to obtain this information. The connection string is made up of a number of attributes that specify how a driver connects to a data source. An attribute identifies a specific piece of information that the driver needs to know before it can make the appropriate data source connection. Each driver may have a different set of attributes but the connection string format is always the same. A connection string has the following format:

“DSN=data-source-name[;CONNECTSTRING=value] [;PWD=value] [;UID=value] [;<Attribute>=<value>]”

You must specify the data-source-name. However, all other attributes are optional. If you do not specify an attribute, that attribute defaults to the one that you specified in the DSN tab of the ODBC Data Source Administrator. The attribute value might be case-sensitive.

The attributes for the connection string are as follows:

Attribute       Description     Default value
DSN     The data source name. This name is listed in the ODBC Drivers tab of 
the ODBC Data Sources Administrator.       “”
PWD     The password for the Oracle server that you want to access.     “”
CONNECTSTRING   The connect string for the Oracle Server that you want to 
access.       “”
UID     The Oracle Server user name. Depending on your system, this attribute 
may not be optional—that is, certain databases and tables may require this 
attribute for security purposes.       “”
BUFFERSIZE      The buffer size used when fetching columns.     40000
ROWLIMIT        The cache size used when performing an extended fetch.  400
SYSTEMTABLE     When this value is .T., (true), views are recognized as SQL 
tables.     .F.

SYNONYMCOLUMNS When this value is .T., (true), SQL columns return columns for Oracle Synonyms; otherwise SQL columns return only columns for tables and views. The ODBC Driver provides faster access when this value is not set. T.
REMARKS When this value is .T., (true), Remarks columns are returned for the result. The ODBC Driver provides faster access when this value is not set. .F. For example, a connection string that connects to the Employees data source using the employees server, mickey host machine, and TCP/IP network would have the following attributes in the connection string:

"DSN=Employees;CONNECTSTRING=t:mickey:employees;UID=cindy;PWD=secret"

for Oracle ODBC driver ver 1.15 (Drvora32.hlp)

The connection string for the Oracle7 32-bit ODBC driver uses the following keywords.

Keyword Description

DSN     The name of the data source.
DBQ     An Oracle connect string of the form:net_prefix:hostname[:SID]where 
net_prefix specifies the SQL*Net driver to use, hostname specifies the name or alias of the server on which Oracle7 RDBMS resides, and SID is the optional system ID of the database you want to use on the server. Some common
net_prefixes are:B:        NetBIOS
D:      DECnet
P:      Named pipes
T:      TCP/IP
X:      SPX/IPXIf SQL*Net V2 client is installed, SQL*Net V2 connect string 
can also be used.For more information, see the SQL*Net documentation. 
UID     The user login ID.
PWD     The user-specified password.

For example, to connect to the Human Resources data source on the server HRSRVR using the NetBIOS SQL*Net driver, the login ID Smith, and the password Sesame, you would use the following connection string:

DSN=Human Resources;DBQ=b:HRSRVR;UID=Smith;PWD=Sesame

"ODBC;DSN=" & strDSN & ";DBQ=" & strDB & ";;", str & "." & t

>thanks a lot.
>
>Loïc GROSMAN, from MACAO, France.
>
>
Received on Wed Jul 15 1998 - 13:22:35 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US