|
|
Choosing A Webhost: |
Re: Multiple Active Statements: msg#00150db.tds.freetds
Dario wrote: ok, but if I open multiple connections 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
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Multiple Active Statements, Dario |
|---|---|
| Next by Date: | RE: Error: FreeTDS+WINE, Rainer |
| Previous by Thread: | Re: Multiple Active Statements, Dario |
| Next by Thread: | Re: Multiple Active Statements, Dario |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |