Welcome Guest, Not a member yet? Register   Sign In
Please help me to create Codeigniter database connection to IBM DB2
#1

[eluser]Edy S[/eluser]
Hi everybody, i have some problem about connecting my application to IBM DB2. I've found every tutorial on the internet but none work on my application. This is the manual setting about connecting adodb to DB2.
Code:
include('adodb/adodb.inc.php');
$dbms   = 'odbc_db2';
$db =& ADONewConnection($dbms);
$dsn = "driver={IBM db2 odbc DRIVER};Database=MYDBA;hostname=my_ipaddress;port=50000;protocol=TCPIP;"."uid=my_user; pwd=my_password";
$db->Connect($dsn);
But, now i'm confuse about how to integrate the $db to codeIgniter, so that i can use it like general query in codeigniter , example : $this->db->query();
I have try the example code from this forum :
http://ellislab.com/forums/viewthread/80162/#434770
Please help me while you have succeed try to connect you CI Application to IBM DB2 database

Thanks
#2

[eluser]TheFuzzy0ne[/eluser]
I don't think you'll be able to unless someone writes a driver for that DBMS.
#3

[eluser]Edy S[/eluser]
Hi Fuzzy0ne,
The DBMS Driver to db2 was provided by Adodb, in normally Adodb connection was look like this :
Code:
include('adodb/adodb.inc.php');
$dbms   = 'odbc_db2';
$db =& ADONewConnection($dbms);
$dsn = "driver={IBM db2 odbc DRIVER};Database=MYDBA;hostname=my_ipaddress;port=50000;protocol=TCPIP;"."uid=my_user; pwd=my_password";
$db->Connect($dsn);
$db is a adodb variabel that can use to Executing query for example :
Code:
$query = $db->Execute('select * from my_tables');
Now, how to integrate $db variable to codeigniter? so that we can use $db in all Codeigniter model
#4

[eluser]TheFuzzy0ne[/eluser]
Ah, sorry. In that case, simply put your DSN string as your database hostname.
Code:
$db['default']['hostname'] = 'driver={IBM db2 odbc DRIVER};Database=MYDBA;hostname=my_ipaddress;port=50000;protocol=TCPIP;"."uid=my_user; pwd=my_password"';
#5

[eluser]Edy S[/eluser]
Really great Thanks for Fuzzione, its work well now (y)
May God Will always bless you all the way




Theme © iAndrew 2016 - Forum software by © MyBB