Conn to Google Cloud SQL instance from CORE w/ proxy: A network-related or instance-specific error occurred. I CAN connect via mysql cmd - mysql

I begin by starting goole sql proxy by running following command:
./cloud_sql_proxy -instances=dauntless-gate-xxxxxx:us-central1:redacted-dev=tcp:3306
I SUCCESSFULLY connect from to it from running the following commands:
mysql --host=127.0.0.1 --user=sa --password=<redacted>
or
mysql --host=127.0.0.1 --user=sa --password=<redacted>
I attempt and fail to connect using ASP.net Core 2 w/ the follwing:
startup.cs
public void ConfigureServices(IServiceCollection services)
{
services.AddDbContext<UserContext>(opt =>
opt.UseSqlServer("Server=127.0.0.1:3306; User Id=sa;Password=<redacted>;"));
...
}
Error:
SqlException: 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: TCP Provider, error: 35 - An internal exception was caught)
I also try with the following and get slightly different error:
startup.cs
public void ConfigureServices(IServiceCollection services)
{
services.AddDbContext<UserContext>(opt =>
opt.UseSqlServer("Server=127.0.0.1; User Id=sa;Password=<redacted>;"));
...
}
An unhandled exception occurred while processing the request.
SqlException: 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: TCP Provider, error: 40 - Could not open a connection to SQL Server)
An unhandled exception occurred while processing the request.
ExtendedSocketException: No such device or address
System.Net.Dns.InternalGetHostByName(string hostName)

"SQL Server" is the name for Microsoft's SQL server product, which is not the same as MySQL, which running on your instance. You will need to use the MySQL Connector/NET to connect. Check out this page for more specific guidance for Entity Framework.

Related

SQLCMD utility : connection to second instance does not work

I have only SQLCMD utility installed locally and want connect to MSSQL instance, but it seems the tool cannot parse the instance name
example:
sqlcmd -S SERVER\INSTANCE -U sa -P password
However, I can use this command from the machine where SQL Server is already installed.
Error message:
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : SQL Server Network Interfaces: Error Locating Server/Instance Specified [xFFFFFFFF]..
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Login timeout expired.
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online..
To use SQLCMD to connect to a remote server instance use the full URI of your server over the network like so;
sqlcmd -S FULLSERVERURI\INSTANCE -U sa -P password
for example, if you had your server at 'someplace.com', your connection would be
sqlcmd -S someplace.com\INSTANCE -U sa -P password
The machine/server would need to have port 1433 open. Consider your network security options.
Please make sure you enable TCP/IP Protocol. This is different from allowing network connections in the server properties.
This is a MSSQL 2012 example, but I have it tested on MSSQL 2017 Developer (full) and still works the same (and also, fails just the same when disabled)

pre-login handshake SQL server 2014

I am getting the following error.
A connection was successfully established with the server, but then an
error occurred during the pre-login handshake. (provider: TCP Provider
The specified network name is no longer available) ((Microsoft SQL
Server, Error: 64).

Openshift mysql connection error channel timeout

I have an Tomcat 7 application on openshift and I have added a MySQL cartridge. I have a problem connecting to that database using MySQL workbench.
I have added all the necessary parameters like hostname, username, password and SSH key, I have tested the connection and I get no errors. But when I try to connect to the db I get the following error:
Your connection attempt failed for user 'adminxxxx' from your host to server xx.xxx.xxx.xxx:3306:
Tunnel error: Remote connection to xx.xxx.xxx.xxx:3306 failed: IOError('open SSH tunnel timeout',)
What can I do to fix this? Connecting to the db is a big part of the application.

SQL Server 2008 connecting error

After installation of SQL Server 2008, I open SQL Server 2008 and in Connect to Server window, I set following information :
Server type: Database Engine
Server name: MATRIX-PC\SQLEXPRESS
Authentication: Windows Authentication
User name: MATRIX-PC\MATRIX
Password:
Note: my PC name is MATRIX
I also in above information Server name changed to .\sqlexpress, but it returns an error when click on connect button:
Cannot connect to MATRIX-PC\SQLEXPRESS
Additional Information
A network-related or instance-specific error occured 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. (provide: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Unknown command

I'm trying to create datasource for connection pooling mysql database in Websphere Application Server.
I've set the JDBC Provider, I set the
Implementation class name : com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource
my mysql driver version is 5.1.6.
but I got this error while I try to connect the datasource:
The test connection operation failed for data source btn_itb_ds on server server1 at node qnode with the following exception: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Unknown command. View JVM logs for further details.
I have read this http://bugs.mysql.com/bug.php?id=38388 trouble shooting. But they just suggest to upgrade mysql driver version 5.1.X and I have do that. but I've got the same error.