db2_info_wrkstnname Character string
db2_longdata_compat Boolean
db2_quiet_mode Integer
db2_sqlerrp Character string (read only)
db2_txn_isolation One of the following:
SQL_TXN_READ_UNCOMMITTED
SQL_TXN_READ_COMMITTED
SQL_TXN_REPEATABLE_READ
SQL_TXN_SERIALIZABLE
SQL_TXN_NOCOMMIT
As in the Mysql.pm connect example, the DBI connect statement returns a
database handle if the connection has been successfully established. Otherwise,
the value
undef
is returned. All further communication with the database server
takes places through this object.
SELECT query statements
Example 7 19 and Example 7 20 show the differences between the two
interfaces in using the SELECT statement.
Example 7 19 Select statement used with the Mysql.pm interface
use Mysql;
my $host="localhost";
my $database="itsodb";
my $user="itsosj";
my $password="itsosj";
$dbh = Mysql >connect($host,$database,$password,$user);
$sql_statement = "SELECT * FROM catalog WHERE id= $id ;";
$sth = $dbh >query($sql_statement);
@arr = $sth >fetchrow;
A DB2 conversion using the DBI interface is shown in Example 7 20.
Example 7 20 Select statement used with the DBI interface
use DBI;
use DBD::DB2::Constants;
use DBD::DB2;
my $user="itsosj";
my $password="itsosj";
$dbh = DBI >connect("dbi:DB2:itsodb2", $username, $password);
$sql_statement = "SELECT * FROM katalog WHERE id= $id ;";
$sth = $dbh >prepare($sql_statement);
$sth >execute();
176
MySQL to DB2 UDB Conversion Guide
footer
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