Connecting sqlserver to oracle Microsoft SQL Server error 7303 - sql-server

I have the following problem, I have a server with O.S. Windows Server 2012 R2 64 bit, in this server I have installed a Database Microsoft Sql server 2014, and I'm trying to connect it to an Oracle Database 10.1.0.2.0 installed on an other server.
On my server I have installed a 64 bit Oracle Client 11.2, and 64 bit Oracle ODAC 11.2.
I tested my Oracle client installation connecting to my Oracle DB, using sqlplus, tnsping and configuring and testing 64 bit ODBC data source.
Now I have created a linked server to my Oracle DB, and I'm tryng to test it, but I have the following error:
Microsoft.SqlServer.Connectioninfo
Cannot initialize the data source object of OLE DB provider "MSDAORA"
for linked server ...
OLE DB provider "MSDAORA" for linked server .... returned message
"It's impossible to find Oracle network components and Client...."
Microsoft SQL Server, Error: 7303.
What's the problem? Why SQL server doesn't find Oracle components and client, while it is installed on the server and useful?

Related

Connecting to SQL2000 from SSIS

I can't get my SSIS package to connect to a SQL2000 database - I keep getting
SQL Server does not exist or access denied.
I've tried connection strings like the following:
<ConfiguredValue_1>Data Source=xxx;Initial Catalog=xxx;Provider=SQLNCLI10.1;User ID=xxx;Password=xxx;</ConfiguredValue_1>
<ConfiguredValue_2>Data Source=xxx;Initial Catalog=xxx;Provider=SQLOLEDB.1;Integrated Security=SSPI;</ConfiguredValue_2>
<ConfiguredValue>Data Source=xxx;Initial Catalog=xxx;Provider=SQLOLEDB.1;User ID=xxx;Password=xxx;</ConfiguredValue>
Actually, the SQLNCLI10.1 option gives:
The requested OLE DB provider SQLNCLI10.1 is not registered
For the Integrated Security option, I have set up a proxy & credential that the step is using, which is the same as my login.
However, I can connect to the database using Windows Authentication or a SQL username via an SSMS query window. What am I missing?
I will try to give some suggestions:
(1) Download SQL Server 2008 Native client
To download SQL Server Native Client 10 you should download and install the following package which is a part of the SQL Server 2008 feature pack:
Download SQL Server Native Client
Microsoft® SQL Server® 2008 R2 Feature Pack
Also try removing .1 from provider name: SQLNCLI10
(2) Use Microsoft OLE DB Driver for SQL Server
OLE DB Driver for SQL Server is a stand-alone data access application programming interface (API), used for OLE DB, that was introduced in SQL Server 2005 (9.x)
This provider can be used to connect to SQL Server 2000 instance.
Official documentation: Microsoft OLE DB Driver for SQL Server
Download link: Microsoft® OLE DB Driver 18 for SQL Server (i think it can be found in SSIS providers list without the need to download)
Connection string example:
Provider=sqloledb;Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;
(3) Use ODBC connections
Another way to connect to SQL Server 2000 is using ODBC Driver for SQL Server
The Microsoft ODBC Drivers for SQL Server are stand-alone ODBC drivers which provide an application programming interface (API) implementing the standard ODBC interfaces to Microsoft SQL Server.
Official documentation: Microsoft ODBC Driver for SQL Server on Windows
Download page: Download ODBC Driver for SQL Server
Connection string example:
Driver={SQL Server};Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;
(4) Using SQL Native Client 9.0 OLE DB Provider
Try using the version 9.0 of OLEDB provider which works only for SQL Server 7.0, 2000, 2005 version.
Connection string example:
Provider=SQLNCLI;Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;
References
SQL Server 2000 connection strings
Microsoft SQL Server ODBC Driver connection strings

SQL Server native client 11.0 does not support connection to SQL Server 2000 or earlier version

