SQL to bd connection on the network

Asked

Viewed 599 times

1

I developed a C# application that uses SQL Express that initially the bd and the application were installed on a single machine. The client now needs the comic to be available from another computer on the network. I installed SQL express on the "other" machine and changed the Connection string to :

connectionString = "Data Source = 192.168.1.xx\SQLExpress,1433; Integrated Security=SSPI; Initial Catalog = baseDados;"/>

where 192.168.1.xx is the IP of the machine where the database is located. Tcp/Ip is enabled.

This is enough to make the connection ?
Trying to access program/database gives error : "...Provider: TCP Provider, error 0 - A connection attempt failed because the connected component did not respond correctly after a period of time, the established connection failed because the connected host did not respond"
Can someone give me a hand?

  • Have you checked the firewall? By default some versions of SQL come with TCP protocol disabled.

  • yes, I also disabled the firewall on both computers..

2 answers

0


Check in the database properties if the following option is checked:

Server Properties

Instead, it would not use integrated authentication. Still, if you want to use it, make sure the IIS user has permission in the database:

Login IIS Login IIS - 2

Still, if nothing works, use a regular user with a password. Integrated authentication usually only works for these cases well if the database is integrated into a domain.

  • Thank you for the reply. I confirmed all the steps and they are all as described and shown in the images. Still unsolved.

  • In this case it would be interesting to use a user with same password. Try connecting to this database using user and password within Microsoft SQL Management Studio.

  • Using the same connectionString (excluding Integrated Security=SSPI) and just changing the server Authentication, using user and password, it worked... Thanks for the help!

0

The 192.168.x. x ip address is an internal IP address, what you want is the external IP address of the other computer.

If it is a Windows machine you can find it by using the ipconfig command on the target machine.

  • But I in computer 2 (which does not have the comic) have to put in the string Connection the ip of the machine that has the comic, right? And doing ipconfig on the other machine, which ip do I need? ipv4 address?

  • Exactly. If you are using ipv6 then it will be ipv6, however it is more likely to be ipv4. If it still doesn’t work, you must have some incorrect configuration.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.