By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,730 Members | 1,156 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,730 IT Pros & Developers. It's quick & easy.

exception 'com_exception' with message 'Source: Unknown

P: 2
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:

Expand|Select|Wrap|Line Numbers
  1. # First establish the connection
  2. $conn = new COM('ADODB.Connection') or exit('Cannot start ADO');
  3. $result = new COM('ADODB.Recordset') or exit('Coult not make rs'); 
  4.  
  5. $db = 'C:\\xampp\\datasources\\ModuleDB.mdb';
  6.  
  7. $connStr = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=$db;";    
  8. $conn->Open($connStr);
  9.  
  10. if (!$conn) {
  11.     $output .= "Connection not open";
  12.     die();
  13. }
  14.  
  15. $sql = "SELECT * FROM module";
  16.  
  17. $output .= "<br> SQL Statement: " . $sql;
  18.  
  19. ####### ERROR HERE ######
  20. $result = $conn->execute($sql);
  21. ###########################
  22.  
  23. $ouput .= $result;
  24. //$result->close();
  25. $conn->close();
  26.  
  27. # Clean up
  28. $result = null;
  29. $conn = null;  
  30.  
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\extensions\ModuleInforma tion\ModuleInformation.php:49 Stack trace: #0 C:\xampp\htdocs\mediawiki\extensions\ModuleInforma tion\ModuleInformation.php(49): com->execute('SELECT * FROM m...') #1 C:\xampp\htdocs\mediawiki\includes\parser\Parser.p hp(3287): renderModuleInformation(NULL, Array, Object(Parser)) #2 C:\xampp\htdocs\mediawiki\includes\parser\Preproce ssor_DOM.php(982): Parser->extensionSubstitution('renderModuleInf...', Array) #3 C:\xampp\htdocs\mediawiki\includes\parser\Parser.p hp(2678): PPFrame_DOM->expand(Array, Object(PPFrame_DOM)) #4 C:\xampp\htdocs\mediawiki\includes\parser\Parser.p hp(966): Parser->replaceVariables(Object(PPNode_DOM), 0) #5 C:\xampp\htdocs\mediawiki\includes\parser\Parser.p hp(321): Parser->internalParse('parse('getPreviewText('getPreviewT ext() #9 C:\xampp\htdocs\mediawiki\includes\EditPage.php(48 4): EditPage->showEditForm() #10 C:\xampp\htdocs\mediawiki\includes\EditPage.php(34 9): EditPage->edit() #11 C:\xampp\htdocs\mediawiki\extensions\FCKeditor\FCK editor.body.php(202): EditPage->submit() #12 C:\xampp\htdocs\mediawiki\includes\Hooks.php(117): FCKeditor_MediaWiki->onCustomEditor() #13 C:\xampp\htdocs\mediawiki\includes\Wiki.php(484): wfRunHooks() #14 C:\xampp\htdocs\mediawiki\includes\Wiki.php(59): MediaWiki->performAction(Object(Article), Object(StubUser)) #15 C:\xampp\htdocs\mediawiki\index.php(93): MediaWiki->initialize(Array, 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!
Mar 9 '09 #1
Share this Question
Share on Google+
1 Reply


P: 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.

Expand|Select|Wrap|Line Numbers
  1. $conn = odbc_connect('Modules','','');
  2. $name = $argv["modulename"];
  3. $sql = "SELECT * FROM module WHERE module_name='" . $name . "'";
  4.  
  5. $rs = odbc_exec($conn, $sql);
  6.  
  7. # Get the fields from this database
  8. while (odbc_fetch_row($rs)) {
  9.  ...
  10. }
  11.  
  12. odbc_close($conn);
  13.  

Some instructions for setting up datasource can be found at:
http://articles.techrepublic.com.com...1-5160904.html
Mar 16 '09 #2

Post your reply

Sign in to post your reply or Sign up for a free account.