SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Jan 2001
    Location
    Helsingborg, Sweden
    Posts
    31
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm not sure how this is supposed to be done. Right now I'm just doing a

    $db = mysql_connect( $dbServer, $dbUsername, $dbPassword );
    mysql_select_db( $dbName, $db ) );

    at the top of every page that accessed the database.

    I've read somewhere that the database connections add a lot of overhead. Is that true? I've also read about establishing persistent connections with pconnect(), but are there any downsides to using them? It almost sounds to good to be true.
    "Some people play hard to get - I play hard to want."

  2. #2
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Indeed, persistent connections are too good not to use!

    Basically, the only downside is the persistent connections. If for some reason you don't want connections open on your MySQL server all the time, you might not want to use it. Otherwise, there's no reason not to!
    Kevin Yank
    CTO, sitepoint.com
    I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
    Baby’s got back—a hard back, that is: The Ultimate CSS Reference

  3. #3
    SitePoint Enthusiast
    Join Date
    Nov 2000
    Location
    Allentown PA
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you have a LOT of persistent connections, they take up some resources. But then you have to gauge the difference between taking up resources with pconnect's and the overhead of establishing a new connection.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •