Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > website and database on same server

Reply
Thread Tools

website and database on same server

 
 
=?Utf-8?B?Tkg=?=
Guest
Posts: n/a
 
      06-11-2007
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
 
Reply With Quote
 
 
 
 
=?Utf-8?B?TWFuaXNoIEJhZm5h?=
Guest
Posts: n/a
 
      06-11-2007
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...look-like.html
--
Hope this helps.
Thanks and Regards.
Manish Bafna.
MCP and MCTS.



"NH" wrote:

> 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

 
Reply With Quote
 
 
 
 
=?Utf-8?B?Tkg=?=
Guest
Posts: n/a
 
      06-11-2007
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.

"Manish Bafna" wrote:

> 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...look-like.html
> --
> Hope this helps.
> Thanks and Regards.
> Manish Bafna.
> MCP and MCTS.
>
>
>
> "NH" wrote:
>
> > 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

 
Reply With Quote
 
 
 
Reply

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Database Database Database Database scott93727@gmail.com Computer Information 0 09-27-2012 02:43 AM
DataBase DataBase DataBase DataBase scott93727@gmail.com Computer Information 0 09-26-2012 09:40 AM
1 Gridview. Dropdown A is column from database, Dropdown B is column from database, Data in A and B must be from same row. anonymoushamster@gmail.com ASP .Net 2 11-07-2007 12:40 PM
Website with TreeView works fine in development, but crashes in a 'secure' website on server. Mufasa ASP .Net 0 06-10-2007 10:17 PM
Local LAN Access - Works for WinXP, No Go For Linux - Same Server,Same Laptop Marc Schwartz Cisco 0 06-18-2005 02:28 PM



Advertisments