Database RRS feed

  • Question

  • User-1922102528 posted

    I have a problem connecting my .NET application to my database. As a database I use mysql on a raspberry pi on the same network as my .NET application.U can see my code in the code section. 

    string connetionString = null;
    connetionString = "server=,1433; Initial Catalog=Galenus;User ID=xxx;Password=xxx";
    SqlConnection conn = new SqlConnection(connetionString);
    Console.WriteLine("Connection Open !");

    The error code i get is :

    System.Data.SqlClient.SqlException  HResult=0x80131904  Message=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: 0 - Kan geen verbinding maken omdat de doelcomputer de verbinding actief heeft geweigerd.)

    In Visual Studio I can manually set up a SQL server via "Server Explorer". I can access my server this way (so it works when i manually add a SQL server). The string I connect to via "Server Explorer" is generated automatically and is as follows: "server=;user id=xxx;database=Galenus" So in my case i just added the password and the port for the IP adress. 

    Does anyone know what I'm doing wrong? I've been looking for my mistake for 3 days.thanks for the assistance.

    Some screenshots

    Friday, March 27, 2020 1:21 PM

All replies

  • User-1330468790 posted

    Hi Brecht_M,


    I can see that your problem is caused during a connection to SQL Server instance from another computer by using the TCP/IP protocol.

    The error message shows that you can not find the SQL Server instance which possibly happens when :

    • The name of the computer hosting the SQL Server
    • Instance does not resolve the the correct IP
    • The TCP port number is not specified correctly


    Here is an instruction that would help you complete the troubleshooting from the most basic problems to more complex problems.



    Security Reminder:

    You should not post private messages such as 'UserID' and 'password' even though the IP is not public accessible.

    The member of this forum normally would not need these information to target and solve your problem.


    Moreover, it would be much appreciated if you could check the format of the post after you post it since this post is not very readable but confused for those people who are willing to help you.


    Hope this can help you.

    Best regards,


    Monday, March 30, 2020 5:30 AM
  • User-18289217 posted
    using(SqlConnection conn = new SqlConnection(
    "Data Source=,1433; Initial Catalog=Galenus; User ID=xxx; Password=xxx;"){
        Console.WriteLine("Connection Open!");

    Tuesday, April 7, 2020 8:26 AM