Therefore, install Oracle database 10 g, including sample schemas. Create
a database instance ORCL. Create an example database table in OE schema.
The database table may be created with a PHP script.
Copy the createTable.php listing, which is listed below, to the
createTable.php PHP file in JDeveloper.
$username='OE';
$password='password';
$db='(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT
= 1521))
(CONNECT_DATA =
8.4 Creating a Database Table 165
(SERVER = DEDICATED)
(SERVICE_NAME = ORCL)
)
)';
$connection = oci_connect($username, $password,
$db);
if (!$connection) {
$e = oci_error();
echo htmlentities($e['message']);
}
$stmt = oci_parse($connection, "CREATE TABLE
OE.Catalog(CatalogId VARCHAR(25) PRIMARY KEY, Journal
VARCHAR(25), Publisher Varchar(25), Edition
VARCHAR(25), Title Varchar(45), Author
Varchar(25))");
if (!$stmt) {
$e = oci_error($connection);
echo htmlentities($e['message']);
}
$r = oci_execute($stmt);
if (!$r) {
$e = oci_error($stmt);
echo htmlentities($e['message']);
}else{
echo $connection . " created table\n\n";
}
$sql = "INSERT INTO OE.Catalog VALUES('catalog1',
'Oracle Magazine', 'Oracle Publishing', 'Nov-Dec
2004', 'Database Resource Manager', 'Kimberly
Floss')";
$stmt = oci_parse($connection, $sql);
if (!$stmt) {
$e = oci_error($connection);
echo htmlentities($e['message']);
}
$r = oci_execute($stmt);
if (!$r) {
$e = oci_error($stmt);
echo htmlentities($e['message']);
}else{
echo $connection .
Pages:
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152