# perldoc > Apache::Session::Store::Oracle

---
type: CommandReference
command: Apache::Session::Store::Oracle
mode: perldoc
section: ""
source: perldoc
---

## Quick Reference

- `tie %hash, 'Apache::Session::Oracle', $id, { DataSource => 'dbi:Oracle:database', UserName => 'user', Password => 'pass' }` — Tie a session hash to Oracle storage with connection details.
- `tie %hash, 'Apache::Session::Oracle', $id, { Handle => $dbh }` — Tie using an existing DBI handle.
- `$store->insert($ref)` — Insert a new session record.
- `$store->update($ref)` — Update an existing session record.
- `$store->materialize($ref)` — Retrieve session data from the database.
- `$store->remove($ref)` — Delete a session record.
- `LongReadLen => 65536` — Set maximum session object size (overrides default 8KB).
- Schema: `CREATE TABLE sessions (id varchar2(32) not null primary key, a_session long)` — Required table definition.

## Name

Store persistent data in an Oracle database — a storage backend for `Apache::Session`.

## Synopsis

perl
use Apache::Session::Store::Oracle;

my $store = new Apache::Session::Store::Oracle;

$store->insert($ref);
$store->update($ref);
$store->materialize($ref);
$store->remove($ref);
## Options

Configuration keys passed in the tied hash options or to the constructor:

- `DataSource` — DBI connection string (e.g., `'dbi:Oracle:database'`).
- `UserName` — Database username.
- `Password` — Database password.
- `Handle` — An already‑opened DBI handle (alternative to DataSource/UserName/Password).
- `LongReadLen` — Maximum size of the session object in bytes; default is 8192 (8 KB).

## Examples

Tie a session hash with explicit connection parameters:

perl
tie %hash, 'Apache::Session::Oracle', $id, {
    DataSource => 'dbi:Oracle:database',
    UserName   => 'database_user',
    Password   => 'K00l'
};
Tie using an existing DBI handle:

perl
tie %hash, 'Apache::Session::Oracle', $id, {
    Handle => $dbh
};
Create the required database table (via `sqlplus`):

sql
CREATE TABLE sessions (
    id varchar2(32) not null primary key,
    a_session long
);
## See Also

[Apache::Session](https://metacpan.org/pod/Apache::Session), [Apache::Session::Store::DBI](https://metacpan.org/pod/Apache::Session::Store::DBI)