Connection failure - ERROR [HY000] [MySQL][ODBC 3.51 Driver]Can't connect to MySQL server on 'localhost' (10061) - database

I've been looking all over the internet for an answer, and I didn't find anything.
I am trying på make a connection between Visual Studio 2010 Ultimate and SQL Server Management Studio. I just made a small program just to see if the connection works.
Everytime I'm trying to connect, VS throws an ODBCexception.
"ERROR [HY000] [MySQL][ODBC 3.51 Driver]Can't connect to MySQL server
on 'localhost' (10061)"
This is my connectionstring:
DRIVER={MySQL ODBC 3.51 Driver};Data Source=MY-USERNAME\\SQLEXPRESS;Initial Catalog=MY-DATABASE;Integrated Security=True
This connection string was copied from a data connection I've made inside VS.
Do any one have the magic solution???
Please and thank you! :)
Best regards!

Right now, you're mixing the MySQL driver (DRIVER={MySQL ODBC 3.51 Driver}) with a Microsoft SQL Server Express server name (Data Source=MY-USERNAME\\SQLEXPRESS;) - which one do you really want to connect to??
If you want to connect to SQL Server Express (which comes bundled with Visual Studio), you need to use the native .NET SQL client (and not the ODBC stuff).
In that case, your connection string would be something like:
server=YourMachine\\SQLEXPRESS;Database=MYDATABASE;Integrated Security=True
or something similar - see ConnectionStrings.com for tons of samples.
In this case, you should use classes like SqlConnection, SqlCommand, SqlDataReader from the System.Data.SqlClient namespace in your application.

This question is old but here is to guide anyone who had a problem like mine. In setting up Diafaan SMS server, i had the same problem. The problem was in the syntax. Note that in declaring the Server, Database, User and Password do not use quotes. That is why the error says 'localhost' remove all the single quotes from your connection string.
Driver={MySQL ODBC 5.1 Driver};SERVER=localhost;DATABASE= yourdatabase;User= root;Password = yourpassword;

Make sure your 3306 port is not blocked even if you are connecting to a remote MySql database. I got into same issue and it resolved once we opened the 3306 port.

Related

Connect SQL Server from SQL Developer

I searched through all threads on the web available, but none could help me.
I am trying to connect to SQL Server engine from SQL Developer. In order to do that I enabled Named Pipes and TCP/IP from SQL Configuration Manager.
Then I tried different drivers:
I tried Microsoft JDBC driver for SQL Server - I cannot choose in connection manager SQL Server database type, so it does not work..
I tried jTDS driver instead, and it worked - I can choose SQL Server database type, but then all I get is an error informing that it cannot connect to Microsoft SQL Server on localhost (I tried localhost, name of my computer, none of which worked).
Is there anything more I can do?
EDIT
This is what I have so far:
SECOND EDIT
I had more problems:
With error saying
Status: Failur-I/O Error: SSO Failed: Native SSPI library not loaded. Check the java.library.path system property
Using windows authentication, I still got asked for username and password.
(All details and solutions in my answer below)
We only support the jTDS driver for SQL Server and Sybase ASE connections, so that's the way to go.
After that, it's up to you to get a correct connection string to your SQL Server system.
Make sure you have the right port in addition to your 'localhost' network location for your SQL Server instance.
This is using version 19.1 of SQL Developer to connect to a SQL2012 instance overseas..
Actually there were more problems, which I'll post here along with solutions:
In order to ba able to connect SQL Server database type from SQL developer it is needed to install jTDS driver, as already mentioned. Other types are not supported by SQL Developer.
Next thing was to configure with SQL Configuration Manager (the easiest way IMO) SQL Server to listen on IP port 1433, not dynamic, as was previously set. In order to do that in configuration manager I had to go to SQL Server Network Configuration and make appropriate changes. More here.
Next I had problem:
Status: Failur-I/O Error: SSO Failed: Native SSPI library not loaded. Check the java.library.path system property
Which was the fault of missing file, solution was placing file ntlmauth.dll to the /jdk/bin in SQL Developer directory.
I chose Windows authentication, which apparently is not supported by jTDS, so I needed to create user in SQL Server, which I use to connect SQL Server from SQL Developer.
After all that, I had it working.

Delphi DBExpress with Devart SQL Server driver how to connect to database

I have installed the trial version of devart sql-server driver for dbexpress. But I have little Idea how to set-up the driver properties in order to connect. I want to connect to the SqlServer express instance on my pc, with windows authorization but I cannot figure out how to set the parameters in the TSqlConnection component. I assume hostname is the name of the server, but how do I set the authorization mode? When I activate the connection it keeps asking me with username and password. Sorry maybe I am asking something obvious but please help me to start up with my SqL server connection. Thanks

Microstrategy 10.4 SQL ODBC Connection error

