I'm attempting to follow the guide here which shows how to link an azure cosmos-db as a linked server via ODBC. I have created the ODBC links to the remote cosmos-db in both x64 and x86 flavours. These appear to connect without issue when checking from within the ODBC Admin console and I can even see the data when setting up a schema, however I am unable to create a working linked server as I get the following error when testing the connection ..
"[microsoft][ODBC Driver Manager] Data source name not found and no default driver specified"
I Believe this is maybe because I have SQL Express installed and the "Providers" folder is missing from the "Linked Server" folder. I am therefore assuming that I do not have the necessary providers installed on the SQL Server Instance running locally.
I have attempted to install both the OLE DB Driver and the ODBC Driver, however these have not helped.
My database is on an Azure server. And I'm trying to connect to it via an ODBC driver (by the way, I tried to install it manually, but I couldn't get it. They say it's built in). I get the following error: "Data source not found and no default ODBC driver specified: Unable to connect"
dataBaseKnowFood = QSqlDatabase::addDatabase("QODBC");
QString connectString = QStringLiteral("myconnectionstring");
dataBaseKnowFood.setDatabaseName(connectString);
dataBaseKnowFood.setPassword("dgf");
dataBaseKnowFood.setUserName("gidgfsg");
if (!dataBaseKnowFood.open())
{
QMessageBox::critical(this, "Programm", dataBaseKnowFood.lastError().text());
}
Problem solved. It was required to update this driver and indicate the version of the updated driver in the connection string.
I was given below instruction by IT team to connect SAS to a SQL server db.
libname aa sqlsvr dsn=dms user=xx pass='yy' owner=dbo readbuff=30000;
libname aa slibref=aa server=host1 port
When I run this, I get:
ERROR: The SQLSVR engine cannot be found.
ERROR: Error in the LIBNAME statement.
ERROR: Attempt to connect to server host1 failed.
ERROR: A communication subsystem partner link setup request failure has occurred.
ERROR: Cannot find TCP service 'host1'.
ERROR: Error in the LIBNAME statement.
I tried setting up an ODBC connection using host1 as server name, but it says Server does not exist.
What did I do wrong
It is likely that you haven't set up sqlsvr as a DSN in windows yet.
From the Start menu, find your ODBC Data Source Administrator menu item. This differs depending on what version of windows you are running, but there's a good chance you can just click Start and type 'odbc' and it will show up. You will most likely want the 64-bit version of the ODBC Administrator, if you're having troubles you can try the 32-bit version.
Once open, go to System DSN, click on Add, Choose the SQL Server driver from the list, and fill out the rest of the details in the wizard. At the end of the wizard you will have the option to test the configuration. You must be able to connect successfully with this connection prior to being able to use the dsn= statement in SAS. Once the connection is successfully setup, the dsn= statement should work fine.
Your second statement with host1 and port is not a connection to SQL server, as SQL server doesn't use ports in their ODBC connection specifications. It also looks incomplete as you have it typed there so you may want to double check the code you were provided with.
I'm trying to use PHP to connect to an ODBC data source using Windows authentication. I can connect just fine to the server in SQL Server so I know it's running. When I try to run the command
$link = odbc_connect("my_odbc","","");
I get the error:
"Warning: odbc_connect(): SQL error: [Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Login failed for user ''., SQL state 28000 in SQLConnect in C:\Users..."
I tried:
$link = odbc_connect("Driver={ODBC Driver 11 for SQL Server};
Server='my_odbc';Integrated Security=SSPI","","");
Which returned the message:
Warning: odbc_connect(): SQL error: [Microsoft][ODBC Driver 11 for SQL Server]Named Pipes Provider: Could not open a connection to SQL Server [53]. , SQL state 08001 in SQLConnect in C:\Users..."
Not sure what I'm doing wrong.
my_odbc is a SQL Server (2008) on a different machine. I don't have admin privileges on that database so I can't change anything on that end (such as enabling SQL Server authentication).
I am running Windows 7 and using PHP Version 5.6.12
phpinfo() indicates that ODBC Support is enabled as well as pdo_sqlsrv support
Maybe you should try PDO (the performance difference isn't that great) with SQLsrv plugin (this what I'm using to connect to my other boss' software which use SQL Server 2008 database):
$connection = new PDO("sqlsrv:Server=" . $this->sourceServer . ";Database=" . $this->sourceDB, $this->sourceUser, $this->sourcePW);
$connection->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
You can download the plugin here
https://www.microsoft.com/en-ca/download/details.aspx?id=36434
In Xampp, you must copy the dll in that folder:
C:\xampp\php\ext
And you must add that line to your php.ini
extension = php_pdo_sqlsrv_56_ts.dll
Note: Don't forget to restart your server so it can take in account the new php.ini file.
Let me know if it works for you
This error is a General Error that arises due to unable to establish connect to the server for some reasons. Its important to know what server are you using with PHP and the application used with it. Example Apache, Xampp or Wamp etc.
Here are somethings you could try like.
Let me brief, below are the reference links.
Check whether it pings
Enable TCP/IP connection SQL Server Configuration if not enabled. To do so, Open SQL Server Configuration Manager -> SQL Server Network
Configuration->Protocols for SQL server->TCP/IP(set to enabled).
Restart SQL services.
Enable Remote Connection from server
Open the Port, To do so Windows Firewall Settings-> Exceptions -> add a Port (Name:SQL;Port:1433;TCP) then from Exceptions tick SQL and save.
Enable running browser services.SQL Server Configuration Manager -> SQL Server Services - > SQL Server Browser set to running.
defining Port in connection string
add instance name with machine name if more than one instance is being used
sample
$user = 'username';
$pass = 'password';
//Use the machine name and instance if multiple instances are used
$server = 'serverName\instanceName';
//Define Port
$port='Port=1433';
$database = 'database';
$connection_string = "DRIVER={ODBC Driver 11 for SQL Server};SERVER=$server;$port;DATABASE=$database";
$conn = odbc_connect($connection_string,$user,$pass);
here are useful links that i found regarding the issue
resolving could not open a connection to sql server-errors
sql server provider named pipes provider error
Have a look at these links too
Named Pipes Provider: Could not open a connection to SQL Server [53]
Someone had the same error message and asked and answered his own question here.
To quote...
I´m sorry for the troubles.
The problem was, that I was using SQL Server Native Client 11.0 as driver. I switched it to SQL Server and now it works :/
Hopefully this at least helps someone, being in a similar problem....
A significant omission from your question is how you are running PHP and with which credentials.
Assuming you are using IIS or Apache (or another web server), then your PHP process is probably running under the local system account:
Since this account is local it doesn't have any authorisation to access your remote SQL Server.
You could alter the IIS/Apache service to run with the credentials (yours?) that are authorised to connect to SQL Server, but be aware this might cause other permissions issues with the service as well as being a problem if you change your password in the future.
Try running a test script from the command line (which should run with your credentials by default) to determine where the problem is:
php -r "var_dump(odbc_connect(...));"
Look at the regedit HKLM/SOFTWARE/ODBC
what is your folder name ?
If there is a "SQL Server Native Client 11.0" then you have to write your php code like
odbc_connect("Driver={SQL Server Native Client 11.0};Server=ip;Database=db;", "user", "pass");
However some of the server like server 2008 will be record this odbc like
ODBC Driver 11 for SQL Server
Then you have to replace SQL Server Native Client 11.0 by ODBC Driver 11 for SQL Server.
You have to create an ODBC interface first. In principle, this should also work without a user and pw. If defined in interface.
$pdo = new PDO('odbc:dsnName','user','pw');
Enable in IIS on Manager PHP o PDO_ODBC:
I have authenticated by Windows with following PHP statement:
$ Conn = new PDO ("odbc: Driver = {SQL Server}; Server = JAMILI-PC \ SQLEXPRESS; null; null");
I am using Windows 2008.
I hope it solves your problem.
Actually my job is take a backup data from a mysql data table to a SQL Server table.
So I created a DTS package in SQL Server 2000. When I manually run the the package, it runs successfully without any errors, and the data got transfered from MySQL to SQL Server.
But when I run the package using schedule jobs I got below error
DTSRun: Loading...
DTSRun: Executing...
DTSRun OnStart:
DTSStep_DTSDataPumpTask_1 DTSRun OnError: DTSStep_DTSDataPumpTask_1,
Error = -2147467259 (80004005) Error string: [Microsoft][ODBC
Driver Manager] Data source name not found and no default driver
specified Error source: Microsoft OLE DB Provider for ODBC Drivers
Help file: Help context: 0
Error Detail Records:
Error: -2147467259 (80004005); Provider Error: 0 (0)
Error string: [Microsoft][ODBC Driver Manager] Data source name not found
and no default driver specified
Error source: Microsoft OLE DB Provider for ODBC Drivers
Help file: Help context: 0
DTSRun OnFinish: DTSStep_DTSDataPumpTask_1 DTSRun: Package execution
complete.
So please help me on this.....
As the commenter mentioned, it could be a data source configuration problem - if you've set up your MySQL DSN as a user DSN rather than a system DSN, you'll need to change that. Open the ODBC configuration tool and go to the "System" table, rather than "User" (where it defaults) and create your data source there.
It could also be ax x64 problem - if the version of Windows you're using is x64, then the ODBC panel that opens by default shows x64 data sources. If you're using the x86 version of SQL Server (SQL 2000 has both), then you'll need to create the data source in the x86 ODBC administrator, which can be launched from:
C:\Windows\SysWOW64\odbcad32.exe
Once they're launched, they look exactly the same, so it can be hard to tell which one you've got open. A general indicator is that x64 driver list is usually way shorter - on my machine, there are about 25 drivers in the x86 version and only 3 in the x64 version. Keep in mind that if you're using SQL 2000 x86, you'll also need to install the x86 version of the MySQL driver, even if your server is x64.