SQL Server CE connection string for OleDB - connection-string

Connection string problem: I need to connect to SQL Server CE 3.5 using oledb as I want to use tabledirect function
Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5;
Data Source=D:\Projects\SQLCE\AisDT.sdf;
Password=GMT786;
Persist Security Info=false;
Max Database Size=4000;
This is the connection string I am using to connect Visual Studio 2013 to SQL Server CE 3.5, but when I try to open the connection, I get following error:
Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.
I have checked registry too and there is no problem in registry. I think I am missing some thing in connection string
Please check my connection string as I am new to SQL Server CE.

Related

Can we create SQL Server connection from DBVisualiser using existing SQL JDBC driver?

I am new to DBvisualiser. I am working on private laptop, installed SQL Server Management Studio 18 and DBVisualiser. In SQL Server the connection is not encrypted and using windows authentication. TCP/IP enabled.
IN DBVisualizer I am using existing driver - JDBC
I get error
failed to login for user -***
what is missing here?

SSIS error: Login failed for user "NT AUTHORITY\ANONYMOUS LOGON"

We converted our 2012 SSIS package to 2016 SSIS (TargetServerVersion = SQL Server 2016).
One of the database the SSIS package reads from is a SQL Server 2012 database.
Either connecting using Native OLE DB\SQL Server Native Client 11.0 or connecting using OLE DB provider for SQL Server give the same error.
Data Source=my2012SQLDBServer;Initial Catalog=my2012SQLDB;Provider=SQLNCLI11.1;Integrated Security=SSPI;Auto Translate=False;
Data Source=my2012SQLDBServer;Initial Catalog=my2012SQLDB;Provider=SQLOLEDB.1;Integrated Security=SSPI;Application Name=myApplicationName-{....}my2012SQLDBServer.my2012SQLDB;Auto Translate=False;
When running the SSIS package from SSMS (SSMS is run using a user that has a dbOwner permission to the 2012 database, ie myDomain\myUser) , I am getting the error in the step reading a table from the 2012 database
Execute SQL Task: Error: Failed to acquire connection "my2012SQLDBServer.my2012SQLDB".
Connection may not be configured correctly or you may not have the right permissions on this connection.
DTS_E_OLEDBERROR. An OLE DB error has occurred. Error Code:0x80040E4D. An OLE DB record is available. Source: "Microsoft SQL Server Native Client 11.0" HResult:0x80040E4D
Description: "Login failed for user "NT AUTHORITY\ANONYMOUS LOGON".
On Visual Studio (run using myDomain\myUser), I am able to succesfully run the SSIS package.
myDomain\myUser also has an ssis_admin, ssis_logreader, db_owner, app_dbowner role in the SSISDB database.
How can I fix this error ?
Thank you.
It is typical error for double-hop problem.
Simplest solution is to login using remote desktop to SSIS server and then run it using SSMS there.
Other option is to define SQL Agent job on the SSIS server and then run the package using this job.
Ultimate solution will be to configure Kerberos and allow double-hop connections on the SSIS box.
You can check following post how to configure Kerberos:
SSIS job fails when run remotely thru ssms, but runs fine on SQL Server
solution for me was like just changing windows authentication in the destination settings to SQL server authentication with apropriate
Account that have rights to reach the server, i dont understand how it works but it does.

What connection string and or OLEDB/ODBC drivers when moving "classic ASP/ADO" app from SQL Server 2008 to SQL Server 2017?

