NAME

CGI::Session::Driver::odbc - A CGI::Session driver for ODBC

Synopsis

$s = CGI::Session -> new('driver:ODBC', $sid);
$s = CGI::Session -> new('driver:ODBC', $sid,
{
	DataSource => 'dbi:ODBC:test',
	User       => 'sherzodr',
	Password   => 'hello',
});
$s = CGI::Session -> new('driver:ODBC', $sid, {Handle => $dbh});

Description

CGI::Session::Driver::odbc stores session records in an ODBC-compatile table. For details see CGI::Session::Driver::DBI, its parent class.

Driver Arguments

The CGI::Session::Driver::odbc driver supports all the arguments documented in CGI::Session::Driver::DBI. In addition, the DataSource argument can optionally leave the leading "dbi:ODBC:" string out:

$s = CGI::Session -> new('driver:ODBC', $sid, {DataSource => 'shopping_cart'});
# is the same as:
$s = CGI::Session -> new('driver:ODBC', $sid, {DataSource => 'dbi:ODBC:shopping_cart'});

Backwards Compatibility

For backwards compatibility, you can also set the table like this before calling new(). However, it is not recommended because it can cause conflicts in a persistent environment.

$CGI::Session::ODBC::TABLE_NAME = 'my_sessions';

The sessions table

The CGI::Session::DBI docs recommend using this SQL create statement:

create table sessions
(
	id char(32) not null unique,
	a_session text not null
);

Under Oracle, change the column type of the a_session column from text to long, and if you use Class::DBI::Loader, which wants a primary key in every table, change the definition of your id column too. Thus you want:

create table sessions
(
	id char(32) not null primary key, # I.e.: 'unique' => 'primary key'.
	a_session long not null           # I.e.: 'text' => 'long'.
);

Distributions

This module is available both as a Unix-style distro (*.tgz) and an ActiveState-style distro (*.ppd). The latter is shipped in a *.zip file.

See http://savage.net.au/Perl-modules/html/installing-a-module.html for help on unpacking and installing each type of distro.

Required Modules

Carp
CGI::Session::Driver::DBI

Credits

This code is partially copied from the corresponding MySql driver by Sherzod Ruzmetov and the Postgres driver by Cosimo Streppone.

Author

CGI::Session::Driver::odbc was written by Ron Savage <ron@savage.net.au> in 2006.

Home page: http://savage.net.au/index.html

Copyright

Australian copyright (c) 2005, Ron Savage. All rights reserved.

All Programs of mine are 'OSI Certified Open Source Software';
you can redistribute them and/or modify them under the terms of
The Artistic License, a copy of which is available at:
http://www.opensource.org/licenses/index.html