Sql-server – Unable to access tables in sql server using oracle dblink

dblinkoraclesql server

I have created a Heterogeneous connection between oracle and sql server. and tested with below query,

SELECT * FROM sys.tables@SQLSERVER; 

Then I have created a new Database in SQL server called "TESTCONNECTION" and created a table called "dbo.TEST". After that I changed the default database of DSN to "TESTCONNECTION". But below query fail with following error message.

SELECT * FROM dbo.TEST@SQLSERVER;

[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name
'DBO.TEST'. {42S02,NativeErr = 208}[Microsoft][ODBC SQL Server
Driver][SQL Server]Statement(s) could not be prepared.
{42000,NativeErr = 8180

}

How to overcome this error and access tables created under "TESTCONNECTION".

Best Answer

One potential cause could be that the default database listed for the user account being used to connect to SQL Server is pointed to the wrong database. Adjust this on the SQL Server side and see if that resolves your issue.

enter image description here