Misbah
asked on
sqlexpress connection string
Hi all...
1)
connectionString="Data Source=.\SQLEXPRESS;Attach DbFilename =E:\mydb.M DF;Integra ted Security=True;Connect Timeout=60;User Instance=True"
2)
connectionString="Data Source=localhost\SQLEXPRES S;Initial Catalog=mydb;Integrated Security=True"
what is the difference in these .. which one is best .. and when shall i use each one of them ?
what about deployment .. are they the same ?
thanks.
1)
connectionString="Data Source=.\SQLEXPRESS;Attach
2)
connectionString="Data Source=localhost\SQLEXPRES
what is the difference in these .. which one is best .. and when shall i use each one of them ?
what about deployment .. are they the same ?
thanks.
The second one is the best because it is refering to the database name not the database file name.
It is not good to refer to the database Data file directly.
It is not good to refer to the database Data file directly.
ASKER
ok.. thanks .. but i need more information about this..
what is the difference ?? there must be a situation where one is more appropriate than the other ?? right ??
for example .. in the first one.. will the database file be attached to the server every time the programs run .. and
deattached when the program is finished ??
I need some explanation of how these things work
what is the difference ?? there must be a situation where one is more appropriate than the other ?? right ??
for example .. in the first one.. will the database file be attached to the server every time the programs run .. and
deattached when the program is finished ??
I need some explanation of how these things work
ASKER
what is this !!
did u check it ur self ???
I couldn't find any information there ... it has only sponsored links !!! ???
and plz.. I am here to save my time and increase my productivity
did u check it ur self ???
I couldn't find any information there ... it has only sponsored links !!! ???
and plz.. I am here to save my time and increase my productivity
Wow how come this looks totally different now.
ok this is what you need to know.
which eliminates the need to have a DBA attach the database files to a server before they can be used. When the AttachDBFilename keyword is included in a connection string, the specified file is attached to the SQL Server instance and the client is connected to the newly attached database
The |DataDirectory| is a shortcut for the directory where the program opening the connection lives. To attach a file in a different directory, you must provide the full path to the file. The log file in this case is named Database1_log.ldf and is located in the same directory as the database file. If the database file is already attached to the SQL Server instance, the connection is opened to the existing database.
This is a great option because if you are an administrator, you can attach and connect to a database file by specifying the file name in the connection string in your application. Many developers run as administrators on their systems so AttachDBFilename works well for them. The problem is that Microsoft strongly recommends NOT running as an administrator because this reduces the amount of damage that can be inflicted by a virus. What we need in this case is a way to use AttachDBFilename without being a member of the Windows Administrators group. The solution is the User Instance feature.
But if you have the database already attached to your sql server than why using this option and this option is extended only in .netframework 2.0
ok this is what you need to know.
which eliminates the need to have a DBA attach the database files to a server before they can be used. When the AttachDBFilename keyword is included in a connection string, the specified file is attached to the SQL Server instance and the client is connected to the newly attached database
The |DataDirectory| is a shortcut for the directory where the program opening the connection lives. To attach a file in a different directory, you must provide the full path to the file. The log file in this case is named Database1_log.ldf and is located in the same directory as the database file. If the database file is already attached to the SQL Server instance, the connection is opened to the existing database.
This is a great option because if you are an administrator, you can attach and connect to a database file by specifying the file name in the connection string in your application. Many developers run as administrators on their systems so AttachDBFilename works well for them. The problem is that Microsoft strongly recommends NOT running as an administrator because this reduces the amount of damage that can be inflicted by a virus. What we need in this case is a way to use AttachDBFilename without being a member of the Windows Administrators group. The solution is the User Instance feature.
But if you have the database already attached to your sql server than why using this option and this option is extended only in .netframework 2.0
check these link for further information
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsse/html/sseoverview.asp
http://msdn2.microsoft.com/en-us/library/ms143684.aspx
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsse/html/sseoverview.asp
http://msdn2.microsoft.com/en-us/library/ms143684.aspx
Do you need further assitance ?
ASKER
well ..
my friend u gave me links and huge material to read .. I just need a short answer from an expert who really understand this .. in ur first post u said that the second option is the best .. and in a next post u said the frst is great ... so I am confused now !!!!
my question is still not answered.. :
what is the difference in these (performance, security, deployment .....) .. which one is best .. and when shall i use each one of them ?
what about deployment .. are they the same ?
my friend u gave me links and huge material to read .. I just need a short answer from an expert who really understand this .. in ur first post u said that the second option is the best .. and in a next post u said the frst is great ... so I am confused now !!!!
my question is still not answered.. :
what is the difference in these (performance, security, deployment .....) .. which one is best .. and when shall i use each one of them ?
what about deployment .. are they the same ?
imran gave you the answer in his very first comment.
The first form is bad. Do not use it.
The second form is good. Use it.
Is that short enough?
The first form is bad. Do not use it.
The second form is good. Use it.
Is that short enough?
ASKER
ok .. thanks Kenpem ..
your answer is too short .. it does not really cover my question above :)
what is the difference in these (performance, security, deployment .....) .. which one is best .. and when shall i use each one of them ?
u answered which one is the best ... but based on what !!!
I need a good explanation .. no problem how long or short it is .. but remeber I don't like reading 15 pages of MSDN to get an answer that can be in only 5 lines :)
your answer is too short .. it does not really cover my question above :)
what is the difference in these (performance, security, deployment .....) .. which one is best .. and when shall i use each one of them ?
u answered which one is the best ... but based on what !!!
I need a good explanation .. no problem how long or short it is .. but remeber I don't like reading 15 pages of MSDN to get an answer that can be in only 5 lines :)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
hi kenpem,
can you post any comment in below link so that i can close that
https://www.experts-exchange.com/questions/21898249/Check-this-link.html
can you post any comment in below link so that i can close that
https://www.experts-exchange.com/questions/21898249/Check-this-link.html
ASKER
ok thanks :)
Dr-H, thanks for the points. However, imran_fast actually earned most of them - can you re-allocate them to him? Or at least split them?
ASKER
yes.. actually .. i was planing to split the points .. but since i am new here .. i don't know how to do this ..
when I clicked 'accept answer' .. I didn't see the spilt options !!
I will check now again .. to see how to do this .
when I clicked 'accept answer' .. I didn't see the spilt options !!
I will check now again .. to see how to do this .
ASKER
I could not find a way .. plz .. tell me how to do it
ASKER
Data Source=.\SQLEXPRESS
in both