HighTechTalks DotNet Forums  

URGENT: ConnectionString for SQLServer db

Dotnet Framework (ADO.net) microsoft.public.dotnet.framework.adonet


Discuss URGENT: ConnectionString for SQLServer db in the Dotnet Framework (ADO.net) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Cirene
 
Posts: n/a

Default URGENT: ConnectionString for SQLServer db - 12-05-2007 , 06:33 PM






I developed my ASP.NET 2.0 web app using SQL Express. Now I'm moving it to
production.

On my web server I attached the SQL Express mdf database to a new SQL Server
database. The (example) SQL Server settings are:
DB Name: rnz_mydb
Server IP: sql123.MyHost.com
Login ID: rnz_admin
Db Type: MSSQL 2005

The current web.config connection string is this:
<connectionStrings>
<remove name="LocalSqlServer" />
<add name="LocalSqlServer" connectionString="Data
Source=.\SQLEXPRESS;AttachDbFilename=|DataDirector y|\zASPNETDB.MDF;Integrated
Security=True;Initial Catalog=ASPNETDB"
providerName="System.Data.SqlClient" />
<add name="ConnectionString" connectionString="Data
Source=.\SQLEXPRESS;AttachDbFilename=|DataDirector y|\zASPNETDB.MDF;Integrated
Security=True;Initial Catalog=ASPNETDB"
providerName="System.Data.SqlClient" />
</connectionStrings>

What should the connection string be now (to point to the new SQL SERVER
db)?

Thanks!



Reply With Quote
  #2  
Old   
W.G. Ryan
 
Posts: n/a

Default Re: URGENT: ConnectionString for SQLServer db - 12-06-2007 , 10:17 AM






Check www.connectionstrings.com
"Cirene" <test (AT) test (DOT) com> wrote

Quote:
I developed my ASP.NET 2.0 web app using SQL Express. Now I'm moving it to
production.

On my web server I attached the SQL Express mdf database to a new SQL
Server database. The (example) SQL Server settings are:
DB Name: rnz_mydb
Server IP: sql123.MyHost.com
Login ID: rnz_admin
Db Type: MSSQL 2005

The current web.config connection string is this:
connectionStrings
remove name="LocalSqlServer" /
add name="LocalSqlServer" connectionString="Data
Source=.\SQLEXPRESS;AttachDbFilename=|DataDirector y|\zASPNETDB.MDF;Integrated
Security=True;Initial Catalog=ASPNETDB"
providerName="System.Data.SqlClient" /
add name="ConnectionString" connectionString="Data
Source=.\SQLEXPRESS;AttachDbFilename=|DataDirector y|\zASPNETDB.MDF;Integrated
Security=True;Initial Catalog=ASPNETDB"
providerName="System.Data.SqlClient" /
/connectionStrings

What should the connection string be now (to point to the new SQL SERVER
db)?

Thanks!




Reply With Quote
  #3  
Old   
William \(Bill\) Vaughn
 
Posts: n/a

Default Re: URGENT: ConnectionString for SQLServer db - 12-06-2007 , 01:28 PM



A remote SQL Server database needs to be addressed in two ways:
1) The system or machine name. When the database was on the local system
this was "." but we have no way to know what that is. Let's say it's
"George".
2) The SQL Server Instance name. We have no way of knowing the instance name
on the target server would be. Let's say it's "Fred".

In this example the ConnectionString would look something like this:
"Server=George\Fred;integrated security=SSPI;initial catalog=ASPNETDB"

There is no need to reattach the database since you already attached it to
the remote server master database.

See Chapter 9 of my book.

hth

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------
"Cirene" <test (AT) test (DOT) com> wrote

Quote:
I developed my ASP.NET 2.0 web app using SQL Express. Now I'm moving it to
production.

On my web server I attached the SQL Express mdf database to a new SQL
Server database. The (example) SQL Server settings are:
DB Name: rnz_mydb
Server IP: sql123.MyHost.com
Login ID: rnz_admin
Db Type: MSSQL 2005

The current web.config connection string is this:
connectionStrings
remove name="LocalSqlServer" /
add name="LocalSqlServer" connectionString="Data
Source=.\SQLEXPRESS;AttachDbFilename=|DataDirector y|\zASPNETDB.MDF;Integrated
Security=True;Initial Catalog=ASPNETDB"
providerName="System.Data.SqlClient" /
add name="ConnectionString" connectionString="Data
Source=.\SQLEXPRESS;AttachDbFilename=|DataDirector y|\zASPNETDB.MDF;Integrated
Security=True;Initial Catalog=ASPNETDB"
providerName="System.Data.SqlClient" /
/connectionStrings

What should the connection string be now (to point to the new SQL SERVER
db)?

Thanks!