My "classic ASP" application is on Windows Server 2003 and uses ADO to connect to a SQL Server 2008 database.
The database server is being upgraded from a changing and will be running SQL Server 2017.
I am trying to prove that the old application can still work, connecting to this newer version of SQL Server.
I have so far not had success in making a connection to a SQL Server 2017 installation from the old WS2003 machine.
I am not sure what OLEDB or ODBC providers or drivers I need to install to get this to work, and ultimately, what the Connection String will need to be.
I have created a small demo program to make the connection using the same code as the real application will. Essentially, all I am doing here is providing a connection string and attempting to connect. This is VB6 using ADO:
Private Sub btnConnect_Click()
Dim theConnection As New ADODB.Connection
theConnection.ConnectionString = Text1.Text
theConnection.Open ConnectString
If theConnection.State = 1 Then
MsgBox ("connected ")
Else
MsgBox ("failed to connect ")
End If
End Sub
I can get this program to run on the new server - the one with SQL Server 2017, and it connects successfully.
This connection string works :
Driver={SQL Server Native Client 11.0};Server=192.168.0.23;Database=TestDB;Uid=user1;Pwd=xxx;
This also works :
Driver={SQL Server};Server=192.168.0.23;Database=TestDB;Uid=user1;Pwd=xxx;
This one is the exact format that the existing code uses to connect.
Now, I understand that for ADO, I have not specified Provider, so I think it defaults to MSDASQL, Microsoft's OLEDB provider for ODBC.
So, to get this to connect from the WS2003 application server, is where I have problems. Is this going to be possible?
I have tried these connection strings with these results :
Driver={SQL Server};Server=<IP address of SQL2008 server>;Database=yyy;Uid=xxx;Pwd=xxx;
This WORKS - and this is the existing SQL2008 database.
Driver={SQL Server};Server=<IP address of SQL2017 server>;Database=TestDB;Uid=user1;Pwd=xxx;
This takes approx 20-30 seconds to fail with this message :
[ODBC SQL SERVER DRIVER]SQL Server does not exist or access denied
Is the "old" {SQL Server} driver going to be able to connect to to SQL2017?
Driver={SQL Server Native Client 11.0};Server=192.168.0.23;Database=TestDB;Uid=user1;Pwd=user1;
This fails immediately with the message :
[ODBC Driver Manager]Data Source Name not found and no default driver
specified
Does this mean that the {SQL Server Native Client 11.0} ODBC driver is not installed on the WS2003 machine? Can it be installed?
I have tried looking at the various ODBC driver installations from Microsoft here : https://learn.microsoft.com/en-us/sql/connect/odbc/download-odbc-driver-for-sql-server?view=sql-server-2017
However, I'm not sure if I need to be doing this or if they are compatible with WS2003.
Microsoft ODBC Driver 17 for SQL Server : requires at least Windows Server 2008 R2. Same for Microsoft ODBC Driver 13 and 11. I did get the version 11 to install, event though it probably is not supported. I did use this to successfully create a new ODBC data source to the old SQL2008 database, but not to the SQL2017 database.
What do I need to do to resolve this?
ADO doesn't use "Drivers" that's ODBC terminology. It uses OleDb "Providers". There are three OleDb providers for SQL Sever (in addition to MSDASQL, the OleDb Provider for ODBC drivers which shouldn't be necessary for SQL Server, since it has native OleDb providers).
The old, SQLOLEDB provider has been included in Windows since Windows Server 2003, and it's probably the right one to connect from your old server. The current one is MSOLEDBSQL, and is available here, and should be used whenever possible instead of the old SQLOLEDB or the newer, but deprecated SQLNCLI provider.
Here's a VbScript that you can use to test connections from any Windows computer.
Wscript.Echo "SQLOLEDB"
set theConnection = createobject("ADODB.Connection")
theConnection.ConnectionString = "Provider=SQLOLEDB;Data Source=localhost;Integrated Security=SSPI"
theConnection.Open ConnectString
Wscript.Echo "SQLNCLI"
set theConnection = createobject("ADODB.Connection")
theConnection.ConnectionString = "Provider=SQLNCLI;Data Source=localhost;Integrated Security=SSPI"
theConnection.Open ConnectString
Wscript.Echo "MSOLEDBSQL"
set theConnection = createobject("ADODB.Connection")
theConnection.ConnectionString = "Provider=MSOLEDBSQL;Data Source=localhost;Integrated Security=SSPI"
theConnection.Open ConnectString
Save it to a .vbs file and run it with the command:
c:\test> cscript test.vbs

Can't connect to Visual Studio 2015 SQL DB using Excel?

!
I've tried using ADODB connection string and also in the Excel Data Connection Wizard.
I'm getting this error:
[DBNETLIB][ConnectionOpen(Connect()).]SQL Server does not exist or access is denied.
I can see the server created in Visual Studio with its databases fine, no worries, in SQL Server but not connect in Excel. I can connect in Excel to databases created in SQL Server but not those created in VS (2015).
It's seems like a server issue rather than database one but here's the connection string's anyway:
This works fine for database's created in SQL Server:
Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=True;Data Source=DESKTOP-ODUI05F\MSSQL2012;Initial Catalog=MyDatabase
but the same string generates the above error when connecting to the server/database created in VS.
Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=True;Data Source=(LocalDB)\MSSQLLocalDB;Initial Catalog=aspnet-Widly-20160823125202
The server name is: (LocalDB)\MSSQLLocalDB.
The database is generated in VS using EF.
Please help - driving me nuts.
Thank you, Simon
Solved!
Followed the solution linked below.
Even though it's an MSSQL Server DB you're trying to connect to, using Excel Data Connection Wizard you have to ignore SQL Database connection option and choose "Other/Advanced" instead. I recorded it in a macro which produced all the vital parts for the connection string as follows:
How to connect to localDB in Excel
Provider=SQLNCLI11;
Integrated Security=SSPI;
Persist Security Info=False;
Data Source=(LocalDB)\MSSQLLocalDB;
Initial Catalog=aspnet-PTL-20160827031609
Besides doing the dishes this is my biggest and only achievement today! :)

How to write connection string to connect from classic ASP page to SQL 2008 R2?

I connect from classic ASP page to SQL SERVER 2008 R2 with following connection string
"Data Source=(local);Initial Catalog=my_db;Persist Security Info=True;User ID=my_user;Password=my_pass;"
but I get error
Microsoft OLE DB Provider for ODBC Drivers: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
I verified that my_db exists!, so what is wrong in my connection string?
The (local) name you've given for your data source is invalid. It should be an IP address, server name or server/instance name of your SQL installation.
UPDATE
If the SQL server is on the webserver you can use . to specify local. Here's an example connection string from one of my classic ASP projects:
"Provider=SQLNCLI10;Server=.;Database=my_db;Uid=user;Pwd=pass;"
You need to specify an oledb provider to prevent it trying to default to ODBC (and failing)
Provider=SQLNCLI10;Data Source=(local);Initial Catalog=my_db;User ID=XXX;Password=YYY;
(You also need the 2008 SQL Client OleDb provider installed on the machine)
try to change (local) with : 127.0.0.1
Try:
Provider=SQLNCLI10;Server=(local);Database=my_db;Uid=my_user; Pwd=my_pass;
If in doubt, check connectionstrings.com.

Resources