can clients access remote database (SQL)....?

I want the clients to install an aplication that uses a database, without actualy installing the database on the local computer. therefore clients will be accessing the database remotly from our server.

the problem is that it seems that clickonce does not support this service.

please provide me with any tips, hints or information related to this subject.

thanks for your help.



Answer this question

can clients access remote database (SQL)....?

  • Marc antoine

    Well, the thing is that i have my application (window form) working just fine on my computer. but when someone install it through the network (using clickOnce) and run it, it gives an error saying that it can not connect to SQL.

    Do i have to give permission on my SQL server, do i have to customise the sql connection string in the code.... I really don't know what exactly might be the problem.

    Thought someone here might have had the same issue and knew how to fix it!

    Anyway, thanks for your help and hope i can get more support soon.


  • MSDNDDONG

    Works just like any other client app.



  • DMB

    Does your application have full trust permission Can you connect to the database from another machine using the same connection string I would check those things first.
  • biggermouth

    The reason that it's failing is that you're trying to use an IP address in conjunction with a named instance name. You can use one or the other. If you want to use an IP address, then the port number is used to identify the instance of SQL server that you want to connect to. The port number can be determined by issuing the following command against the database:

    Use master
    Go
    Xp_readerrorlog

    This will give you a heap of information, but the line you're looking for is that below:
    2006-03-24 14:47:38.290 Server Server is listening on [ ***.***.***.*** <ipv4> 99999].


    Note the port number (in purple above), along with the IP address. Use the following connection string, with the IP address and port numbers replaced using the info from above:

    Try This connection string:
    DATABASE=
    master;Network=DBMSSOCN;Address=***.***.***.***,99999;Integrated Security=SSPI;

    This should then work.

    Reference: http://support.microsoft.com/default.aspx scid=kb;en-us;823938


  • Sebastien LEIX

    Although i have written many application so far, i have never actualy written anything that is based on Server/Client communication where a database is used.

    Please send any example(code... connection string) or tutorial that is related to this subject.

    I appriciate your help and patience.


  • pouncer

    Any .Net application that interact with a database usually have a section in the app.config or some sort of a configuration file that contains the connection information to the database. There are samples shipped with the framework SDK. Here is a link that you can use as a starting point: http://www.codeproject.com/cs/database/DatabaseAcessWithAdoNet1.asp
  • Mark Jerrom

    thank you christopher.

    I have my connection string set (i think)
    here's how it looks like:

    DataBase=master; Trusted_Connection=Yes;
    Network Address= *** . *** . *** . ***,1433\SQLEXPRESS ;Network Library = dbmssocn

    the application works just fine on my computer using this string.

    now the new error, when i try to open it remotly from another computer, is the following:

    '''''''''''''''''''''''
    Application attempted to perform an operation not allowed by the security policy. To grant this application the required permission, contact your system administrator, or use the microsoft .NET Framework Configuartion tool.

    ************** Exception Text **************
    System.Security.SecurityException: Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
    at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)
    at System.Security.PermissionSet.Demand()
    at System.Data.Common.DbConnectionOptions.DemandPermission()
    .....

    ******************
    '''''''''''''''''''''

    I tryed different things to adjust the security policy on the server but it always gives me the same error.

    what i need to know is the following:
    - first of all is there something wrong with my connection string
    - if anyone had a similar problem, how did you solve it
    - a simple walkthrough on how to adjust my security
    - could it be the security on the clients computer that cause this problem

    thank you all for your help.

    regards


  • rwrench

    Two things to note:
    1. Named Pipes does not work when configured as the only client connectivity option for ASP.NET running in default circumstances. Have a look at the following article:

      BUG: Named pipes do not work when worker process runs under ASPNET account
      http://support.microsoft.com/default.aspx scid=kb;en-us;Q315159
      Check that you are able to use TCP/IP connections instead
    2. Create a test file on your PC named "connection.udl" - it's just an empty text file. Run this file, and set the configuration parameters inside it to create a connection string. Perform a test connection after you have finished entering database details and connnection parameters. When you close the dialog, the udl file will now contain a connection string. Remove the "provider=" parameter, and you can then use it with a SqlConnection's ConnectionString parameter.


  • Kaboo

    sorry Vi_Tinh but this link you have provided didn't help much.

    here's the error that i get when i try to open the application from another computer after intalling it using clickOnce:

    ************** Exception Text **************
    System.Data.SqlClient.SqlException: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
    at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
    at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
    .....
    ....

    **********************************************

    Now i think that i have a problem either in my SQLserver security (permissons) Or in my Sql connection string. Or maybe the error is for a diffrent reason.

    anyway, please provide me with any help conserning the cause of this error and how to solve it.

    thank you.

    by the way, here is how my connection string looks like:
    "Server=servername; DataBase=databasename; Integrated Security = SSPI"

    regards,


  • can clients access remote database (SQL)....?