Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

dg4odbc, unixODBC, freeTDS -> connection problems to MS SQL 2008

943178Jun 12 2012 — edited Jun 13 2012
I am trying to set up a database link between my 64bit Oracle 11g running on CentOS 6.2 and my MS SQL 2008 server running on MS Windows server 2003. I have installed the following -

freeTDS - version 0.91 (64 bit)
unixODBC - version 2.3.1 (64 bit)

I have successfully configured ODBC and freeTDS so that I can connect using isql and query my MSSQL database. The problem I am having is connecting Oracle to MSSQL, I am sure it is a simple configuration error but I have been going round in circles with this and hope someone can help!

-----
freetds.conf

[global]

timeout = 10
connect timeout = 10
text size = 64512

[CERM]
host = 192.168.xxx.xxx
port = 1101
tds version = 7.2
instance = SSLSQLDB
dump file = /tmp/dump.log

-----
odbc.ini

[ODBC Data Sources]
CERM=TDS connection


[CERM]
Servername = CERM
Description = TDS connection
Driver = /usr/local/lib/libtdsodbc.so
UsageCount = 1
FileUsage = 1

[ODBC]
Trace=255

-----
odbcinst.ini

[TDS]
Description = FreeTDS driver for MS SQL
Driver = /usr/local/lib/libtdsodbc.so
Setup = /usr/lib64/libtdsS.so
Trace = Yes
TraceFile = /tmp/freetd.log
FileUsage = 1

[FreeTDS]
Description = FreeTDS driver for MS SQL
Driver = /usr/local/lib/libtdsodbc.so
Setup = /usr/lib64/libtdsS.so
Trace = Yes
TraceFile = /tmp/freetd.log
FileUsage = 1

(Because I have put the actual path to the driver in the odbc.ini file I don;t believe the odbcinst.ini file is actually used)

-----

inithscerm.ora

#
# This is a sample agent init file containing the HS parameters that
# are needed for an ODBC Agent.
#
# HS init parameters
#
HS_FDS_CONNECT_INFO=CERM
HS_FDS_TRACE_LEVEL=255
#HS_FDS_TRACE_FILE_NAME = /tmp/hsodbcsql.trc
HS_FDS_SHAREABLE_NAME=/usr/local/lib/libodbc.so
HS_FDS_SUPPORT_STATISTICS=FALSE


set ODBCINI=/usr/local/etc/odbc.ini

(my odbc.ini file is located in /usr/local/etc)

-----
listener.ora


# listener.ora Network Configuration File: /usr/oracle/product/network/admin/listener.ora
# Generated by Oracle configuration tools.

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = ssl-oracle.domain)(PORT = 1521))
)
)

ADR_BASE_LISTENER = /usr/oracle

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC=
(SID_NAME=hscerm)
(ORACLE_HOME=/usr/oracle/product)
(PROGRAM=dg4odbc)
(ENVS=LD_LIBRARY_PATH = /usr/local/lib:$ORACLE_HOME/lib)
)
(SID_DESC=
(SID_NAME=PROD)
(ORACLE_HOME=/usr/oracle/product)
)

)

-----
tnsnames.ora

# tnsnames.ora Network Configuration File: /usr/oracle/product/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

PROD =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ssl-oracle.domain)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = PROD.DOMAIN)
)
)


hscerm=
(DESCRIPTION=
(ADDRESS=(PROTOCOL=TCP)(HOST=ssl-oracle.domain)(PORT=1521))
(CONNECT_DATA= (SID=hscerm))
(HS=OK)
)


-----

right - I can tnsping my hscerm instance and that returns ok so I'm fairly sure the configuration is fine for both tnsnames.ora and listener.ora. I can isql connect to the ODBC defined name for the the MSSQL database. but when I create a database link in Oracle and then test it I get the following trace output :-

[ODBC][14030][1339512618.356535][SQLSetConnectAttrW.c][332]
Entry:
Connection = 0x2054640
Attribute = SQL_ATTR_AUTOCOMMIT
Value = (nil)
StrLen = -5
[ODBC][14030][1339512618.356616][SQLSetConnectAttrW.c][616]
Exit:[SQL_SUCCESS]
[ODBC][14030][1339512618.356984][SQLDriverConnectW.c][290]
Entry:
Connection = 0x2054640
Window Hdl = (nil)
Str In = [DNCR;I=APDagj20][length = 30]
Str Out = 0x2053408
Str Out Max = 1024
Str Out Ptr = 0x7fff6d305770
Completion = 0
[ODBC][14030][1339512618.357030][SQLDriverConnectW.c][500]Error: IM002
[ODBC][14030][1339512618.357115][SQLGetDiagRecW.c][508]
Entry:
Connection = 0x2054640
Rec Number = 1
SQLState = 0x7fff6d3053d0
Native = 0x7fff6d3051c4
Message Text = 0x7fff6d3051d0
Buffer Length = 510
Text Len Ptr = 0x7fff6d305420
[ODBC][14030][1339512618.357153][SQLGetDiagRecW.c][550]
Exit:[SQL_SUCCESS]
SQLState = IM002
Native = 0x7fff6d3051c4 -> 0
Message Text = [[unixODBC][Driver Manager]Data source name not found, and no default driver specified]
[ODBC][14030][1339512618.357197][SQLGetDiagRecW.c][508]
Entry:
Connection = 0x2054640
Rec Number = 2
SQLState = 0x7fff6d3053d0
Native = 0x7fff6d3051c4
Message Text = 0x7fff6d3051d0
Buffer Length = 510
Text Len Ptr = 0x7fff6d305420
[ODBC][14030][1339512618.357228][SQLGetDiagRecW.c][550]
Exit:[SQL_NO_DATA]
[ODBC][14030][1339512618.357291][SQLDisconnect.c][208]
Entry:
Connection = 0x2054640
[ODBC][14030][1339512618.357321][SQLDisconnect.c][237]Error: 08003
[ODBC][14030][1339512618.357387][SQLFreeHandle.c][284]
Entry:
Handle Type = 2
Input Handle = 0x2054640

-----
Now I can clearly see the error "Data source name not found, and no default driver specified" which according to all the documentation means that the entry HS_FDS_CONNECT_INFO=CERM does not match the entry in my odbc.ini file ([CERM]) but for the life of me I can;t see why they don;t match ??

Any help greatly received.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 11 2012
Added on Jun 12 2012
6 comments
3,948 views