2

I have installed Oracle 12c on Centos 7 and I wanted to connect SQL Server 2014 using freeTDS. So, I installed the following:

  1. FreeTds.
  2. unixODBC.

Next, I configured ODBC on the Linux server so that, when I run isql dsn username password, I can connect to the MSSQL successfully and tnsping also succeed but when I run:

select * from ItemTbl@MSSQL;

I get this error:

   ERROR at line 1:
    ORA-28545: error diagnosed by Net8 when connecting to an agent
    Unable to retrieve text of NETWORK/NCR message 65535
    ORA-02063: preceding 2 lines from MSSQL

freetds.conf:

[SQLSERVERADDRESS]

        host = 192.168.1.102 # MsSQL Server IP Address
        port = 1433 # MsSQL Server Port
        tds version = 8.0 # Tds version for SQL Server 2008

odbc.ini:

[SQLDSN]
Description = SQLDSN CONNECTION
Driver = /usr/local/freetds/lib/libtdsodbc.so
Servername = SQLSERVERADDRESS
Database = Cafe11    
[ODBC Data Sources]
SQLDSN=FreeTDS 

initSQLDSN.ora:

HS_FDS_CONNECT_INFO = SQLDSN
HS_FDS_TRACE_LEVEL = 0
HS_FDS_SHAREABLE_NAME = /usr/lib64/libodbc.so
HS_LANGUAGE = AMERICAN_AMERICA.WE8ISO8859P9 
set ODBCINI=/etc/odbc.ini

listener.ora:

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = oracle.gorannet.net)(PORT = 1521))
    )
  )    
SID_LIST_LISTENER =
                (SID_DESC =
                        (SID_NAME=SQLDSN)
                        (ORACLE_HOME=$ORACLE_HOME)
                        (PROGRAM=/u01/app/oracle/product/12.1.0/db_1/bin/dg4odbc)

tnsnames.ora:

    GORANNET =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.140)(PORT = 1521))     
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = gorannet)
        )
      )    
    SQLDSN =
    (DESCRIPTION =
            (ADDRESS =
                    (PROTOCOL=TCP)
                    (HOST=192.168.10.140)
                    (PORT = 1521)
            )
            (CONNECT_DATA =
                    (SID = SQLDSN)
            )
            (HS = OK)
    )    (ENVS= LD_LIBRARY_PATH=/usr/lib64:/usr/local/freetds/lib:$ORACLE_HOME/lib)
)
)

tnsping result:

[oracle@oracle ~]$ tnsping SQLDSN
TNS Ping Utility for Linux: Version 12.1.0.1.0 - Production on 20-JUN-2015 23:52:01
Copyright (c) 1997, 2013, Oracle.  All rights reserved.
Used parameter files:
/u01/app/oracle/product/12.1.0/db_1/network/admin/sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL=TCP) (HOST=192.168.10.140) (PORT = 1521)) (CONNECT_DATA = (SID = SQLDSN)) (HS = OK))
OK (0 msec)

isql result:

[root@oracle ~]# isql SQLDSN cf11 cf11
+---------------------------------------+
| Connected!                            |
|                                       |
| sql-statement                         |
| help [tablename]                      |
| quit                                  |
|                                       |
+---------------------------------------+
SQL> select count(*) from ItemTbl;
+------------+
|            |
+------------+
| 136        |
+------------+
SQLRowCount returns 1
1 rows fetched

database link:

CREATE PUBLIC DATABASE LINK "MSSQL"
   CONNECT TO "cf11" IDENTIFIED BY VALUES ':1'
   USING 'SQLDSN';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.