change in the PEAR DB code. So this code require only changes in the 
SQL statements. Example 7 36 shows an PHP query statement execution 
with PEAR DB.
Example 7 36   PEAR DB PHP query statement
$result = $conn >query ("SELECT * FROM itsodb.katalog");
if (DB::isError ($result))
die ("SELECT failed: " . $result >getMessage () . "\n");
while ($row = $result >fetchRow ())
print "HERSTELLER= ".$row[0]."Model=".$row[1];
$result >free
  Update report
In the cases of an update and insert statement, return objects will be 
DB_ok
. In this case the connection object can be used to get the affected 
row using the method 
affectedRows()
. This code also remains the same 
for MySQL and DB2 UDB. Example 7 37 shows data insertion using 
PEAR DB.
Example 7 37   PEAR DB PHP data manipulation statement
$result = $conn >query ("INSERT INTO katalog (id, model,type) values 
(1,'1001', new )");
print "Number of rows affected=".$conn >affectedRows();
  Disconnect from the database
Finally, as a good programming practice you should release all the 
ResultSets and connections. This can be done using 
free()
 method of th 
eresult object of 
query()
 in cases of SQL query statements. Connection 
can be released using 
disconnect()
 method of the connection object.
7.2.3  Converting MySQL Java applications to DB2 UDB
DB2 UDB supports the usage of Java programming at the following levels:
DB2 server side programming
  Java stored procedure on DB2 server
  Java user defined function (UDF) on DB2 server
Java applications
  Java enabled Web browser accessing DB2 UDB using JDBC
  Java standalone application using JDBC and SQLj
J2EE application server
  JavaServer Pages (JSP) using a JDBC connection
188 
MySQL to DB2 UDB Conversion Guide






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

san diego web hosting

 

Our partners: PHP: Hypertext Preprocessor Cheap Web Hosting JSP Web Hosting Ontario Web Hosting  Jsp Web Hosting

Cheapest Web Hosting Java Hosting Cheapest Hosting

Visionwebhosting.net Business web hosting division of Vision Web Hosting Inc.. All rights reserved