I'm trying to get data from a SQL Server 2000 database and insert it into another database in SQL Server 2012.
The linked server was created, but I get an error when I use SELECT from one of the tables.
Something like this:
SELECT *
FROM linked_server_name.database_name.schema.table_name
Error:
SQL Server native client 11.6 does not support connection to SQL Server 2000 or earlier versions
Any idea can be helpful. Thanks.
Use the "Microsoft OLE DB Provider for SQL Server" (SQLOLEDB) OLE DB provider, not SQL Server Native Client 11.0" (SQLNCLI11) OLE DB provider to access SQL Server 2000. Although SQLOLEDB is deprecated, you'll need to use it for SQL Server 2000, which is unsupported anyway.
Here is how I fixed it today using SQL Server 2014 on Windows 8.1 Pro. I was trying to add a Linked Server for a remote SQL Server 2000 instance. While using the SQL Server Native Client 11.0 I received the same error as the OP.
Then I tried creating an ODBC data source on my machine, using "ODBC Driver 11 for SQL Server" and got the following error. "ODBC Driver 11 for SQL Server does not support connections to SQL Server 2000 or earlier versions"
At last I created a new Data Source using "SQL Server" driver in the New Data Source wizard, NOT "SQL Server Native Client 11.0" driver. The Data Source was successfully created. And then I used this newly created data source as "Product name" and "Data source" both, in "New Linked Server" dialog box in the Management Studio, and selected "Microsoft OLE DB Provider for ODBC Drivers" as the provider. In the "Linked server" field, I put the IP address of the remote SQL Server. It successfully created a new Linked Server in my SQL Server 2014 Management Studio. I hope this answer will help anyone who lands here in search of an answer for this issue.

Differences Between Drivers for ODBC Drivers

