[freetds] Multiple Active Statements

Dario jenfiolo at yahoo.it
Wed Sep 24 16:57:05 EDT 2003


You are great!
thank you very much


 --- Daniel Fazekas <fdsubs at axelero.hu> ha scritto: > 
> 
> I guess that's because you are not actually opening
> multiple connections.
> 
> PHP has this not always convenient feature in that
> it caches the 
> database connection parameters, and if you try to
> open the same database 
> using the exact same parameters (host, login and
> password), instead of 
> opening a new link, it will just return the
> previously opened 
> connection's handle.
> 
> This is useful for programmers who are lazy about
> passing the connection 
> handle from one part of their code to another, and
> might help not to go 
> over the max simultaneous connection limit of the
> database server.
> 
> However, checking odbc_connect()'s documentation in
> the PHP Manual does 
> not note this feature's existence or a way of
> turning it off.
> 
> On the other hand, the most often used
> mysql_connect() has this:
> "If a second call is made to mysql_connect() with
> the same arguments, no 
> new link will be established, but instead, the link
> identifier of the 
> already opened link will be returned. The new_link
> parameter modifies 
> this behavior and makes mysql_connect() always open
> a new link, even if 
> mysql_connect() was called before with the same
> parameters."
> 
> So that one lets you control this behavior which is
> turned on by default.
> 
> Almost the same is true of mssql_connect():
> "In case a second call is made to mssql_connect()
> with the same 
> arguments, no new link will be established, but
> instead, the link 
> identifier of the already opened link will be
> returned."
> 
> But, unfortunately, here you have no way of turning
> this off.
> 
> odbc_pconnect() also notes this:
> "Future requests for a connection with the same dsn,
> user, password 
> combination (via odbc_connect() and odbc_pconnect())
> can reuse the 
> persistent connection."
> 
> 
> So, I'm guessing that either you are using
> odbc_pconnect() in at least 
> one of the places, or that the PHP documentation
> people just forgot to 
> note this feature's existence in the odbc_connect()
> documentation but it 
> is there nevertheless.
> 
> 
> You can check this by var_dump()'ing the two
> supposedly different 
> connection handles, and see if they are actually the
> same.
> 
> 
> And to solve this, you could use a different user
> name / password pair 
> for the two different connection; or even simpler,
> add another ODBC 
> alias to the same server, just to fool PHP into
> thinking that it's a 
> different server.
> 
> Now I don't know how that's exactly done in ODBC,
> it's beyond me why 
> would anyone want to interface with FreeTDS via ODBC
> in PHP when you 
> have sybase/sybase_ct for Sybase and mssql for
> MSSQL.
> 
> Since I'm using mssql_connect(), I could simply
> duplicate the same 
> connection in freetds.conf under a new name.
> 
> All this has nothing to do with FreeTDS.
> 
> --
> Daniel
> 
> _______________________________________________
> FreeTDS mailing list
> FreeTDS at lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds 

______________________________________________________________________
Yahoo! Mail: 6MB di spazio gratuito, 30MB per i tuoi allegati, l'antivirus, il filtro Anti-spam
http://it.yahoo.com/mail_it/foot/?http://it.mail.yahoo.com/


More information about the FreeTDS mailing list