I have an SQL Server 2005 installed on one partition (G:). Visual Studio 2005 with C# is on C: The OS on C:\ is Win2K Pro, OS on G: is WinServ2003.
I've created a database on G: in SQL Management Studio. Its name is "endPoint_forMe" The Server (default) as I can see is ALEX-*** data source is "strongUpdate" which is one of the tables in the database "endPoint..."
I cannot establish connection. What am I doing wrong?
I checked in the Control Panel-->>Management Tools-->>IIS on C:. Only one server is registered there: My computer name. There is no way to add another server.
string myConnString = "Persist Security Info=False;Integrated Security=SSPI;database=endPoint_forMe;server=ALEX-OPLHOFP92;data source=strongUpdate";
SqlConnection myConnection = new SqlConnection(myConnString);
myConnection.Open();
The last statement does not connect. I get an error report while debugging. What shall I do?
// Can you try the following:private String GetConnectionString(
String SqlInstanceName,
String DataBaseName)
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("data source=") ;
sb.Append(SqlInstanceName);
sb.Append(";initial catalog=") ;
sb.Append(DataBaseName);
sb.Append(";integrated security=SSPI;") ;
sb.Append("persist security info=False;") ;
sb.Append("workstation id=") ;
sb.Append(System.Environment.MachineName) ;
sb.Append(";packet size=4096") ;
return(sb.ToString());
}
private void button2_Click(object sender, EventArgs e)
{
String cs = GetConnectionString(".", "model");
System.Data.SqlClient.SqlConnection cn =
new System.Data.SqlClient.SqlConnection(cs);
cn.Open();
if (cn.State == ConnectionState.Open)
System.Windows.Forms.MessageBox.Show("success");
else
System.Windows.Forms.MessageBox.Show("fail");
cn.Close();
}
// the "." is the default instance on the current computer, "model" is the catalog...
I've tried this string.
string myConnString = "Data Source=(local);Initial Catalog=endPoint_forMe;Integrated Security=SSPI;";
The debug shows that the system runs out of time trying to make the connection. I increased the time parameter from 30 to 130 sec in Tools-->Options-->database-->queries.
I don't think it helped. The same exception with the same error message.
Pl help.
Thanks.
|||Hello> server=ALEX-OPLHOFP92
I had a comparable problem with the new security (TCP/IP turned off by default). Have you used "SQL Server Surface Area Configuration" or "SQL Server Configuration Manager" to enable TCP/IP?|||Many thanks.
Sure, mine was disabled! I just enabled it and am rushing to test the connection.
God bless newsgroups friendly help.
Thanks.|||Thank you very much. It is very interesting. I will try it and report the outcome. I feel it should work.|||It turns out not only TCP/IP was disabled but the MSSQLSERVER is stopped! SQL Server Agent is stopped also!
The trouble is I cannot get them started.
This is a part of the error log resulting from my attempt to start the Server. I quote error messages only:
2005-10-30 15:35:44.79 Server Error: 17182, Severity: 16, State: 1.
2005-10-30 15:35:44.79 Server TDSSNIClient initialization failed with error 0xd, status code 0x36.
2005-10-30 15:35:44.79 Server Error: 17182, Severity: 16, State: 1.
2005-10-30 15:35:44.79 Server TDSSNIClient initialization failed with error 0xd, status code 0x1.
2005-10-30 15:35:44.79 Server Error: 17826, Severity: 18, State: 3.
2005-10-30 15:35:44.79 Server Could not start the network library because of an internal error in the network library. To determine the cause, review the errors immediately preceding this one in the error log.
2005-10-30 15:35:44.79 Server Error: 17120, Severity: 16, State: 1.
2005-10-30 15:35:44.79 Server SQL Server could not spawn FRunCM thread. Check the SQL Server error log and the Windows event logs for information about possible related problems.
What shall I do about the "network library" which is apparently corrupted?
Thanks.|||
Try checking what network protocols are enabled for SQL Server in the SQL Computer Manager application. If the VIA protocol is enabled disable it and then try starting the SQL Server service again.
Hope this helps,
Vaughn
Thanks a lot.|||Eduardo hi,
All my attempts to enable a connection so far have failed. I cannot achieve it either programmatically as you suggested or via the GUI at VS where a special pane exists for attached databases. I am wondering if a prerequisite for a healthy connection is SQL Server.2005 up and running? In my current setting it is next to impossible to accomplish. My SQL Server.2005 is on a partition under the OS WinSer2003 but the Visual Studio with C# and all other stuff (the client, the recepient of the connection) is on C: under Win2K Pro. Thus I am trying to connect to an inactive database which exists in a directory. It seems to me that the notion of the Server instance is inapplicable here. Am I wrong? And the Server Instance is a component of the connection string!
If this is the case then I have to somehow set VS with C# up on the other partition with the server. The SQL Server does have a VS variant supporting the SQL Server but it is not furnished with C# compiler, I understand.
Typical error message I get when I run a program trying to make connection is that the timeout expired or the SQL Server is not responding.
Please comment on this.
Thanks.|||I just made connection with GUI but only when I invoked the VS on the same partition where SQL Server resides. It was a snap job, very elementary. The SQL Server was not even running at all. It is just important to have it on the same partition under the same OS.
My troubles are not over yet. It is a stip down version of VS I have here. Now I may try to install the full version on this partition and see how it goes. I need access to C# compiler and debugger. It is not a part of the VS that comes with SQL Server as I can see.
Thanks.|||
Got the problem solved by your helps by disabling the VIA protocol. Do you know what's the reason to cause the problem?
No comments:
Post a Comment