0

I installed my VB application on client PC which in local network, but application can not reach database with err:40

Some details to describe the problem:

My connection string as it is in config file:

"PioneerHRSystem.My.MySettings.CON1" 
    connectionString="Data Source=SERVER\SQL2014ENT;Initial Catalog=MYDATABASE;Integrated Security=True"  
    providerName="System.Data.SqlClient" />

I checked the configuration in server to make sure about setting like:

  • Instance name=SERVER\SQL2014ENT
  • SQL server and windows Authentication= Selected
  • TCP = enabled
  • Port (1433) = opened in both of them (server & PC)
  • Allow remote connection to this server = selected
  • Ping testing for IP=Received
  • Server restarted

Also I played with connection string by adding IP & Port in like:

PioneerHRSystem.My.MySettings.PPECON1" 
connection String="Data Source=192.168.8.3\SERVER\SQL2014ENT;Initial Catalog=MYDATABASE;Integrated Security=True" 
providerName="System.Data.SqlClient" />
PioneerHRSystem.My.MySettings.PPECON1" 
connectionString="Data Source=192.168.8.3\SERVER\SQL2014ENT1433;Initial Catalog=MYDATABASE;Integrated Security=True" 
providerName="System.Data.SqlClient" />
PioneerHRSystem.My.MySettings.PPECON1" 
connectionString="Data Source=192.168.8.3\SQL2014ENT,1433;Initial Catalog=MYDATABASE;Integrated Security=True" 
providerName="System.Data.SqlClient" />
PioneerHRSystem.My.MySettings.PPECON1" 
connectionString="Data Source=192.168.8.3\SQL2014ENT;Initial Catalog=MYDATABASE;Integrated Security=True" 
providerName="System.Data.SqlClient" />

But still I get error:40 could not open connection to SQL Server

NOTE: all modification was done through the config file (as I know it should work if correct) am I correct?

UPDATE: The Complete message is:

************** JIT Debugging ************** To enable just-in-time (JIT) debugging, the .config file for this application or computer (machine.config) must have the jitDebugging value set in the system.windows.forms section. The application must also be compiled with debugging enabled.
For example:
<configuration> <system.windows.forms jitDebugging="true" /> </configuration>
Majid
  • 31
  • 1
  • 6
  • Does this answer help: [Can I use the Integrated Security option in a connection string if I'm connecting to a remote machine that's not on a domain?](https://stackoverflow.com/a/18249786/1115360) You may need to add a user to the database, and set the appropriate permissions on SELECT, executing stored procedures, and so on. – Andrew Morton Dec 13 '21 at 16:05
  • Basically when using Integrated Security the logged in user running the app (unless your app runs under impersonation) should be a domain user, and that same domain user needs to be added to your server logins, and added to your database logins, and granted access. – djv Dec 13 '21 at 19:46
  • What error message do you get Is it a "A network-related or instance-specific error occurred while establishing a connection to SQL Server"? If so, then if you have a default instance (rather than a named instance), then you should just use `Data Source=DnsNameOfMachine`. If it's a named instance, you need `Data Source=DnsNameOfMachine\InstanceName`, and you need to start the SQL Browser service on the server. Or is the error "Login failed for user"? Then you need to look at the error logs on the server to find the exact failure reason – Charlieface Dec 13 '21 at 20:02
  • Please [Edit](https://stackoverflow.com/posts/70337417/edit) your question to include the complete error message - as text. Comments aren't the appropriate place for that information, not the least of which is because they have length limits. – AlwaysLearning Dec 13 '21 at 23:19

0 Answers0