Reply With Quote
  #4  
Old   
Cirene
 
Posts: n/a

Default Re: URGENT: ConnectionString for SQLServer db - 12-06-2007 , 11:05 PM



Does attaching a database basically import it into an SQL Server DB, or does
it actually use the SQL Express mdf file?

"William (Bill) Vaughn" <billvaRemoveThis (AT) betav (DOT) com> wrote

Quote:
A remote SQL Server database needs to be addressed in two ways:
1) The system or machine name. When the database was on the local system
this was "." but we have no way to know what that is. Let's say it's
"George".
2) The SQL Server Instance name. We have no way of knowing the instance
name on the target server would be. Let's say it's "Fred".

In this example the ConnectionString would look something like this:
"Server=George\Fred;integrated security=SSPI;initial catalog=ASPNETDB"

There is no need to reattach the database since you already attached it to
the remote server master database.

See Chapter 9 of my book.

hth

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no
rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------
"Cirene" <test (AT) test (DOT) com> wrote in message
news:OlD5Ad5NIHA.4584 (AT) TK2MSFTNGP03 (DOT) phx.gbl...
I developed my ASP.NET 2.0 web app using SQL Express. Now I'm moving it
to production.

On my web server I attached the SQL Express mdf database to a new SQL
Server database. The (example) SQL Server settings are:
DB Name: rnz_mydb
Server IP: sql123.MyHost.com
Login ID: rnz_admin
Db Type: MSSQL 2005

The current web.config connection string is this:
connectionStrings
remove name="LocalSqlServer" /
add name="LocalSqlServer" connectionString="Data
Source=.\SQLEXPRESS;AttachDbFilename=|DataDirector y|\zASPNETDB.MDF;Integrated
Security=True;Initial Catalog=ASPNETDB"
providerName="System.Data.SqlClient" /
add name="ConnectionString" connectionString="Data
Source=.\SQLEXPRESS;AttachDbFilename=|DataDirector y|\zASPNETDB.MDF;Integrated
Security=True;Initial Catalog=ASPNETDB"
providerName="System.Data.SqlClient" /
/connectionStrings

What should the connection string be now (to point to the new SQL SERVER
db)?

Thanks!





Reply With Quote
  #5  
Old   
W.G. Ryan
 
Posts: n/a

Default Re: URGENT: ConnectionString for SQLServer db - 12-07-2007 , 10:38 AM



Attaching a file does effectively cause the Sql Server instance to 'use' the
file. Remember that real Sql Server datafiles are .mdf so yes, it ends up
using it as the data file.
"Cirene" <test (AT) test (DOT) com> wrote

Quote:
Does attaching a database basically import it into an SQL Server DB, or
does it actually use the SQL Express mdf file?

"William (Bill) Vaughn" <billvaRemoveThis (AT) betav (DOT) com> wrote in message
news:00E45622-F611-4FE6-8481-6596E93F9D38 (AT) microsoft (DOT) com...
A remote SQL Server database needs to be addressed in two ways:
1) The system or machine name. When the database was on the local system
this was "." but we have no way to know what that is. Let's say it's
"George".
2) The SQL Server Instance name. We have no way of knowing the instance
name on the target server would be. Let's say it's "Fred".

In this example the ConnectionString would look something like this:
"Server=George\Fred;integrated security=SSPI;initial catalog=ASPNETDB"

There is no need to reattach the database since you already attached it
to the remote server master database.

See Chapter 9 of my book.

hth

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no
rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------
"Cirene" <test (AT) test (DOT) com> wrote in message
news:OlD5Ad5NIHA.4584 (AT) TK2MSFTNGP03 (DOT) phx.gbl...
I developed my ASP.NET 2.0 web app using SQL Express. Now I'm moving it
to production.

On my web server I attached the SQL Express mdf database to a new SQL
Server database. The (example) SQL Server settings are:
DB Name: rnz_mydb
Server IP: sql123.MyHost.com
Login ID: rnz_admin
Db Type: MSSQL 2005

The current web.config connection string is this:
connectionStrings
remove name="LocalSqlServer" /
add name="LocalSqlServer" connectionString="Data
Source=.\SQLEXPRESS;AttachDbFilename=|DataDirector y|\zASPNETDB.MDF;Integrated
Security=True;Initial Catalog=ASPNETDB"
providerName="System.Data.SqlClient" /
add name="ConnectionString" connectionString="Data
Source=.\SQLEXPRESS;AttachDbFilename=|DataDirector y|\zASPNETDB.MDF;Integrated
Security=True;Initial Catalog=ASPNETDB"
providerName="System.Data.SqlClient" /
/connectionStrings

What should the connection string be now (to point to the new SQL SERVER
db)?

Thanks!







Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.