# perldoc > CGI::Session::Driver::sqlite

yaml
---
type: CommandReference
command: CGI::Session::Driver::sqlite
mode: perldoc
section: ""
source: perldoc
---
## Quick Reference
- `CGI::Session->new("driver:sqlite", $sid, {DataSource=>'/path/db.sqlt'})` — use file path
- `CGI::Session->new("driver:sqlite", $sid, {Handle=>$dbh})` — use existing DBI handle
- `CGI::Session->new('driver:sqlite', undef, {TableName=>'session', IdColName=>'my_id', DataColName=>'my_data', Handle=>$dbh})` — customize table/column names
- `CGI::Session->new("driver:sqlite", $sid, {DataSource=>'/tmp/sessions.sqlt'})` — (insecure) use default temp location

## Name
CGI::Session driver for SQLite

## Synopsis
perl
$s = CGI::Session->new("driver:sqlite", $sid, {DataSource=>'/my/folder/sessions.sqlt'});
$s = CGI::Session->new("driver:sqlite", $sid, {Handle=>$dbh});

$s = CGI::Session->new('driver:sqlite', undef, {
    TableName=>'session',
    IdColName=>'my_id',
    DataColName=>'my_data',
    Handle=>$dbh,
});
## Options
- `DataSource` — path to SQLite database file. If absent, defaults to `/tmp/sessions.sqlt` (insecure). If missing `dbi:SQLite:` prefix, it is prepended automatically.
- `Handle` — a DBI database handle (`$dbh`) returned by `DBI::connect()`. Mutually exclusive with `DataSource`.
- `TableName` — name of the session table (default: `'session'`)
- `IdColName` — column name for session ID (default: `'id'`)
- `DataColName` — column name for serialized session data (default: `'a_session'`)

## Examples
perl
# Using a file path
$s = CGI::Session->new("driver:sqlite", $sid, {DataSource=>'/var/sessions.db'});

# Using an existing DBI handle
my $dbh = DBI->connect("dbi:SQLite:dbname=/var/sessions.db", '', '');
$s = CGI::Session->new("driver:sqlite", $sid, {Handle=>$dbh});

# Custom table and column names
$s = CGI::Session->new('driver:sqlite', undef, {
    TableName=>'my_sessions',
    IdColName=>'sid',
    DataColName=>'data',
    Handle=>$dbh,
});
## See Also
- [CGI::Session](http://localhost/phpMan.php/perldoc/CGI%3A%3ASession/markdown) — parent session management module
- [CGI::Session::Driver::DBI](http://localhost/phpMan.php/perldoc/CGI%3A%3ASession%3A%3ADriver%3A%3ADBI/markdown) — base DBI driver class (inherits from this)
- [DBD::SQLite](http://localhost/phpMan.php/perldoc/DBD%3A%3ASQLite/markdown) — SQLite DBI driver
