SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Guru quenting's Avatar
    Join Date
    Dec 2002
    Location
    Switzerland
    Posts
    735
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    mysql connection pooling, and transaction mechanism

    hello,
    i am somehow new to php-mysql programming, and coming from a J2EE-JDBC-Oracle environment, there's a few concepts i am surprised not to see any comments about :

    - Connection pooling : on an oracle database it's been shown that the time to get a connection was long enough to care about how many connections are open on a database and how they are managed. So is there a way to manage connections to mysql (set a max number, reuse some of them across different user sessions maybe), is there any benefit to it, and what is the performance difference when using pconnect / connect.

    - Transaction mechanism : is there an easy way with php/mysql (or maybe an existing script) to manage transactions, ie to define a set of queries that must be run as a whole or, if one of them fails, no one should be executed (rollback mechanism).

    Thanks
    Quentin

  2. #2
    SitePoint Guru
    Join Date
    Feb 2002
    Posts
    625
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by quenting
    - Transaction mechanism : is there an easy way with php/mysql (or maybe an existing script) to manage transactions, ie to define a set of queries that must be run as a whole or, if one of them fails, no one should be executed (rollback mechanism).

    Thanks
    Quentin
    Yes there is, in fact, you might want to take a look at Vincent's Eclipse library, which will also allow database abstraction to a certain extent. The link is in my signature, using this library you can easily use transactions (which of course can be done just as easily using the php functions directly).

    About the difference between pconnect and connect, i don#t think there really is a prefomance issue, however, it is questionable how long your Webserver will stay alive when using pconnect. Somewhere in the API Documentation of Eclipse a similar note is brought to attention.


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
  •