-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.php
More file actions
24 lines (19 loc) · 731 Bytes
/
Copy pathtest.php
File metadata and controls
24 lines (19 loc) · 731 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php
$db_username = 'system';
$db_password = 'tiger';
$db_connection_string = 'oci:dbname=//localhost:1521/XE';
// $db_connection_string = 'oci:dbname=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=XE)))';
try {
$db = new PDO($db_connection_string, $db_username, $db_password);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sql = "SELECT USERNAME FROM DBA_USERS";
// Execute the query
$stmt = $db->query($sql);
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
echo $row['USERNAME'] . "<br>";
}
// Close the database connection
$db = null;
} catch (PDOException $e) {
echo "Connection failed: " . $e->getMessage();
}