none
Difficulties connecting to server across home network RRS feed

  • Question

  • I run a home network with several Windows 7 machines. I run sqlexpress databases version 10.0.4064 on different machines. I can connect to a database from one to a different machine using SQL Server Management Studio. But I can't connect using applications that worked previously using the identical connection string "Data Source=tcp:DAD\\SQLEXPRESS;Initial Catalog=ChainPro_III;Integrated Security=False;User ID=correctName;Password=correctPassword" string. I have checked protocols on servers an clients, they are all set to tcp/ip.
    Saturday, October 15, 2011 8:17 PM

Answers

  • Hi Genealogist,

        The Persist Security Info property specifies whether the data source can persist sensitive authentication information such as a password.

        The information is returned to the application data objects after the call to open a connection, so that it can be re-used. If the setting is False then this information is discarded after the call. It's not automatically passed on to any other systems.

        The default setting of the property is false.

    I hope these information can be useful.


    Allen Li [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Allen_MSDNModerator Monday, October 31, 2011 1:39 AM
    • Unmarked as answer by Genealogist Wednesday, November 2, 2011 6:05 PM
    • Marked as answer by Genealogist Wednesday, November 2, 2011 6:05 PM
    Thursday, October 27, 2011 2:37 AM
    Moderator
  • Hi Genealogist,

          Please double check your connection string. You can use the VS's Server Explorer to make sure that the connection string is right. Right click the 'Data Connections' in the Server Explorer and click 'Add Connection', then select the proper DB Provider and input your user name and password, click Test button. If you can connect successfully, you can get the correct connection string at the Property Window.

    Best Regards


    Allen Li [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.



    Friday, October 21, 2011 2:10 AM
    Moderator

All replies

  •  

    Hi Genealogist,

            You said you can connection to a different machine’s database by SQL SERVER Management Studio, but you can’t connect to it in application, could you please provide some about the error information or exception information that appears when you connect to the database, so I can help you more effective and better.

     

    Best Regards,


    Allen Li [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    Tuesday, October 18, 2011 8:29 AM
    Moderator
  • Here is, what I get:

    System.Data.SqlClient.SqlException was unhandled
      Message="Cannot open database \"ChainPro_III\" requested by the login. The login failed.\r\nLogin failed for user 'Genealogist'."
      Source=".Net SqlClient Data Provider"
      ErrorCode=-2146232060
      Class=11
      LineNumber=65536
      Number=4060
      Procedure=""
      Server="tcp:ESTHER-NEW\\SQLEXPRESS"
      State=1
      StackTrace:
           at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
           at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
           at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
           at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK)
           at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject)
           at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart)
           at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
           at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
           at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
           at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
           at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
           at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
           at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
           at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
           at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
           at System.Data.SqlClient.SqlConnection.Open()
           at SQL_ServerExplorer.Form1.lbServers_Click(Object sender, EventArgs e) in C:\Users\Ralph\Documents\Visual Studio 2008\Projects\SQL_ServerExplorer\SQL_ServerExplorer\Form1.cs:line 86
           at System.Windows.Forms.Control.OnClick(EventArgs e)
           at System.Windows.Forms.ListBox.WndProc(Message& m)
           at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
           at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
           at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
           at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
           at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
           at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
           at SQL_ServerExplorer.Program.Main() in C:\Users\Ralph\Documents\Visual Studio 2008\Projects\SQL_ServerExplorer\SQL_ServerExplorer\Program.cs:line 18
           at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
           at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
           at System.Threading.ThreadHelper.ThreadStart()
      InnerException:

    Thursday, October 20, 2011 5:57 PM
  • Hi Genealogist,

          Please double check your connection string. You can use the VS's Server Explorer to make sure that the connection string is right. Right click the 'Data Connections' in the Server Explorer and click 'Add Connection', then select the proper DB Provider and input your user name and password, click Test button. If you can connect successfully, you can get the correct connection string at the Property Window.

    Best Regards


    Allen Li [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.



    Friday, October 21, 2011 2:10 AM
    Moderator
  • Thanks Allen,

     

    that did solve it somewhat. It wants a "Persist Security Info=True" in the connection string, which we never had before. When I add this, it works. But I don't understand it. I never had it before. Can you explain, please?

    Genealogist

    Wednesday, October 26, 2011 6:52 PM
  • Hi Genealogist,

        The Persist Security Info property specifies whether the data source can persist sensitive authentication information such as a password.

        The information is returned to the application data objects after the call to open a connection, so that it can be re-used. If the setting is False then this information is discarded after the call. It's not automatically passed on to any other systems.

        The default setting of the property is false.

    I hope these information can be useful.


    Allen Li [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Allen_MSDNModerator Monday, October 31, 2011 1:39 AM
    • Unmarked as answer by Genealogist Wednesday, November 2, 2011 6:05 PM
    • Marked as answer by Genealogist Wednesday, November 2, 2011 6:05 PM
    Thursday, October 27, 2011 2:37 AM
    Moderator