[unixODBC-dev] Get Oracle Database name from .odbc.ini

anand.vasudevan at wipro.com anand.vasudevan at wipro.com
Fri Nov 11 06:47:42 GMT 2005


Hi,

I found SQLDriverConnect might be of help to me.
It returns the database name correctly for Ingres database. But it
doesn't return for Oracle.

I have the following in my .odbc.ini file for Ingres and Oracle: -

[INGDSN]
Description             = Ingres System DSN
Driver          = Ingres
Database                = test
ServerType             = Ingres
Server    =  (local)
ReadOnly                = No
RowVersioning           = No
ShowSystemTables                = No
ShowOidColumn           = No
FakeOidIndex            = No
ConnSettings            =


[ORADSN]	/**** DSN ****/
Driver                  = ORACLE
Database                = TEMP
User                    = scott
Password                = tiger
METADATA_ID             = 0
ENABLE_USER_CATALOG     = 1
ENABLE_SYNONYMS         = 1

The following works fine for Ingres but not Oracle: -

For Ingres: -

SQLDriverConnect(dbconhnd, NULL, "DSN=INGDSN;",100, conStr, 2000,
conStrLen, SQL_DRIVER_NOPROMPT);

Output is: -

Output Connect String->
DSN=INGDSN;SERVER=sun;DATABASE=test;SERVERTYPE=INGRES

For Oracle:-

SQLDriverConnect(dbconhnd, NULL, "DSN=ORADSN;",100, conStr, 2000,
conStrLen, SQL_DRIVER_NOPROMPT);

Output is:-
Output Connect String->
DSN=ORADSN;

Sql.log output is

[ODBC][14626][SQLDriverConnect.c][678]
                Entry:
                        Connection = 24930
                        Window Hdl = 0
                        Str In = [DSN=ORADSN;][length = 100]
                        Str Out = ffbff1f8
                        Str Out Max = 2000
                        Str Out Ptr = 0
                        Completion = 0
                UNICODE Using encoding ASCII 'char' and UNICODE
'UCS-2-INTERNAL'

[ODBC][14626][SQLDriverConnect.c][1487]
                Exit:[SQL_SUCCESS]
                        Connection Out [[DSN=ORADSN;][length = 11
(SQL_NTS)]]

Is there anything that is missing in the API call or my oracle DSN
entries?
Any kind of help would be highly appreciated.
Thanks in advance.

Regards
Anand Vasudevan,
Sr. Project Engineer,
Wipro Technologies.

-----Original Message-----
From: unixodbc-dev-bounces at easysoft.com
[mailto:unixodbc-dev-bounces at easysoft.com] On Behalf Of
anand.vasudevan at wipro.com
Sent: Friday, November 11, 2005 10:32 AM
To: unixodbc-dev at easysoft.com
Subject: [unixODBC-dev] Get Oracle Database name from .odbc.ini


Hi,

In our application we need to get the Oracle database name from
.odbc.ini for a given DSN.
Is there an API in ODBC or in the source code of unixODBC where we get
the database name for a given DSN in the .odbc.ini file.

[testDSN]	/**** DSN ****/
Driver                  = ORACLE
Database                = TEMP		/*** Want the dbname from here
**/
User                    = scott
Password                = tiger
METADATA_ID             = 0
ENABLE_USER_CATALOG     = 1
ENABLE_SYNONYMS         = 1

Thanks in advance.

Regards
Anand Vasudevan,
Sr. Project Engineer,
Wipro Technologies



Confidentiality Notice

The information contained in this electronic message and any attachments
to this message are intended
for the exclusive use of the addressee(s) and may contain confidential
or privileged information. If
you are not the intended recipient, please notify the sender at Wipro or
Mailadmin at wipro.com immediately
and destroy all copies of this message and any attachments.

_______________________________________________
unixODBC-dev mailing list
unixODBC-dev at easysoft.com
http://mail.easysoft.com/mailman/listinfo/unixodbc-dev



Confidentiality Notice

The information contained in this electronic message and any attachments to this message are intended
for the exclusive use of the addressee(s) and may contain confidential or privileged information. If
you are not the intended recipient, please notify the sender at Wipro or Mailadmin at wipro.com immediately
and destroy all copies of this message and any attachments.




More information about the unixODBC-dev mailing list