-2

Hey all I am currently trying to connect to a database on a differnt server from where the .ASPX file is being called from.

In VS2013, in debug, It calls the query just fine without problems but once I compile and call that same page from the actual web server it displays this error:

sql query error

The MS SQL server I am calling is a 2008 version.

The connection string I have tried are:

Dim sqlQ As SqlCommand = Nothing
Dim conn As SqlConnection = Nothing
Dim reader As SqlDataReader = Nothing

Dim strConnString As String = "Data Source=zzSQL004;Initial Catalog=C_Data;Trusted_Connection=True;Integrated Security=SSPI;"
Dim strConnString As String = "Server=zzSQL004,2866;Database=C_Data;User Id=C_user;Password=zzzzzzz;"
Dim strConnString As String = "Data Source=zzSQL004;Initial Catalog=C_Data;Persist Security Info=True;User ID=C_user;Password=zzzzzzz"
Dim strConnString As String = "Data Source=zzSQL004,2866;Initial Catalog=C_Data;Trusted_Connection=True;Integrated Security=SSPI;User ID=C_user;Password=zzzzzzz"
Dim strConnString As String = "Data Source=zzSQL004,2866;Initial Catalog=C_Data;Persist Security Info=True;User ID=C_user;Password=zzzzzzz"
Dim strConnString As String = "Data Source=zzSQL004\PNC_user;Initial Catalog=C_Data;Persist Security Info=True;User ID=C_user;Password=zzzzzzz"
Dim strConnString As String = "Provider=SQLOLEDB.1;Password=zzzzzzzz;Persist Security Info=True;User ID=C_user;Initial Catalog=C_Data;Data Source=zzSQL004"

In my Web.config file I have no to the database since I have the code above I am using. I am starting to wondering wither that is causing the issue or not?

I am just wondering what I could be forgetting in order to make this connection work? I spoke to the DBA's and they say everything is working/configured as it should be. Remote connection is enabled and all. It's just odd that in debug inside VS2013 I can get to it (which is on a different PC - not on the DB/web server itself) yet once on the server I can not.

Any help would be great!

StealthRT
  • 10,108
  • 40
  • 183
  • 342
  • If you have `SQL Server Management Studio` installed on your server, try connecting with that first to verify that all is well with the database and your network. Ask your DBAs for help if it doesn't connect. Then use the same connection parameters in your connection string. – Pradeep Kumar Aug 21 '14 at 11:54

1 Answers1

0

Sounds like a network issue, I would do the following:

  1. ping the database server from the web server
  2. use telnet on the web server to open the connection towards the SQL server on the specific port
Bojan Bjelic
  • 3,522
  • 1
  • 17
  • 18