472,373 Members | 1,982 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,373 software developers and data experts.

problem with configure PHP with IBM-DB2 driver for connecting Apache derby database

Hi All,

I am trying to configure php with IBM-DB2 and I get the followinng when i run the configure command

./configure --with-pdo-odbc=ibm-db2,/opt/IBM/db2/V8.1/


checking for ODBC v3 support for PDO... yes
checking for PDO includes... checking for PDO includes... /home/knellim/php-5.3.1/ext
checking for selected PDO ODBC flavour... ibm-db2
libs /opt/IBM/db2/V8.1//lib,
headers /opt/IBM/db2/V8.1//include
checking for odbc.h in /opt/IBM/db2/V8.1//include... no
checking for odbcsdk.h in /opt/IBM/db2/V8.1//include... no
checking for iodbc.h in /opt/IBM/db2/V8.1//include... no
checking for sqlunix.h in /opt/IBM/db2/V8.1//include... no
checking for sqltypes.h in /opt/IBM/db2/V8.1//include... no
checking for sqlucode.h in /opt/IBM/db2/V8.1//include... no
checking for sql.h in /opt/IBM/db2/V8.1//include... yes
checking for isql.h in /opt/IBM/db2/V8.1//include... no
checking for sqlext.h in /opt/IBM/db2/V8.1//include... yes
checking for isqlext.h in /opt/IBM/db2/V8.1//include... no
checking for udbcext.h in /opt/IBM/db2/V8.1//include... no
checking for sqlcli1.h in /opt/IBM/db2/V8.1//include... yes
checking for LibraryManager.h in /opt/IBM/db2/V8.1//include... no
checking for cli0core.h in /opt/IBM/db2/V8.1//include... no
checking for cli0ext.h in /opt/IBM/db2/V8.1//include... no
checking for cli0cli.h in /opt/IBM/db2/V8.1//include... no
checking for cli0defs.h in /opt/IBM/db2/V8.1//include... no

So basically, I have installed the DB2 runtime client but there are no header files in that needed for the succesful connection to Apache Derby database.

When i run my connect php script i get error message
SQLSTATE[IM002] SQLConnect: 0 [unixODBC][Driver Manager]Data source name not found, and no default driver specified

PLEASE, anyome who has configured PHP with IBM-DB2 pls help me.. Its urgent!!
Feb 18 '10 #1

✓ answered by Markus

Please see this page on php.net.

20 5994
8,658 Expert Mod 8TB
how do you connect to the DB?
Feb 19 '10 #2
6,050 Expert 4TB
Please see this page on php.net.
Feb 19 '10 #3
I connect to the DB using the CATALOG TCPIP command. My database is located on the same machine.
I start the Derby Network serveri in Opt/Apache/derby/bin by giving
# ./startNetworkserver&

The database created is named as vcl
Then, I start the DB2 CLI and give the below commands
db2=>catalog tcpip node vclnode remote localhost server 1527
db2=>catalog db VCL at node vclnode authetication server
db2=>connect to VCL user vcluser using vclPassw

This connectd my DB2 client and derby database as I can see tables by giving select command,

Can u help me in connecting PHP with DB2. Thanks....in advance
Feb 19 '10 #4
6,050 Expert 4TB
Did you see my reply?
Feb 19 '10 #5
I only saw ur last reply asking me how I connect to DB.. I did answer that and i m waiting fr ur resonse...
Feb 19 '10 #6
6,050 Expert 4TB
That wasn't my reply. See #3.
Feb 19 '10 #7
oh yaa..i saw that.. I am following the steps now.. I will try it and tell u if thagt worked..
Feb 19 '10 #8
Hi Marcus,

I have the ibm_db2 driver configured. I made the changes to php.ini file as

I have written php file in /var/www/html as
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. // Create the uncataloged connection string
  4.          . "DATABASE='TEST';HOSTNAME='localhost';PORT=1527;"
  5.          . "UID='knellim';PWD='db2';";
  6. $conn = db2_connect($DSN,null,null);
  7. $sql = "SELECT id FROM resource";
  8. $stmt = db2_prepare($conn, $sql);
  9. $res = db2_execute($stmt, array(10));
  10. while ($row = db2_fetch_assoc($res)) {
  11. print "{$row['id']}\n";
  12. }
  13. ?>
and when i run it I as php connect.php , I get

PHP Warning: db2_prepare() expects parameter 1 to be resource, boolean given in /var/www/html/testvcl.php on line 9
PHP Warning: db2_execute() expects parameter 1 to be resource, null given in /var/www/html/testvcl.php on line 10
PHP Warning: db2_fetch_assoc() expects parameter 1 to be resource, null given in /var/www/html/testvcl.php on line 11

