Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    Join Date
    Oct 2008
    Posts
    11

    Question Unanswered: html form db2 connect

    hi
    im tryin to store my html form data in a db2 database thru a php script. i successfully connected the php script to db2 using the ibm odbc driver functions. when i compile the php in my zend environment its able to insert data in my database table, but wen i send data frm my html form to the php script to store data it says "500 internal error".. i m using apache2 server in windows xp environment... its a localhost server actually! pls help!


    cheers

  2. #2
    Join Date
    Oct 2008
    Posts
    11
    one more thing i wanted to mention was tat the error occured only wen i used odbc functions like odbc_connect, etc..
    here is the php code:
    <?php
    // connect to the database
    $conn = odbc_connect('vcs', 'db2admin', 'db2admin');
    $username=$_POST["username"];
    $password=$_POST["password"]
    // define our SQL
    $sql = "INSERT INTO login" .
    "(USER_NAME, PASSWORD,)" .
    "VALUES('$name', '$password')";


    // issue our SQL statement directly
    odbc_exec($conn, $sql);

    // close the database connection
    odbc_close($conn);
    echo "Insertion into the database is complete!"
    ?>

  3. #3
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    Don't use the ODBC PHP driver, it is buggy. You may want to give the "ibm_db2" driver a try.
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

  4. #4
    Join Date
    Oct 2008
    Posts
    11
    i hav been searchin for the ibm_db2 driver but i cant find it.. pls tel me where to get it and how to use it wit my zend studio.. pls pls! i cant find the headers or the library files for the ibm_db2 driver

    cheers

  5. #5
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

  6. #6
    Join Date
    Oct 2008
    Posts
    11
    hey mate thanks for the link.. but cud u tel me wat to download at the link u gave me.. the db2 app development client, or jus the IBM Data
    Server Driver for ODBC, CLI, and .NET available at ftp://ftp.software.ibm.com/ps/produc...es2/englsh-us/


    And cud u tel me wat these PECL extensions are? Are they to do anytin with the db2 functions?

    thanks

  7. #7
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    Sorry, I don't understand your question. You can install ibm_db2 with the regular PHP mechanisms like PECL.
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

  8. #8
    Join Date
    Oct 2008
    Posts
    11
    i m jus gettin confused actually.. now to get my db2functions workin.. i need only db2 app development client and pecl extension rite?

  9. #9
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Quote Originally Posted by imdragonlord
    i m jus gettin confused actually..
    I don't find that surprising. I guess you'll have to wait until somebody translates the manual into that "language" of yours...
    ---
    "It does not work" is not a valid problem statement.

  10. #10
    Join Date
    Oct 2008
    Posts
    11
    the pecl extension i got for ibm_db2 doesnt work wit my zend studio.. wat gives?

  11. #11
    Join Date
    Oct 2008
    Posts
    11
    hey i checked the server error log.. it says:
    "PHP Fatal error: Call to undefined function odbc_connect() in C:\Program Files\Zend\Apache2\htdocs\db2_login.php on line 5"

    is it bcoz my server is not config properly or any other stuff?

  12. #12
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    You are using the ODBC functions. If you have a look at the link I provided, you will find that the functions in ibm_db2 all start with the prefix "db2_".

    Also, regarding your installation question I point you again to that link. There is a section "Installing/Configuring". Do the usual RTFM first and then come back with specific questions and the accompanying information on what you tried, what is going wrong and also some details on your environment.
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

  13. #13
    Join Date
    Oct 2008
    Posts
    11
    so yeah i got PECL extension for windows. They were dlls and i placed them in the extension directory as given in the manual and added the line of code in the php.ini file. even so i m gettin undefined functions wen i use db2_connect() or other similar funcs. like i said my php development environment is zend studio 5.5.1..

  14. #14
    Join Date
    Oct 2008
    Posts
    11
    hey im able to use my odbc functions now.. but im gettin a error like this:


    PHP Warning: odbc_connect() [<a href='function.odbc-connect'>function.odbc-connect</a>]: SQL error: Specified driver could not be loaded due to system error 127 (IBM DB2 ODBC DRIVER - DB2COPY1)., SQL state IM003 in SQLConnect in C:\Program Files\Zend\Apache2\htdocs\db2_login.php on line 5
    PHP Warning: odbc_exec(): supplied argument is not a valid ODBC-Link resource in C:\Program Files\Zend\Apache2\htdocs\db2_login.php on line 17
    PHP Warning: odbc_close(): supplied argument is not a valid ODBC-Link resource in C:\Program Files\Zend\Apache2\htdocs\db2_login.php on line 20
    PHP Warning: odbc_connect() [<a href='function.odbc-connect'>function.odbc-connect</a>]: SQL error: Specified driver could not be loaded due to system error 127 (IBM DB2 ODBC DRIVER - DB2COPY1)., SQL state IM003 in SQLConnect in C:\Program Files\Zend\Apache2\htdocs\db2_login.php on line 5
    PHP Warning: odbc_exec(): supplied argument is not a valid ODBC-Link resource in C:\Program Files\Zend\Apache2\htdocs\db2_login.php on line 17
    PHP Warning: odbc_close(): supplied argument is not a valid ODBC-Link resource in C:\Program Files\Zend\Apache2\htdocs\db2_login.php on line 20
    PHP Warning: odbc_connect() [<a href='function.odbc-connect'>function.odbc-connect</a>]: SQL error: Specified driver could not be loaded due to system error 127 (IBM DB2 ODBC DRIVER - DB2COPY1)., SQL state IM003 in SQLConnect in C:\Program Files\Zend\Apache2\htdocs\db2_login.php on line 5
    PHP Warning: odbc_exec(): supplied argument is not a valid ODBC-Link resource in C:\Program Files\Zend\Apache2\htdocs\db2_login.php on line 18
    PHP Warning: odbc_close(): supplied argument is not a valid ODBC-Link resource in C:\Program Files\Zend\Apache2\htdocs\db2_login.php on line 21
    PHP Warning: odbc_connect() [<a href='function.odbc-connect'>function.odbc-connect</a>]: SQL error: Specified driver could not be loaded due to system error 127 (IBM DB2 ODBC DRIVER - DB2COPY1)., SQL state IM003 in SQLConnect in C:\Program Files\Zend\Apache2\htdocs\db2_login.php on line 5
    PHP Warning: odbc_exec(): supplied argument is not a valid ODBC-Link resource in C:\Program Files\Zend\Apache2\htdocs\db2_login.php on line 18
    PHP Warning: odbc_close(): supplied argument is not a valid ODBC-Link resource in C:\Program Files\Zend\Apache2\htdocs\db2_login.php on line 21




    how to rectify to the link between the server and the db2
    its a zend core apache server

  15. #15
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    You are still using the ODBC driver and not ibm_db2. Without any further details on the code and the exact error messages, it's impossible to help you with this.
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •