exception 'com_exception' with message 'Source: Unknown

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Gramma2005
    New Member
    • Mar 2009
    • 2

    exception 'com_exception' with message 'Source: Unknown

    I am trying to connect to an access db through php on Windows Server 2003 running XAMPP. The code I am using has worked before on another access db on this server so I am not sure what is causing the error. Here is my code:

    Code:
    # First establish the connection
    $conn = new COM('ADODB.Connection') or exit('Cannot start ADO');
    $result = new COM('ADODB.Recordset') or exit('Coult not make rs'); 
    		
    $db = 'C:\\xampp\\datasources\\ModuleDB.mdb';
    		
    $connStr = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=$db;";	
    $conn->Open($connStr);
    
    if (!$conn) {
    	$output .= "Connection not open";
    	die();
    }
    		
    $sql = "SELECT * FROM module";
    		
    $output .= "<br> SQL Statement: " . $sql;
    
    ####### ERROR HERE ######
    $result = $conn->execute($sql);
    ###########################
    
    $ouput .= $result;
    //$result->close();
    $conn->close();
    
    # Clean up
    $result = null;
    $conn = null;
    The SQL statement looks find when I print it out. The full error message is:

    exception 'com_exception' with message 'Source: Unknown
    Description: Unknown' in C:\xampp\htdocs \mediawiki\exte nsions\ModuleIn formation\Modul eInformation.ph p:49 Stack trace: #0 C:\xampp\htdocs \mediawiki\exte nsions\ModuleIn formation\Modul eInformation.ph p(49): com->execute('SELEC T * FROM m...') #1 C:\xampp\htdocs \mediawiki\incl udes\parser\Par ser.php(3287): renderModuleInf ormation(NULL, Array, Object(Parser)) #2 C:\xampp\htdocs \mediawiki\incl udes\parser\Pre processor_DOM.p hp(982): Parser->extensionSubst itution('render ModuleInf...', Array) #3 C:\xampp\htdocs \mediawiki\incl udes\parser\Par ser.php(2678): PPFrame_DOM->expand(Array , Object(PPFrame_ DOM)) #4 C:\xampp\htdocs \mediawiki\incl udes\parser\Par ser.php(966): Parser->replaceVariabl es(Object(PPNod e_DOM), 0) #5 C:\xampp\htdocs \mediawiki\incl udes\parser\Par ser.php(321): Parser->internalParse( 'parse('getPrev iewText('getPre viewText() #9 C:\xampp\htdocs \mediawiki\incl udes\EditPage.p hp(484): EditPage->showEditForm () #10 C:\xampp\htdocs \mediawiki\incl udes\EditPage.p hp(349): EditPage->edit() #11 C:\xampp\htdocs \mediawiki\exte nsions\FCKedito r\FCKeditor.bod y.php(202): EditPage->submit() #12 C:\xampp\htdocs \mediawiki\incl udes\Hooks.php( 117): FCKeditor_Media Wiki->onCustomEditor () #13 C:\xampp\htdocs \mediawiki\incl udes\Wiki.php(4 84): wfRunHooks() #14 C:\xampp\htdocs \mediawiki\incl udes\Wiki.php(5 9): MediaWiki->performAction( Object(Article) , Object(StubUser )) #15 C:\xampp\htdocs \mediawiki\inde x.php(93): MediaWiki->initialize(Arr ay, Array) #16 {main}

    All other posts I have seen have a better error message than 'Unknown', so I am kind of stumped. Thanks for the help!
  • Gramma2005
    New Member
    • Mar 2009
    • 2

    #2
    Not really a solution to the problem but I did find an alternative.

    I set up a datasource for the database and used the following PHP code, and it works.

    Code:
    $conn = odbc_connect('Modules','','');
    $name = $argv["modulename"];
    $sql = "SELECT * FROM module WHERE module_name='" . $name . "'";
    
    $rs = odbc_exec($conn, $sql);
    	
    # Get the fields from this database
    while (odbc_fetch_row($rs)) {
     ...
    }
    
    odbc_close($conn);

    Some instructions for setting up datasource can be found at:

    Comment

    Working...