470,632 Members | 1,470 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,632 developers. It's quick & easy.

php to derby database connection fails..urgent ..pls help!

I can connect to DB2 on the command line on the server.

db2=>connect to mytest user knellim using xxxx

Database Connection Information

Database server = Apache Derby CSS10050
SQL authorization ID = KNELLIM
Local database alias = MYTEST

When I connect to the same DB in PHP as cataloged or uncataloged, I get

Connection to database failed.
Below is my script

Expand|Select|Wrap|Line Numbers
  1. <?php
  3. $database = 'mytest';
  4. $user = 'knellim';
  5. $password = 'xxxx';
  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.<p>";
  15.    echo 'SQLSTATE: ' . db2_conn_error() . '<br />';
  16.    echo 'Message: ' . db2_conn_errormsg(). '<br />';
  17. }
  18. ?>
I followed this link http://www.db2ude.com/?q=node/81 to install ibm_db2 driver
I installed Apache using yum install httpd -y

Please suggest what can be the problem...

Feb 22 '10 #1
2 2967
5,058 Expert 4TB

It's odd that the db2_conn_error and db2_conn_errormsg functions don't return anything. If the connection fails, they should.

Do you have the error messages turned on? Could be that there is an underlying problem that is being suppressed.
Feb 22 '10 #2
I tried the method to unsuppress the messages by adding these to php code
# error_reporting(E_ALL);
# ini_set('display_errors', true);

But still i get same error
Connection failed.SQLSTATE value:
Segmentation fault

Why m I getting a segmentation error.. Is this the reason..
Pls help..!
Feb 23 '10 #3

Post your reply

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

Similar topics

reply views Thread by Wiseguy | last post: by
3 posts views Thread by IOANNIS MANOLOUDIS | last post: by
2 posts views Thread by bob_jeffcoat | last post: by
5 posts views Thread by igotyourdotnet | last post: by
14 posts views Thread by drsmooth | last post: by
7 posts views Thread by =?Utf-8?B?TWF4R3J1dmVu?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.