Testing Database Connection; Using Sql Nchar Datatypes - Oracle HTTP Server B12255-01 Administrator's Manual

10g release 1 (10.1)
Table of Contents

Advertisement

You can access the DBI scripts from the following locations:
http://<hostname.domain>:<port>/cgi-bin/<scriptname>
http://<hostname.domain>:<port>/perl/<scriptname>
If the script specifies "use Apache::DBI" instead of "use DBI", then it will only
be able to run from
http://<hostname.domain>:<port>/perl/<scriptname>.

Testing Database Connection

The following is a sample Perl script for testing the database connection of a local
seed database. To use the script to test another database connection, you must
replace scott/tiger with the user name and password for the target database.
Example 7–2 Sample Perl Script For Testing Connection for Local Seed Database
##### Perl script start ######
use DBI;
print "Content-type: text/plain\n\n";
$dbh = DBI->connect("dbi:Oracle:", "scott/tiger", "") || die $DBI::errstr;
$stmt = $dbh->prepare("select * from emp order by empno")|| die $DBI::errstr;
$rc = $stmt->execute() || die $DBI::errstr;
while (($empno, $name) = $stmt->fetchrow()) { print "$empno $name\n"; }
warn $DBI::errstr if $DBI::err;
die "fetch error: " . $DBI::errstr if $DBI::err;
$stmt->finish() || die "can't close cursor";
$dbh->disconnect() || die "cant't log off Oracle";
##### Perl script End ######

Using SQL NCHAR Datatypes

SQL NCHAR datatypes have been refined in Oracle9i, and are now called reliable
Unicode datatypes. SQL NCHAR datatypes such as NCHAR, NVARCHAR2 and NCLOB
allow you to store any Unicode characters regardless of the database character set.
The character set for those datatypes is specified by the national character set,
which is either AL16UTF-16 or UTF8.
Oracle9i documentation for more about SQL NCHAR
See Also:
datatypes.
Oracle HTTP Server Modules 7-17
mod_perl

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the HTTP Server B12255-01 and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Http server

Table of Contents