Maybe these snips could give you an hint about whats going around: --------[snip 1]--------------------------------------------------------------
BUG: S1000 Error When Sharing Connection in Multiple Threads (Q175313) The information in this article applies to: Microsoft ODBC Driver for SQL Server, versions 2.0 , 3.0 Microsoft Visual C++, 32-bit Enterprise Edition, versions 5.0 , 6.0 Microsoft Visual C++, 32-bit Professional Edition, versions 5.0 , 6.0 Microsoft Visual C++, 32-bit Learning Edition, version 6.0 SYMPTOMS When you share a CDatabase object between multiple threads and use the SQL Server ODBC driver version 2.65.0240 or later, you may receive the following error message: SQLSTATE: S1000 [Microsoft][ODBC SQL Server Driver]Connection is busy with the results for another hstmt When you use the Microsoft Data Access Components (MDAC) 2.6 driver, you may receive the following error message: State:37000,Native:16909,Origin:[Microsoft][ODBC SQL Server Driver][SQL Server] sp_cursorfetch: The cursor identifier value provided (1) is not valid CAUSE This error occurs because of a timing conflict in the SQL Server ODBC driver or MDAC 2.6 driver. If two threads are in the process of calling SQLPrepare(), followed by a SQLExecute() call, this error may occur. RESOLUTION Put CRecordset::Open() calls within a critical section to guarantee that only one thread is executing a SQL command on the connection at a given time. On the SQL Server back end, it is recomended that you use different CDatabase objects for different threads. STATUS Microsoft has confirmed this to be a bug in the Microsoft SQL Server driver. MORE INFORMATION Following is a code sample that can cause this error to occur: Sample code void CDBProblemDlg::OnDoDatabase() { //Open connection to database m_DB.Open(); CSQLRecordSet rs(&m_DB); StartThread(&m_DB); if ( rs.Open(CRecordset::dynaset) ) { . . . SQLRecordSet.Close(); } } void StartThread(CDatabase * pDB) { AfxBeginThread(InitThreadProc, pDB, THREAD_PRIORITY_NORMAL); } UINT CDBProblemDlg::InitThreadProc( LPVOID pParam ) { CDatabase* pDB = (CDatabase*) pParam; if (pDB->IsOpen()) { CSQLRecordSet SQLRecordSet(pDB); if (SQLRecordSet.Open(CRecordset::dynaset)) { . . . SQLRecordSet.Close(); } } } Published Oct 20 1997 3:41PM Issue Type kbbug Last Modifed Jun 14 2001 10:19PM Additional Query Words VC++ Keywords kbDatabase kbMFC kbODBC kbSQLServ kbVC500 kbGrpDSMDAC kbDSupport kbGrpDSODBC COMMENTS? --------[end snip 1]-------------------------------------------------------------- --------[snip 2]-------------------------------------------------------------- BUG: SQLState S1000 with SQL_AUTOCOMMIT_OFF/SQLTransact (Q169469) The information in this article applies to: Microsoft Open Database Connectivity, versions 2.5 , 3.0 Microsoft Access 97 BUG #: 4841 (Brazos) SYMPTOMS If an application does the following in the Microsoft Access 7.0 or 97 version of the ODBC drivers more than seven times SQLSetConnectOption(hdbc, SQL_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF); SQLTransact(henv, hdbc, SQL_COMMIT); The error generated is: *szSqlState = "S1000", *pfNativeError = -1103, *szErrorMsg = "[Microsoft][ODBC Microsoft Access 97 Driver] " If the application calls SQLExecDirect with any SQL statement, the error generated is: szSqlState = "S1000", *pfNativeError = -1103, *pcbErrorMsg = 110 szErrorMsg="[Microsoft][ODBC Microsoft Access 97 Driver] Couldn't start transaction; too many transactions already nested." WORKAROUND To work around this problem, do not set the SQL_AUTOCOMMIT option repeatedly within a connection. The SQL_AUTOCOMMIT option is a per-connection option. Once this option is set, it stays valid until the connection is dropped; an ODBC application does not have to set the option repeatedly within a connection. STATUS Microsoft has confirmed this to be a problem in the Microsoft Access ODBC driver version 3.50.3602. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available. Published Jun 5 1997 3:11PM Issue Type kbbug Last Modifed May 12 2001 1:59PM Additional Query Words SQLEndTran SQLSetConnectAttr Keywords kbprogramming --------[end snip 2]-------------------------------------------------------------- --------[snip 3]-------------------------------------------------------------- DOCUMENT:Q175313 14-JUN-2001 [odbc] TITLE :BUG: S1000 Error When Sharing Connection in Multiple Threads PRODUCT :Open Database Connectivity (ODBC) PROD/VER::2.0,3.0,5.0,6.0 OPER/SYS: KEYWORDS:kbDatabase kbMFC kbODBC kbSQLServ kbVC500 kbGrpDSMDAC kbDSupport kbGrpDSODBC ====================================================================== ------------------------------------------------------------------------------- The information in this article applies to: - Microsoft ODBC Driver for SQL Server, versions 2.0, 3.0 - Microsoft Visual C++, 32-bit Enterprise Edition, versions 5.0, 6.0 - Microsoft Visual C++, 32-bit Professional Edition, versions 5.0, 6.0 - Microsoft Visual C++, 32-bit Learning Edition, version 6.0 ------------------------------------------------------------------------------- SYMPTOMS ======== When you share a CDatabase object between multiple threads and use the SQL Server ODBC driver version 2.65.0240 or later, you may receive the following error message: SQLSTATE: S1000 [Microsoft][ODBC SQL Server Driver]Connection is busy with the results for another hstmt When you use the Microsoft Data Access Components (MDAC) 2.6 driver, you may receive the following error message: State:37000,Native:16909,Origin:[Microsoft][ODBC SQL Server Driver][SQL Server] sp_cursorfetch: The cursor identifier value provided (1) is not valid CAUSE ===== This error occurs because of a timing conflict in the SQL Server ODBC driver or MDAC 2.6 driver. If two threads are in the process of calling SQLPrepare(), followed by a SQLExecute() call, this error may occur. RESOLUTION ========== Put CRecordset::Open() calls within a critical section to guarantee that only one thread is executing a SQL command on the connection at a given time. On the SQL Server back end, it is recomended that you use different CDatabase objects for different threads. STATUS ====== Microsoft has confirmed this to be a bug in the Microsoft SQL Server driver. MORE INFORMATION ================ Following is a code sample that can cause this error to occur: Sample code ----------- void CDBProblemDlg::OnDoDatabase() { //Open connection to database m_DB.Open(); CSQLRecordSet rs(&m_DB); StartThread(&m_DB); if ( rs.Open(CRecordset::dynaset) ) { . . . SQLRecordSet.Close(); } } void StartThread(CDatabase * pDB) { AfxBeginThread(InitThreadProc, pDB, THREAD_PRIORITY_NORMAL); } UINT CDBProblemDlg::InitThreadProc( LPVOID pParam ) { CDatabase* pDB = (CDatabase*) pParam; if (pDB->IsOpen()) { CSQLRecordSet SQLRecordSet(pDB); if (SQLRecordSet.Open(CRecordset::dynaset)) { . . . SQLRecordSet.Close(); } } } Additional query words: VC++ ====================================================================== Keywords : kbDatabase kbMFC kbODBC kbSQLServ kbVC500 kbGrpDSMDAC kbDSupport kbGrpDSODBC Technology : kbVCsearch kbSQLServSearch kbAudDeveloper kbODBCSearch kbODBCSQLServ200 kbODBCSQLServ300 kbVC500 kbVC600 kbVC32bitSearch kbVC500Search Version : :2.0,3.0,5.0,6.0 Issue type : kbbug ============================================================================= THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY. Copyright Microsoft Corporation 2001. --------[end snipp 3]-------------------------------------------------------------- > -----Original Message----- > From: Robin Bolton [mailto:[EMAIL PROTECTED]] > Sent: Thursday, March 28, 2002 10:01 PM > To: [EMAIL PROTECTED] > Subject: [PHP-WIN] ODBC Connection Problems > > > I have an Access database which I made a DSN connection to. > > As long as the .mdb file is on the same machine as my Apache Server I can > connect to it just fine. However, if I try to set the DSN to point to an > .mdb file on our network (mapped to a drive letter), I get the following > error in PHP: > > Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver] The Microsoft > Jet database engine cannot open the file '(unknown)'. It is already opened > exclusively by another user, or you need permission to view its data., SQL > state S1000 in SQLConnect in c:\www\test\odbc\odbctest3.php on line 2 > > I know for a fact it's not open on any other machines, so it's not a sharing > issue. Which knocks it down to either permissions or just more PHP network > sillyness. > > I've tried pointing the DSN connection to the .mdb using both the mapped > drive letter and UNC paths, same error either way. > > The username that I log onto my workstation with has administrative > priveledges for both our domain, and the machine itself. > > Server: NT 4.0 Server > Workstation: Win 2000, Apache, PHP 4.1.2 > > > Thanks, > > Robin Bolton > IT / Web Developer > Lone Pine Publishing > [EMAIL PROTECTED] > > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php