I was setting up the System DSN (64 bit) for my database in SQL server 2016 with Windows 10 64 bit pro. While I was asked to choose the driver to set up a data source, there are the following selections:
ODBC Driver 13 for SQL Server
SQL Server
SQL Server Native Client 11.0
SQL Server Native Client RDA 11.0
It seemed I can set up the data source with all of these drivers. Then which one should I choose in terms of speed and efficiency? What's the difference between them?
Thanks,
Jason
ODBC Driver for SQL Server
ODBC is the primary native data access API for applications written in C,C++, PHP, Python and others for connecting to SQL Server.
It's widely used in data integration scenarios.
Also, it's preferred if you are developing application on Windows and deploying it to Linux .
SQL Server
The full name of SQL Server Driver is SQL Server ODBC Driver. It’s an old driver since sql 2000.
You can use it to connect to SQL Server 2016, but you will not be able to access new features and functionality of SQL Server 2016
SQL Server Native Client
SQL Server Native Client is containing both the SQL OLE DB provider and SQL ODBC driver to support native connectivity to SQL Server and support all features of sql server 2016.
It's the best in windows environment
SQL Server Native Client RDA
Remote data access (RDA) in Microsoft SQL Server Compact 3.5 lets an application access data from a remote SQL Server database table.
It can also store, read, and update that data in SQL Server Compact 3.5, and then update the original SQL Server table.
RDA will be removed in the future release, so avoid using it.
So choose sql driver based on the criteria above.
Microsoft ODBC Driver for SQL Server (MSODBCSQL)
This driver was announced in 2013 as the successor to SQL Server Native Client. It is installed with recent SQL Server versions. There are standalone installers for clients. Driver history for Microsoft SQL Server recommends this driver in preference to "SQL Server" and "SQL Server Native Client" for ODBC. Added features over "SQL Server Native Client": driver-aware connection pooling, connection resiliency, asynchronous execution (polling), support for Always Encrypted, recent SQL Server compatibility (including Azure SQL), and more supported operating systems (including Linux and macOS). You can follow current development on the SQL Server Blog (with previous posts on the SQLNCli team blog).
Driver={ODBC Driver XX for SQL Server} (XX replaced by driver version. See System Requirements, Installation, and Driver Files.)
SQL Server Native Client (SQLNCLI)
Introduced with SQL Server 2005 and ships with SQL Server (also installable via sqlncli.msi from SQL Server feature packs). Added features over "SQL Server": Multiple active result sets (MARS), user-defined data types (UDT), query notifications, snapshot isolation, and XML data type support. The version for SQL Server 2008 also added support for the new date and time types.
Driver={SQL Server Native Client} (SQL Server 2005)
Driver={SQL Server Native Client 10.0} (SQL Server 2008)
Driver={SQL Server Native Client 11.0} (SQL Server 2012 and later)
SQL Server Native Client RDA
Remote Data Access (RDA) is a SQL Server Compact feature which "lets an application access data from a remote SQL Server database table." I can't find much documentation, but it appears this driver was intended to support replication scenarios with Compact Edition.
SQL Server (SQLSRV32)
Included in Microsoft Data Access Components (MDAC) (now called Windows Data Access Components (WDAC)). This driver is available by default on Windows (since 98 and NT 4.0).
Driver={SQL Server}
To check which drivers you have installed, fire up an powershell (32/64 bit - depending which driver architecture you want to use) and run
OLEDB
(New-Object System.Data.OleDb.OleDbEnumerator).GetElements() | select SOURCES_NAME, SOURCES_DESCRIPTION
ODBC
Get-OdbcDriver | select Name,Platform
Overview
https://learn.microsoft.com/en-us/sql/connect/connect-history#odbc
There are three distinct generations of Microsoft ODBC drivers for SQL Server.
The first "SQL Server" ODBC driver still ships as part of Windows Data Access Components. It is not recommended to use this driver for new development.
Starting in SQL Server 2005, the SQL "Server Native Client 10.x/11.x/12.x" includes an ODBC interface and is the ODBC driver that shipped with SQL Server 2005 through SQL Server 2012. It is not recommended to use this driver for new development.
After SQL Server 2012, the Microsoft ODBC Driver for SQL Server is the driver that is updated with the most recent server features going forward.
SQL Server
It's the old one from the MDAC-package (https://support.microsoft.com/en-us/help/899456) which now (since XP/2003) comes with the Windows-OS.
https://learn.microsoft.com/en-us/sql/connect/connect-history#mdacwdac-releases
https://learn.microsoft.com/en-us/sql/relational-databases/native-client/applications/updating-an-application-to-sql-server-native-client-from-mdac
...starting with Windows Vista, the data access components are now called Windows Data Access Components, or Windows DAC). Although both provide native data access to SQL Server databases, SQL Server Native Client has been specifically designed to expose the new features of SQL Server 2005 (9.x), while at the same time maintaining backward compatibility with earlier versions.
SQL Server Native Client
https://learn.microsoft.com/en-us/sql/connect/connect-history#odbc
SQL Server Native Client is a stand-alone library that is used for both OLE DB and ODBC. SQL Server Native Client (often abbreviated SNAC) was included in SQL Server 2005 through 2012. SQL Server Native Client can be used for applications that need to take advantage of new features introduced in SQL Server 2005 through SQL Server 2012. (Microsoft/Windows Data Access Components are not updated for these new features in SQL Server.) For new features beyond SQL Server 2012, SQL Server Native Client will not be updated. Switch to the Microsoft ODBC Driver for SQL Server or the Microsoft OLE DB Driver for SQL Server if you want to take advantage of new SQL Server features going forward.
SQL Server Native Client RDA
Came with .NET Compact Framework 3.5
ODBC Driver for SQL Server
https://learn.microsoft.com/en-us/sql/connect/connect-history#odbc
After SQL Server 2012, the primary ODBC driver for SQL Server has been developed and released as the Microsoft ODBC Driver for SQL Server.
MSOLEDBSQL - Microsoft OLE DB Driver for SQL Server
This driver has been deprecated and later undeprecated:
https://learn.microsoft.com/en-us/sql/connect/oledb/oledb-driver-for-sql-server#3-microsoft-ole-db-driver-for-sql-server-msoledbsql
The new OLE DB provider is called the Microsoft OLE DB Driver for SQL Server (MSOLEDBSQL). The new provider will be updated with the most recent server features going forward. To use the new Microsoft OLE DB Driver for SQL Server in existing applications, you should plan to convert your connection strings from SQLOLEDB or SQLNCLI, to MSOLEDBSQL.
https://blogs.msdn.microsoft.com/sqlnativeclient/2018/03/30/released-microsoft-ole-db-driver-for-sql-server/
Summary
Try to use the future proof drivers:
ODBC - https://learn.microsoft.com/en-us/sql/connect/odbc/bug-fixes
OLEDB - https://learn.microsoft.com/en-us/sql/connect/oledb/release-notes-for-oledb-driver-for-sql-server
SQL Server Native client vs .NET Framework Data Provider for ODBC
It seems that for last version for SQL Server Native client, the Microsoft® SQL Server® 2012 Native Client also named as SQL Server native client 11.0.
Doesn’t support new feature in SQL Server 2014 or later
Note that SNAC 11 does not support features released with SQL Server
2014 and SQL Server 2016 that were not available as part of SQL Server
2012, such as Transparent Network IP Resolution, Always Encrypted,
Azure AD Authentication, Bulk Copy and Table Value Parameters.
https://blogs.msdn.microsoft.com/sqlreleaseservices/snac-lifecycle-explained/
You have to use Microsoft® ODBC Driver 11 or 13 for SQL Server to enjoy new feature in SQL Server 2014 or later
As mentioned earlier in this post, the later version of the ODBC driver (13 and after) give you access to the more advanced features available in SQL Server 2014, 2016, etc.
However, there are conflicting Microsoft posts on whether the ODBC Version 17 driver supports SQL Server 2012 or not.
This link says you have to use ODBC 13 for SQL Server 2012:
SQL Server Driver Versions
However, if you look at the download for the ODBC Version 17, it indicates it support for SQL Server 2012 (and older versions of SQL Server).
Microsoft® ODBC Driver 17 for SQL Server® - Windows, Linux, & macOS
So perhaps the ODBC Version 17 driver is (at least) backwards compatible with older versions of SQL Server.
Hope this helps!
Jon

