How do I connect mysql in the first time? - c#

An error occurred When i use C# to connect mysql in first time.
the error message is:
Connection open error . Authentication to host 'localhost' faied.
...but in the second time,it become normal.
this is my connect string
DefaultConnectionString": "Server=localhost;Database=DatabaseName;Uid=root;Pwd=123456;

if you add:
ConnectionReset=True;
.this command is supposed to make one more trip and reset the connection.

Related

general error: database 'T' not connected

I am trying to connect SAP HANA database in MVC, but I'm getting this error.
general error: database 'T' not connected
This is the code for connection:
using (HanaConnection sqlConnection = new HanaConnection("Server='192.168.0.13:30015'; UserName='S'; Password='E'; DATABASENAME='T'"))
{
sqlConnection.Open();
}
What could be the cause of this? I also tried changing my port to
30013
but got this error:
Connection failed (RTE:[89006] System call 'connect' failed, rc=10061:No connection could be made because the target machine actively refused it.
I can connect with this connection string using PHP.
It seems like there is no tenant database named 'T' available. If you have not configured this tenant, please try to omit the databaseName property and simply connect using
new HanaConnection("Server='192.168.0.13:30015'; UserName='S'; Password='E'")
Based on the error messages it seems that port 30015 is correct as the first error is originating from the database itself and the second is not.

Why do I get a SQL Server error when I did not include one

I'm currently following this tutorial for ASP.Net Core: https://learn.microsoft.com/en-us/aspnet/core/tutorials/razor-pages/razor-pages-start?view=aspnetcore-3.1&tabs=visual-studio
I'm having an issue: when I get to the 2nd part of the tutorial where I add a model there's a step where I enter the following commands:
Add-Migration InitialCreate
Update-Database
Whenever I enter Update-Database I get the following 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: 56 - Unable to load the SQLUserInstance.dll from the location specified in the registry. Verify that the Local Database Runtime feature of SQL Server Express is properly installed.)
In the tutorial it never asks you to download or connect to a SQL Server so why do I get this error?
Error is saying that you cannot connect to sql server. Unfortunately, instructions are in Part 4 in tutorial. I suggest you to follow it.
https://learn.microsoft.com/en-us/aspnet/core/tutorials/razor-pages/sql?view=aspnetcore-3.1&tabs=visual-studio
You have to obviously connect to the SQL server. if you don't this. how you expect will work Add-Migration InitialCreateand Update-Database.I assume that you did this connection. Now follow the steps below.
Actually, this Error basically gets when the SQL Service is stopped.
Step 1 : Type "window" button + R ,This will open Run prompt.
Step 2: Type "services.msc" in Run prompt and hit the enter.
or go to this window you have to search the Services like this-
Step 3: Then Search for SQLSERVER(MSSQLSERVER) and Restart the service.if not restart then start the service.
Follow this step,hope it's resolve your issue.

Connection to Oracle database not working

I am currently working on a project with someone. We are connecting to a oracle Database using the NuGet Package Oracle.ManagedDataAccess.Core.
We are connecting using a connection string that looks like this:
"User Id={this._dbUser};Password={this._dbPassword};Data Source={this._dbServer};"
The Parameters we pass on are correct we checked multiple times.
At first I got a Connection Timed out error which we fixed by adding persist security info=false;Connection Timeout=120; to the connection string.
At first it seemed to be working but then we encountered a new error.
This time it was saying:
Oracle communication: Connection to server could not be established or connection string not parsed
(Might not be 100% accurate because I had to translate it from German to English)
We could not find a solution for this error but we discovered that the error only gets thrown when we run the code on my machine. His is doing totally fine and can connect without any problems.
Could it be that I have some settings set on my machine that would prevent me from accessing the Database?

Can connect mysql database via navicate but cant from c# application

here is all info.
Step 1
Step 2- Error Msg
Step 3- connection String
I have tried without using port number but the problem is same. There is IP restrictions for remote login. but if it is because of IP restriction why am I able to connect with Navicat.
Code of C# where i'm getting error.
As per step 1 it seems the connection has been successfully established, but still you are unable to connect to the specific database. Check the name of the database or confirm that the database exists with the name supplied in the connection string. You can do that even by creating a connection from Navicat. If the database exists you will find it there.
Cheers
Maybe you should invoke mysqlcon.Open() before using mysqlcon.

Entity Framework: Server did not respond within the specified time out interval

I am trying to access remote Oracle database using vpn connection. Using Oracle Sql Developer tool I am able to connect the database. But when I use ADO.NET model and Devart dotconnect for Oracle, it gives me error that server did not respond with in specified timeout interval.
Any one has face this issue?
UPDATE: I increases the timeout to 60s from default 15s. Now I am getting error:
ORA-12154: TNS:could not resolve the connect identifier specified
1st Issue is quiet common that server did not respond in defined time, increasing the connection time should do the trick. For this just append
;connection timeout = 60; (here time in seconds) to your connection string.
2nd After your update looks like Tns is not resolved properly:
You can check:
Do the tnsping (DB name in tns ora file). See you should not get any error and connection should be ok.
If problem still persist check your oracle home in registry have the correct path in case you have multiple client.

Categories

Resources