website and database on same server

Discussion in 'ASP .Net' started by =?Utf-8?B?Tkg=?=, Jun 11, 2007.

  1. 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
     
    =?Utf-8?B?Tkg=?=, Jun 11, 2007
    #1
    1. Advertising

  2. 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
    --
    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
     
    =?Utf-8?B?TWFuaXNoIEJhZm5h?=, Jun 11, 2007
    #2
    1. Advertising

  3. 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/what-should-my-connection-string-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
     
    =?Utf-8?B?Tkg=?=, Jun 11, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Krick
    Replies:
    1
    Views:
    1,464
    John C. Bollinger
    Aug 15, 2003
  2. Keith
    Replies:
    1
    Views:
    2,328
    Keith
    Jul 3, 2006
  3. Replies:
    5
    Views:
    340
    Alf P. Steinbach
    Feb 6, 2006
  4. Mufasa
    Replies:
    5
    Views:
    292
    Mark Rae
    Apr 18, 2007
  5. Mufasa
    Replies:
    0
    Views:
    822
    Mufasa
    Jun 10, 2007
Loading...

Share This Page