Monday, March 26, 2012

opening a db on network path?[sql servr 05]

hi ,
ok i thought it was as simple as putting the path to the db into
AttahDbFileName , but it does'nt work.
I get " is on a network path and this is not supported"
I tried messing with the surface area cfg , no change. Could someone
give me a pointer as to what i have to do to add a database that is on
a network?
Also , The "server" computer that does have the database has SQLSERVER
05 exp. installed. But "client" computer that tries to connect to this
"server" also has SQLSERVER 05 exp. installed , so maybe its using the
wrong instance of the service?
My connection string looks like this:
"Data Source=.\SQLEXPRESS;AttachDbFilename=\\Gidlaptop\d ata (e)\Gid\My
Creations\Hotel Management Studio\HotelManager.Core\bin\Debug
\DataServices\HTLDATA.mdf;Integrated Security=True;User
Instance=True";
[using C# under .NET 2.0]
Thanks so much!
Gideon
try to change the trace flag 1807:
dbcc traceon (1807,-1)
then attach the database using the sp_attach procedure.
I think the user instance option will not be supported in this scenario. you
have to attach the database into SQL Server and keep the database in SQL
Server.
also a user instance as a great impact on the performance.
when there is no connection, SQL Server detach the database. when a new
connection is created, SQL Server attach the database again... this is a big
overhead.
"giddy" <gidisrael@.gmail.com> wrote in message
news:1182001893.244273.221370@.j4g2000prf.googlegro ups.com...
> hi ,
> ok i thought it was as simple as putting the path to the db into
> AttahDbFileName , but it does'nt work.
> I get " is on a network path and this is not supported"
> I tried messing with the surface area cfg , no change. Could someone
> give me a pointer as to what i have to do to add a database that is on
> a network?
> Also , The "server" computer that does have the database has SQLSERVER
> 05 exp. installed. But "client" computer that tries to connect to this
> "server" also has SQLSERVER 05 exp. installed , so maybe its using the
> wrong instance of the service?
> My connection string looks like this:
> "Data Source=.\SQLEXPRESS;AttachDbFilename=\\Gidlaptop\d ata (e)\Gid\My
> Creations\Hotel Management Studio\HotelManager.Core\bin\Debug
> \DataServices\HTLDATA.mdf;Integrated Security=True;User
> Instance=True";
> [using C# under .NET 2.0]
> Thanks so much!
> Gideon
>
|||hi ,
thanks so much for replying. I'm almost finished making a really huge
app and this is the last step , I really thought this was simple so i
did'nt bother to look into this earlier! so i think i'm in a little
trouble!
I did a little searching, and saw the KB
But I'm really sorry i dont understand this , How and where do i run
those functions , a stored procedure? , i tried searching google , i
dont see sp_attach_db in the T-SQL reference. Could someone tell me
what i have to read to know how to run the aforementioned procedures?
Gideon
|||read this:
http://www.databasejournal.com/features/mssql/article.php/2224361
but, why do you want to access a database stored in an UNC path?
its a recommended setup for performance reason.
also there is a risk with this setup in case of network failure.
I recommend to copy the database locally on the server where SQL express is.
or use a remote SQL server (SQL Server is installed on the server A and the
application on the server B)
in the case of a remote server the user instance option doesn't works.
"giddy" <gidisrael@.gmail.com> wrote in message
news:1182016131.904940.224060@.x35g2000prf.googlegr oups.com...
> hi ,
> thanks so much for replying. I'm almost finished making a really huge
> app and this is the last step , I really thought this was simple so i
> did'nt bother to look into this earlier! so i think i'm in a little
> trouble!
> I did a little searching, and saw the KB
> But I'm really sorry i dont understand this , How and where do i run
> those functions , a stored procedure? , i tried searching google , i
> dont see sp_attach_db in the T-SQL reference. Could someone tell me
> what i have to read to know how to run the aforementioned procedures?
> Gideon
>
|||hi,
thanks again for replying.
I need for the database to be accessed via a UNC path because one of
my software requirements are that it should work over a network.(Its a
hotel manager). This seems like something essential to me! A DB should
be accssible over a network!? Are'nt databases generally used over a
network!?
I initially started working with an accss DB. Then , i was told to
move to sql , and that i would have no worries for the networking
since slq server has to only be installed on the machine that contains
it! =S

>I recommend to copy the database locally on the server where SQL express is.
>or use a remote SQL server (SQL Server is installed on the server A and the
>application on the server B)
>in the case of a remote server the user instance option doesn't works.
I cant afford to make copies, since the app will run at any time on
any pc and it mantains a cache in memory.When one client changes
data , i've even written classes that notify the app on the "server"
pc that broadcasts a "Reload" message.
By remote server , do you mean i need to have sql server on the
"server" pc(the one that contains the db) *and* the "client" pc?(the
one that accesses the db on the server) I did have sql server on BOTH
the pcs when i got the exception i mentioned! How do i call the
correct sql service? And which one do i call?
thanks so much
Gideon
|||It has nothing to do with your app being run as server app or client app.
1. It is the SQL Server/Express' requirement that its data file
(*.mdf/*.ldf) MUST be on a local drive of the computer where SQL
Server/Express is installed. That is how SQL Server/Express designed, no
matter what you do, you have to meet the requirement. Period.
2. Your app, whether it is server app or client app, does not access *.mdf
file to access data. It access SQL Server/Express for the data. No
application can use *.mdf file but SQL Server/Express.
3. When you "install" your app to a network drive (I do not know how you do
it), it does not necessarily make it "server" application. Say, you place
your .NET app's *.exe on a network drive to your computer, and run it on
your computer, this is not much different froom you run it from your own
computer, except the code is loaded from the network (you need configure
..NET code security in this case), the app is still sits in memory of your
computer and run locally.
4. Make sure your app really needs to use SQ: Server Express' "USER
INSTANCE". You only need to have "AttachDBFile=..." in connectionString
when you use "User Instance". Otherwise, there is no need "attach" a
database to SQL Server everytime your app connects to SQLServer/Express. I
am sure if you really mean to use "User Instance", then you know it only
allows single user access to the database (the current Windows log on user
who runs the application).
"giddy" <gidisrael@.gmail.com> wrote in message
news:1182001893.244273.221370@.j4g2000prf.googlegro ups.com...
> hi ,
> ok i thought it was as simple as putting the path to the db into
> AttahDbFileName , but it does'nt work.
> I get " is on a network path and this is not supported"
> I tried messing with the surface area cfg , no change. Could someone
> give me a pointer as to what i have to do to add a database that is on
> a network?
> Also , The "server" computer that does have the database has SQLSERVER
> 05 exp. installed. But "client" computer that tries to connect to this
> "server" also has SQLSERVER 05 exp. installed , so maybe its using the
> wrong instance of the service?
> My connection string looks like this:
> "Data Source=.\SQLEXPRESS;AttachDbFilename=\\Gidlaptop\d ata (e)\Gid\My
> Creations\Hotel Management Studio\HotelManager.Core\bin\Debug
> \DataServices\HTLDATA.mdf;Integrated Security=True;User
> Instance=True";
> [using C# under .NET 2.0]
> Thanks so much!
> Gideon
>
|||hi Jeje, i did'nt see your reply. I only saw John Bells post before
sending my earlier post.
Thank you oh so much. It works perfectly! I used the second connection
string you mentioned , the attaching commands worked perfectly too!
Also, Thank you Norman for clearing things up. Heres where my mis
understading was:

>2. Your app, whether it is server app or client app, does not access *.mdf
>file to access data. It access SQL Server/Express for the data. No
>application can use *.mdf file but SQL Server/Express.
I just kept thinking everyone said i should be working over a network
and that it was impossible, but it was more like i should'nt access a
file over a network , but call the server.
Just one more things and then i'm done nagging you guys!

>. When you "install" your app to a network drive (I do not know how you do
>it), it does not necessarily make it "server" application. Say, you place
>your .NET app's *.exe on a network drive to your computer, and ****run it on
>your computer, this is not much different froom you run it from your own
>computer, except the code is loaded from the network ******(you need configure
>.NET code security in this case), the app is still sits in memory of your
>computer and run locally.
(Slightly off topic! =(
Acutally , when the settings file tells the app its a server or a
client , many parts of the program run differently. I really would'nt
want someone running a "server app" instance from a "client" computer.
What security do i have to configure?
Thanks a million!
Gideon

No comments:

Post a Comment