I had database application which works fine if it runs
locally.
But running the program on other computer or via network, it fails.
It shows the error "Unhandled exception has occured in
your application"; "Cannot open database db_name requested by the
login."
On my application the issue was the connection string on the code.
This code below runs fine on my application. I'm using VB
2010 for my program.
con.ConnectionString = "Data
Source=192.168.1.150,1433;Database=MyDBx;User ID=dbsa;Password=db007"
1433 is the default port for Microsoft SQL; if this was
changed you need to enter the correct port.
To check if port 1433 is listening for connections, open a command prompt and type:
netstat -an | find "1433"
If everything is set correctly output will show like this:
TCP 0.0.0.0:1433 0.0.0.0:0 LISTENING
TCP [::]:1433 [::]:0 LISTENING
TCP [::]:1433 [::]:0 LISTENING
The string connection below was the one messing up the
application that caused the program to fail and unable to login to the
database remotely or using other computers on the network.
con.ConnectionString = "Data
Source=DB7\SQLSRv;Database=DBx7;Integrated Security=True"
If the firewall is not configured properly to allow the
traffic for the SQL, the “Authentication method” settings on the SQL server, if
the username and password does not match on the login database; this scenarios
can cause the application to fail.
Hope it helps.. Cheers..
Comments
Post a Comment