Pls can u help me with this.. Any idea why this is happening..??
Feb 19 '10 #9
I wrote a simple script for testing my connection
Expand|Select|Wrap|Line Numbers
  1. <?php
  3. $database = 'VCL';
  4. $user = 'vcluser';
  5. $password = 'vcluserpassword';
  7. $conn = db2_connect($database, $user, $password);
  9. if ($conn) {
  10.     echo "Connection succeeded.";
  11.     db2_close($conn);
  12. }
  13. else {
  14.     echo "Connection failed.";
  15. }
  16. ?>

It says Connection failed

Whats the username and password to be given there.. Is it the database user name and passw or DB2 instance username and password??

Please suggest
Feb 19 '10 #10
8,658 Expert Mod 8TB
you simple fail to connect, so db2_connect() returns false. have you tried PDO, you installed the PDO driver after all?
Feb 19 '10 #11
8,658 Expert Mod 8TB
Whats the username and password to be given there.. Is it the database user name and passw or DB2 instance username and password??
like the manual says, the login/password of the DB.
Feb 19 '10 #12
Yes , I do have the pdo driver
I did php -m and it shows me the PHP modules which has the PDO
Feb 19 '10 #13
8,658 Expert Mod 8TB
you could try to connect to DB2 using PDO.
Feb 19 '10 #14
How can I do that.. Can u give me any example
Feb 19 '10 #15
DO I have to add anything to the httpd.conf file to get connected.
Pls advice. I am unable to find out the problem with the connection.
Feb 19 '10 #16
8,658 Expert Mod 8TB
check out the manual.
Feb 19 '10 #17
When i use the connection string with PDO, it says driver not found.
But i can see pdo in the list of php modules. what does that mean. Do i have to install anything else???
Feb 20 '10 #18
when using db2_connect , connection fails.
by using db2_conn_error command to see the error message code i get a blank . No error code. But the connection fails. It also shows a segmentation fault
Pls suggest.
Feb 20 '10 #19

My problem is solved. The problem was in setting the db2 profile info.
remember you have to do
# source /home/db2inst1/sqllib/db2profile
Also make changes to php.ini file and HTTP startup script.

Hope this helps..!
Mar 1 '10 #20
hi knellim;

can you show me the solution/step by step on how you solve your problem in :
- db2profile info
- php.ini
- http startup script

i have been stuck all days to solve this.

your help is needed very much.

thank you.

Feb 13 '18 #21

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

Similar topics

by: Befuddled | last post by:
Forgive me, this is probably a very simple problem, but it's new to me. When I attempt to make php 4.3.8, it exits, and I believe the relevant message is: libtool: link: cannot find the library...
by: Russell E. Owen | last post by:
I'm trying to build Python 2.3.4 from source on a RedHat Enterprise machine for installation in a net-wide accessible directory /net/python. I tried all of the following variants of ./configure...
by: | last post by:
Hello, I'm trying to install Python 2.3.4 in AIX 5.2 with gcc 2.9. After a lot of messing around I got the configure script to run using the following command (libm parameter found from...
by: André Amram Duque | last post by:
I have problem with re-install python 2.3.4, when I execute ./configure is appear one message in config.log, follow below : configure:1710: gcc conftest.cc >&5 gcc: installation problem,...
by: max(01)* | last post by:
hello. the following code: 1 from Tkinter import * 2 3 class MiaApp: 4 def __init__(self, genitore): 5 self.mioGenitore = genitore 6 self.i = IntVar()
by: Amit Gangrade | last post by:
I am trying to make a configure script for a c++ library . The library can be compiled with some optional header files,depending on the users decision . So basically I need to check for the headers...
by: perseus | last post by:
It is really crazy! I need to use the Boost filesystem for the manipulation of directories, and I have no idea how to install this filesystem on my IBM-compatible machine. Does anyone up here know...
by: james | last post by:
I have a problem installing Pyhton 2.4.3, running "./configure --with-threads=no" completes, but gives the warning: configure: WARNING: curses.h: present but cannot be compiled configure:...
by: plumb and tree | last post by:
I've been trying for days to build 64 bit python with Solaris 10 + Sun Studio 12. Can anyone helpl please. This is how I tried to do build: # ./configure --prefix=/opt/python2.4...
by: srinivasareddynr | last post by:
Hi, I am trying to parse an xml using xpath. I dont have any problem when i try it as a standalone java application, but when I try the same code with in a servlet I am getting the below error. Can...
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
by: DizelArs | last post by:
Hi all) Faced with a problem, element.click() event doesn't work in Safari browser. Tried various tricks like emulating touch event through a function: let clickEvent = new Event('click', {...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.