How is ADO related to OLE DB?

Question
How is ADO related to OLE DB and what does mean the annoucement of Microsoft to drop OLE DB Providers for SQL Server mean?
Does it mean that if we switch to ADO it will not work with SQL Server 2014 and never?
Microsoft has announced the deprecation of the SQL Server Native
Client OLE DB provider, and that SQL Server 2012 is the last version
of SQL Server to support the provider.
Context
We are a Delphi shop. We are on Delphi 7 and BDE and want to migrate away from BDE, possibly also move to Delphi XE2 or newer. Our DBMS of choice is Microsoft SQL Server. We consider to move to ADO but are worried about it's future proofness in context of the above announcement.
Is this thinking of the relation ok? :
Delphi <---> ADO <---> OLE DB <---> DBMS
Do i understand correctly that Microsoft wants to move to?:
Delphi <---> ADO <---> OLE DB-bridge-ODBC <---> ODBC <---> DBMS
What they mean is that they will no longer be creating the SQL Server Native Client OLEDB Provider. There are a number of OLE DB Providers that you can use to access SQL Server:
Microsoft OLE DB Provider for SQL Server (SQLOLEDB)
This is the SQL Server 2000 era OLEDB Provider that ships with the operating system itself.
SQL Native Client 9.0 OLE DB provider (SQLNCLI)
shipped with SQL Server 2005
must manually install on client PCs
can connect to SQL Server 7, 2000, and 2005
can connect to SQL Server 2008, but they recommend you use the new native client
SQL Server Native Client 10.0 OLE DB Provider (SQLNCLI10)
shipped with SQL Server 2008
must manually install on client PCs
can connect to SQL Server 2000, 2005, 2008, and 2008 R2
SQL Server Native Client 11.0 OLE DB Provider (SQLNCLI11)
shipped with SQL Server 2012
must manually install on client PCs
can connect to SQL Server 2005, 2008, 2008 R2, and 2012
will throw an error if used to connect to SQL Server 2000
Microsoft is going to cease creating new SQL Server Native Client OLEDB providers. All along they have been creating:
SQL Native Client OLE DB provider
SQL Native Client ODBC provider
They are going to stop creating the OLEDB provider drivers, while continuing the release the ODBC drivers. Meanwhile, the original SQLOLEDB driver still exists (even in Windows 10). You can continue to use ADO to access SQL Server. ADO is friendly wrapper around OLDDB (and ungainly beast of an API).
And inside OLE DB you can still use the old SQLOLEDB OLEDB driver.
You can also use the OLE DB provider that wraps an ODBC driver (MSDASQL):
ADO
OLEDB
SQLOLEDB: Microsoft OLE DB Provider for SQL Server
SQLNCLI: SQL Native Client 9.0 OLE DB Provider
SQLNCLI10: SQL Server Native Client 10.0 OLE DB Provider
SQLNCLI11: SQL Server Native client 11.0 OLE DB Provider
MSDASQL: Microsoft OLE DB Provider for ODBC Drivers
{SQL Server}: SQLSRV32.dll
{SQL Server Native Client 10.0}: sqlncli10.dll
{SQL Server Native Client 11.0}: sqlncli11.dll
If you do move away from the old SQLOLEDB provider, and towards the ODBC drivers, you do have to beware of a subtle gotcha:
SQL Server does not support multiple open recordsets on one connection. For example, if you had some sort of master-detail:
sql := 'SELECT * FROM Orders';
qry := DatabaseHelper.Execute(sql);
while not qry.EOF do
begin
//...
//Oh, this order needs to be frobbed.
DatabaseHelper.ExecuteNoRecords('UPDATE ORDERS SET Frob=1 WHERE OrderID='+IntToStr(orderID));
qry.Next;
end;
You've just tried to do a second thing on a connection where a recordset is still being iterated. SQL Server doesn't support that. Fortunately the OLEDB provider knows this, and will silently open a second connection for you (a new spid and everything) to perform the action.
The ODBC drivers have no such helping hand. If you switch to using the ODBC driver, and didn't realize you have these subtle "issues", your app will very quickly fall over dead.

