Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / June 2007

Tip: Looking for answers? Try searching our database.

website and database on same server

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
NH - 11 Jun 2007 08:56 GMT
Hi,

I have an asp.net 2.0 website and a sql database on the same server. In the
web config file I have set up a connection to the database using this
connection string....

connectionString="Data Source=myServer;Initial Catalog=MyDatabase;Persist
Security Info=True;User ID=LoginUser;Password=LoginPassword"
providerName="System.Data.SqlClient" />

Should the server be referenced using "localhost" or something? Would that
be more efficient? If I use the server name does that incur a network
overhead as asp.net uses the network to find the server without knowing it
doesnt actually have to because the database is on the same server as the
website.

I suppose the question is what it the best way to set up a connection string
to reference a database on the same server as asp.net.

thanks
Manish Bafna - 11 Jun 2007 09:57 GMT
Hi,
If you are running SQL Server or MSDE on the same machine as your ASP pages,
you are probably tempted to use the hostname "localhost." This doesn't always
work, due to different configuration issues, so try (local), 127.0.0.1, the
actual host name, or simply a period (".").
ref:http://databases.aspfaq.com/database/what-should-my-connection-string-look-like.html
Signature

Hope this helps.
Thanks and Regards.
Manish Bafna.
MCP and MCTS.

> Hi,
>
[quoted text clipped - 16 lines]
>
> thanks
NH - 11 Jun 2007 10:13 GMT
Thanks, would there be any performance benefit of using (local),"." or the IP
address over using the server name?

I thought by maybe using (local) or "." that that would improve performance
because asp.net would know the database is on the same server rather than
using the network to find the server.

> Hi,
> If you are running SQL Server or MSDE on the same machine as your ASP pages,
[quoted text clipped - 23 lines]
> >
> > thanks

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.