| Author |
Topic |
|
mathmax
Yak Posting Veteran
95 Posts |
Posted - 2007-09-18 : 07:36:19
|
Hello,I've developed an application with .NET and I would like this application to access a SQL server database which is situated on a remote machine. I've set the connectionString like this :\\server\SQLExpress ...but it doesn't work Is there anything else to do ?I guess I have to set some trust settings but I don't know how...Could anyone help me to solve this problem ?Thank you in advance,mathmax |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-09-18 : 07:42:33
|
www.connectionstrings.com E 12°55'05.25"N 56°04'39.16" |
 |
|
|
mathmax
Yak Posting Veteran
95 Posts |
Posted - 2007-09-18 : 09:24:19
|
Hello,I write this connectionstring :Server=\\server\SQLExpress;Database=myDataBase;Trusted_Connection=True;but I get the following error : |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-09-18 : 09:32:09
|
According to the link I provided, your connection string should look something similar to"Provider=SQLNCLI;Server=ServerMachineName\SQLExpress;Database=myDataBase;Trusted_Connection=True;" E 12°55'05.25"N 56°04'39.16" |
 |
|
|
mathmax
Yak Posting Veteran
95 Posts |
Posted - 2007-09-18 : 10:00:00
|
In fact I use nhibernate to access the database. There is already a provider for nhibernate.When I add "Provider=SQLNCLI;" in the connectionstring, it is said that provider is not a known keyword.The connection settings for nhibernate look like this : <nhibernate> <add key="hibernate.connection.provider" value="NHibernate.Connection.DriverConnectionProvider"/> <add key="hibernate.dialect" value="NHibernate.Dialect.MsSql2005Dialect"/> <add key="hibernate.connection.driver_class" value="NHibernate.Driver.SqlClientDriver"/> <add key="hibernate.connection.connection_string" value="Server=\\Server\SQLEXPRESS;Initial Catalog=MyDatabase;Integrated Security=SSPI"/> </nhibernate>but I still get the same error message : |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-09-18 : 10:18:03
|
You are still using UNC path to server. Try to remove double \ and try without them.<add key="hibernate.connection.connection_string" value="Server=Server\SQLEXPRESS;Initial Catalog=MyDatabase;Integrated Security=SSPI"/> E 12°55'05.25"N 56°04'39.16" |
 |
|
|
mathmax
Yak Posting Veteran
95 Posts |
Posted - 2007-09-18 : 10:30:28
|
| Yes, I tried this but I get the same error message (error 26 instead of error 5 in the above message).Perhaps there is some trust properties or admission to define for the database ? |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-09-18 : 10:37:39
|
And what exactly is "Error 26"? E 12°55'05.25"N 56°04'39.16" |
 |
|
|
mathmax
Yak Posting Veteran
95 Posts |
Posted - 2007-09-18 : 10:54:16
|
| error 26 : occurs when I remove "\\": invalid server locationerror 5 : occurs with "\\": invalid parameter. |
 |
|
|
mathmax
Yak Posting Veteran
95 Posts |
Posted - 2007-09-18 : 13:19:02
|
| No idea of the problem ? |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-09-18 : 13:43:18
|
The Error 26 is more correct! You should not have double backslash characters.Is the server where SQLExpress is installed named "Server"? E 12°55'05.25"N 56°04'39.16" |
 |
|
|
mathmax
Yak Posting Veteran
95 Posts |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
mathmax
Yak Posting Veteran
95 Posts |
Posted - 2007-09-18 : 16:34:04
|
| It is a laptop called rar. Why ? |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-09-18 : 16:45:57
|
Because the title says you are trying to connect to a REMOTE sql server installation, not local on your laptop.Local computer can be reached with<add key="hibernate.connection.connection_string" value="Server=(local)\SQLEXPRESS;Initial Catalog=MyDatabase;Integrated Security=SSPI"/>or<add key="hibernate.connection.connection_string" value="Server=.\SQLEXPRESS;Initial Catalog=MyDatabase;Integrated Security=SSPI"/>or<add key="hibernate.connection.connection_string" value="Server=127.0.0.1\SQLEXPRESS;Initial Catalog=MyDatabase;Integrated Security=SSPI"/> E 12°55'05.25"N 56°04'39.16" |
 |
|
|
mathmax
Yak Posting Veteran
95 Posts |
Posted - 2007-09-18 : 17:16:27
|
| yes all those connections string work on my laptop if I want to execute my program localy. But I want my laptop (in which the database is stored) to be the server and execute the program on a client machine. So the program have to access a remote database. |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-09-18 : 17:19:57
|
Ok, do your laptop have a firewall?SQL Server listens by default on port 1433.Are you connected to the same net and subnet mask as the computer calling your laptop?This could work<add key="hibernate.connection.connection_string" value="Server=rar\SQLEXPRESS;Initial Catalog=MyDatabase;Integrated Security=SSPI"/> E 12°55'05.25"N 56°04'39.16" |
 |
|
|
mathmax
Yak Posting Veteran
95 Posts |
Posted - 2007-09-18 : 19:09:17
|
| As I was saying, I've created exceptions in Windows Firewall.I also tried this connections string<add key="hibernate.connection.connection_string" value="Server=rar\SQLEXPRESS;Initial Catalog=MyDatabase;Integrated Security=SSPI"/>but get the same error...SQL Server listens by default on port 1433.Are you connected to the same net and subnet mask as the computer calling your laptop?What does that mean ? How can I check that ? |
 |
|
|
ValterBorges
Master Smack Fu Yak Hacker
1429 Posts |
Posted - 2007-09-18 : 19:19:54
|
| what do you get when you ping the machines one from the other.xx.xx.xx.xx is the ip of machine 2yy.yy.yy.yy is the ip of machine 1you can get the ip by running ipconfig /all at the dos prompt.run from machine2ping machine1.fullyqualifieddomainnameorping yy.yy.yy.yyrun from machine1ping machine2.fullyqualifieddomainnameorping xx.xx.xx.xx Have you checked out the surface area configuration for SQL 2K5.Make sure remote connections are allowed.http://www.developer.com/db/article.php/3496511Are both machines on a domain?same domain? if different domain do the domains have trust? Have you tried creating a sql server login and trying to login using a sql login instead of windows login?Is there a firewall between the machines? Try running a traceroute to see the ip hops.run the following at the command prompt-->> tracert ipaddressWhat response do you get when you try to telnet to the machine on port 1433?run the following at the command prompt-->> telnet ipaddress 1433 |
 |
|
|
mathmax
Yak Posting Veteran
95 Posts |
Posted - 2007-09-18 : 22:43:34
|
| ok, I started the sql server browser and it works. But i don't know why... |
 |
|
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2007-09-19 : 00:10:46
|
| It communicates with sql client and provides server connection info like port number. |
 |
|
|
Next Page
|