Can't create a linked server connection on SQL Server 2014 to Oracle 11g

I am trying to create a linked server in SQL Server 2014. I am attempting to connect to an Oracle 11g server. I am using the Oracle in OraClient 11g connection provided by Oracle. The ODBC connection is set up on the Server and I can test connect, so it works though Windows.
I right click on the Linked Servers in the database and choose Other Data source. There is no Oracle provider option there. If I try and force it using the Microsoft OLE DB Provider for ODBC drivers, the connection returns an error message that says "An exception occurred while executing a t-sql statement. Cannot initialize the data source object of OLE DB provider "MSDASQL" for Linked server "Server". OLE DB provider "MSDASQL" for linked server "Server" returned message "[Micrsoft][ODBC Driver Manager] Data Source name not found and no default driver specified." (Microsoft SQL Server, Error: 7303)
It appears I am missing something, a way for the sql server to recognize the connection, but I can't figure out what. Any guidance would be appreciated.
According to SQL Mag:
Before you can create a SQL Server 2008 linked server to Oracle, you
need to install the Oracle client software on the SQL Server 2008
system. The Oracle client software provides the network libraries that
are required to establish connectivity to the Oracle database. In this
case, the Oracle 11g database server is already installed and
functional. Installing the Oracle client software on the SQL Server
system enables it to connect to the existing Oracle server.
The article applies to 2008/11g but the principle should be the same on 2014/11g.
Took me a couple of days u I found this:
https://nampark.wordpress.com/2011/01/20/installing-64-bit-odac-11-2-to-microsoft-sql-server-2008-r2-x64-for-replication/
It gives a great walk through of how to install the missing components I need. The downside to this solution is that it requires the installation to be done via cmd window. Not something I have much experience with, but this walk through really gave me the details I needed to get it done. That cleared the error message I was getting.

Resources