Windows Develop Bookmark and Share   
 index > ClickOnce and Setup & Deployment Projects > can clients access remote database (SQL)....?
 

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

Iwant the clients toinstall an aplication that uses a database, without actualy installing the database onthe 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.

R.E  Wednesday, March 15, 2006 9:13 AM

Works just like any other client app.

bhanf  Thursday, March 16, 2006 4:09 PM
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
СђrΐsτσρhΞr ScЋδlτξη  Saturday, March 25, 2006 4:48 PM

Works just like any other client app.

bhanf  Thursday, March 16, 2006 4:09 PM

Well, the thing is that i have my application (window form) working just fine on my computer.but whensomeone installit 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 knowwhat exactly might be the problem.

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

Anyway, thanks for your help and hope i can get moresupportsoon.

R.E  Thursday, March 16, 2006 5:39 PM
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.
Vi_Tinh  Thursday, March 16, 2006 9:23 PM

Although i have written manyapplicationso far, i have never actualy written anything that is based onServer/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.

R.E  Friday, March 17, 2006 9:50 AM
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
Vi_Tinh  Friday, March 17, 2006 10:05 PM

sorry Vi_Tinhbut 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 mySQLserver 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,

R.E  Tuesday, March 21, 2006 9:10 AM
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.
СђrΐsτσρhΞr ScЋδlτξη  Friday, March 24, 2006 6:07 AM

thank you christopher.

Ihave 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 knowis the following:
- first of all is theresomething wrong withmy 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

R.E  Saturday, March 25, 2006 9:43 AM
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
СђrΐsτσρhΞr ScЋδlτξη  Saturday, March 25, 2006 4:48 PM
John Skaria  Wednesday, July 22, 2009 4:40 AM

You can use google to search for other answers

Custom Search

More Threads

• Deployment on Windows 2000: Application requires Microsoft.Vbe.Interop Version 11.0.0.0 be installed in GAC
• VS2008 Is there a way to automatically update the assembly version on com class projects every time you build
• Reg: Registarion Key check and Roll back
• Can't publish using August CTP
• MSI auto-update?
• Embedded Manifest Entry Gone
• Updating ClickOnce App
• Error when opening, Administrator, click once, .net 2.0
• deploying clickonce app on more than 1 server question
• running 2 .msi's at the same time.