0

How do you integrate Codeigniter 2.0.3 and Adodb?

Jakub
  • 20,418
  • 8
  • 65
  • 92
  • whats your reasoning for using Adodb over the standard methods included in CI? Are you unable to do something that you can with Adodb? – Jakub Aug 31 '11 at 15:19
  • The standard method would not show the data from the MS SQL –  Aug 31 '11 at 16:31
  • I'm making guesses here as your question is VERY limited in details, but that could be because your apache setup didn't have a mssql driver enabled? – Jakub Aug 31 '11 at 16:34
  • I enable the mssql.dll from the PHP ext directory –  Aug 31 '11 at 16:38
  • http://codeigniter.com/wiki/ADODB/ –  Aug 31 '11 at 16:46
  • To ask again, why? That monolythic library is exactly why things like ActiveRecord exist. We have MSSQL drivers that work just fine. "Does not show data" is not a valid error report, try again. – Phil Sturgeon Sep 07 '11 at 16:09
  • You know Jakub, we decided to drop AdobeDb and use the CodeIgniter database settings. We needed to install SQL server drivers from Microsoft Web site. –  Sep 14 '11 at 15:14
  • Using CI_DB to retrieve bulk data (like 1000+ rows) is really slow vs ADODB. CI_DB takes 44.7054 on `->result()` while ADODB takes only 0.0102 on `foreach` of all results, tested on the same page over a (relatively) slow database connection. – Interarticle Jan 18 '13 at 03:44

1 Answers1

0

try this example (done with a MSSQL db, but adjust it to your db) :

  1. download the ADOdb library from :
    http://www.ciforge.com/trac/adodb/ or http://adodb.sourceforge.net/#download
  2. Unzip the library to someplace on your server which can be called from your php pages
  3. Connect using something like this:

    include('path/to/adodb/library/adodb/adodb.inc.php');      
    $db =& ADONewConnection('odbc_mssql');
    $dsn = "Driver={SQL Server};Server=localhost;Database=XXXX_dev;";
    
    $db->Connect($dsn,'username','password');
    $rs = $db->Execute('select * from table_name');
    
     while (!$rs->EOF) {           
         echo "loop: " . $rs->fields[5] . "<br>";
         $rs->MoveNext();       
     }
    
    $rs->Close();
    
    $rs->Close();
    

you may also take a look at this solution

Mouna Cheikhna
  • 38,870
  • 10
  • 48
  • 69
  • Thank you for replying to my question. The explanation from the first link is very confusing and it doesn't work. –  Aug 31 '11 at 15:09
  • I checked out the 2nd link before I went to StackOverflow because the information on the 2nd link is outdated. –  Aug 31 '11 at 15:10
  • Hi Mona, I have a question regarding the step number 3. Where do you insert in the code? I tried to insert it in the database.php but it says that the code can't be processed as arrays. –  Sep 02 '11 at 12:14
  • in this example its just in the file that is gonna display the returned fields (it doesnt have to be in a config file ) , for more see this : http://phplens.com/lens/adodb/docs-adodb.htm – Mouna Cheikhna Sep 02 '11 at 12:56