I've tried to connect an SQL database from a server with Microstrategy located in another server through an ODBC connector for SQL.
First I've checked that there is a connection between the two servers executing a ping sentence with the IP Address the other server and it went through.
After making sure the connection is stablished without issues, I've tried to connect through Microstrategy without success. The error I get is the following message:
"Connection test error: Connect failed. Error type Odbc error. Odbc operation attempted: SQLDriverConnect (08001:0: on SQLHANDLE)"
Using SQL Server 2017 for the databases and Microstrategy 10.4.
Please, anybody has any clue about what might be happening?
Thanks,
look at the type of connector to the db you have. It gave me the same error until I used: "with Native Client Driver".
Could you please share the complete error message, SQL Handle error are associated with multiple error scenarios like invalid username * password, connecting 64 bit server with 32 bit ODBC driver etc. Complete error message would help me to debug it.
In general follow the steps to debug the error, (any order)
Check the version of ODBC Connection (64bit / 32 bit), it should be the same as server version.
Try testing the ODBC connection that you have created using ODBC Administrator tools to see whether there is an problem with username & password/server name or database connection issue.
Check the Database Instance/Database Connection/User Login created under the Administration option to ensure everything is working and give the correct value.
if nothing works try using the native driver given by MicroStrategy, you can access this using Connectivity Wizard.
Hope it helps..

ODBC SQL Server Driver Login timeout expired

I'm failing to connect to a SQL server SQLExpress. The connection worked fine a few days ago.
This is how I tried to connect (I'm using Microsoft SQL server management studio):
connection = pyodbc.connect("DSN=sqlServer; UID=myuser;PWD=mypassword")
cursor = connection.cursor()
The error I get:
('HYT00', '[HYT00] [Microsoft][ODBC SQL Server Driver]Login timeout expired (0) (SQLDriverConnect)')
In the ODBC Data Source Administrator, when I test the data source I get:
I got the similar issue.
The problem was actually I was using "SQL Server" as the driver in my ODBC settings in my DSN.
The driver should be "SQL Server Native Client 11.0".
It fixed the issue for me.
Because you are having the same issue in the ODBC Data Source Administrator I would try to focus on that first not on your code.
Here you can find a list with possible problems
Maybe this can help you find out what the problem is.
I also would try to connect with the SQL Server Management Studio.
Maybe it is possible to connect with a different user or via Windows login.
That would mean that your user might not exist anymore (maybe because you renewed tha database or something).
Also I sometimes have the problem that the SQL Server is not started either locally or on the server.
Maybe you could check if the service is started and the database is running.

IIS 7 can't connect to SQLServer 2008

Sorry if this is the most seen question on the web, but this is my turn. I am trying to publish my asp.net mvc app on IIS 7 under MS Sql Server 2008. I am on a Windows Server 2008 virtual machine. I get the following classical error:
A network-related or instance-specific
error occurred while establishing a
connection to SQL Server. The server
was not found or was not accessible.
Verify that the instance name is
correct and that SQL Server is
configured to allow remote
connections. (provider: SQL Network
Interfaces, error: 26 - Error Locating
Server/Instance Specified)
Under SQLServer, Allow remote connections is checked. My connection string is:
Data Source=.\MSSQLSERVER;Initial Catalog=mydbname;User Id=sa;Password=mypassword
I also tried with no username/password and "Integrated Security=true". There is only one instance of SQLServer installed.
I tried to access my web page locally and remotely. There is no active firewall on the virtual machine.
Make sure you have TCP/IP set up as a transport in your SQL Server configuration tool.
Thanks guys for the try. I found the solution and it is related to an info that I forgot to give. I hope it can help someone as new as me on these things.
I use NHibernate, and the connection string is actually in the nhibernate.cfg.xml file. The one in the web.config file is actually used by my various providers (users/roles). I fixed that by removing the connection string from the NH config file. I now retrieve it with:
string connectionString = ConfigurationManager.
ConnectionStrings["myConnectString"].ConnectionString;
and I set it in NH with:
Configuration cfg = new Configuration();
cfg.Configure(cfgFile);
cfg.SetProperty(NHibernate.Cfg.Environment.ConnectionString, connectionString);
Now I get:
Cannot open database "mydb"
requested by the login. The login
failed. Login failed for user 'NT
AUTHORITY\NETWORK SERVICE'.
But this is another story, for another question if I can't find the answer.
PS: I had to use "." as the server name otherwise .\MSSQLSERVER was producing a new error "invalid connection string". Thx Ian and Jared for the tip.
is that the actual data source line from the web config?
If so then it's should be in quotes of course, for safety add a ; on the end and check that is the actual name of your instance, you can check windows services for your instance name.
try substituting localhost instead of . and can you connect from sql server management studio using the credentials in your connection string?
As mentioned by Robert, try:
ConnectionString="Data Source=(LOCAL)\MSSQLSERVER;Initial Catalog=mydbname;User ID=sa;Password=mypassword"
I'm not sure if connection strings are case sensitve, but I notice that you have 'Id' instead of 'ID'.
Edit:
Am not sure if you need \MSSQLSERVER?
are you sure it's a named instance of SQL?
try
Data Source=.;Initial Catalog=mydbname;User Id=sa;Password=mypassword
UPDATE:
from this site
did you try the following:
Make sure the server machine is reachable, e.g, DNS can be resolve correctly, you are able to ping the server (not always true).
Make sure SQL Browser service is running on the server.
If firewall is enabled on the server, you need to put sqlbrowser.exe and/or UDP port 1434 into exception.
Well I am facing the same above issue since morning (past 8 hours) did lots of stuff like create a Domain Name, setup a new application pool identity but nothing worked :(
I just made a small changes in web.config file for connection string that is:
Integrated Security=False instead of True... and now it is working perfectly

Resources