Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Connection string from VC++ 5.0 to an Oracle Database
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.
"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]wherenet_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.
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
![]() |
![]() |