If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > html form db2 connect

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-13-08, 13:17
imdragonlord imdragonlord is offline
Registered User
 
Join Date: Oct 2008
Posts: 11
Question 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
Reply With Quote
  #2 (permalink)  
Old 10-14-08, 10:21
imdragonlord imdragonlord is offline
Registered User
 
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!"
?>
Reply With Quote
  #3 (permalink)  
Old 10-14-08, 14:06
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
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
Reply With Quote
  #4 (permalink)  
Old 10-14-08, 21:20
imdragonlord imdragonlord is offline
Registered User
 
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
Reply With Quote
  #5 (permalink)  
Old 10-15-08, 05:28
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
  #6 (permalink)  
Old 10-15-08, 09:01
imdragonlord imdragonlord is offline
Registered User
 
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
Reply With Quote
  #7 (permalink)  
Old 10-15-08, 12:18
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
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
Reply With Quote
  #8 (permalink)  
Old 10-15-08, 12:38
imdragonlord imdragonlord is offline
Registered User
 
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?
Reply With Quote
  #9 (permalink)  
Old 10-15-08, 13:03
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
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...
Reply With Quote
  #10 (permalink)  
Old 10-15-08, 14:06
imdragonlord imdragonlord is offline
Registered User
 
Join Date: Oct 2008
Posts: 11
the pecl extension i got for ibm_db2 doesnt work wit my zend studio.. wat gives?
Reply With Quote
  #11 (permalink)  
Old 10-15-08, 14:59
imdragonlord imdragonlord is offline
Registered User
 
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?
Reply With Quote
  #12 (permalink)  
Old 10-15-08, 16:43
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
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
Reply With Quote
  #13 (permalink)  
Old 10-15-08, 21:22
imdragonlord imdragonlord is offline
Registered User
 
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..
Reply With Quote
  #14 (permalink)  
Old 10-16-08, 10:26
imdragonlord imdragonlord is offline
Registered User
 
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
Reply With Quote
  #15 (permalink)  
Old 10-16-08, 16:59
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On