Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
documentation:latest:sqlsessionbackend [2018/08/23 07:19]
xguimard
documentation:latest:sqlsessionbackend [2019/06/28 14:28] (current)
Line 2: Line 2:
  
 SQL session backend can be used with many SQL databases such as: SQL session backend can be used with many SQL databases such as:
-  * [[https://​metacpan.org/​pod/​Apache::​Session::​MySQL|MySQL]]+  * [[https://​metacpan.org/​pod/​Apache::​Session::​MySQL|MariaDB / MySQL]]
   * [[https://​metacpan.org/​pod/​Apache::​Session::​Postgres|PostgreSQL]]   * [[https://​metacpan.org/​pod/​Apache::​Session::​Postgres|PostgreSQL]]
   * [[https://​metacpan.org/​pod/​Apache::​Session::​Oracle|Oracle]]   * [[https://​metacpan.org/​pod/​Apache::​Session::​Oracle|Oracle]]
Line 23: Line 23:
 Create a database if necessary: Create a database if necessary:
 <​code>​ <​code>​
-mysqladmin create ​lemonldapng+mysqladmin create ​lemonldap-ng
 </​code>​ </​code>​
  
Line 34: Line 34:
 </​file>​ </​file>​
  
-<note important>​Change char(32) by char(64) if you use the now recommended SHA256 hash algorithm. See [[documentation:​latest:​sessions|Sessions]] for more details</​note>​+<note important>​Change ​''​char(32)'' ​by ''​varchar(64)'' ​if you use the now recommended SHA256 hash algorithm. See [[documentation:​latest:​sessions|Sessions]] for more details</​note>​
  
 <note tip>You can change table name ''​sessions''​ to whatever you want, just adapt the parameter ''​TableName''​ in module options.</​note>​ <note tip>You can change table name ''​sessions''​ to whatever you want, just adapt the parameter ''​TableName''​ in module options.</​note>​
 +
 +<note important>​For a better UTF-8 support, use [[https://​metacpan.org/​pod/​DBD::​MariaDB|DBD::​MariaDB]] with Apache::​Session*::​MySQL instead of DBD::​mysql</​note>​
  
 === PostgreSQL === === PostgreSQL ===
Line 67: Line 69:
 Mot de passe pour l'​utilisateur lemonldap-ng : Mot de passe pour l'​utilisateur lemonldap-ng :
 [...] [...]
-lemonldap-ng=>​ create table sessions ( id char(32) not null primary key, a_session text );+lemonldap-ng=>​ create ​unlogged ​table sessions ( id char(32) not null primary key, a_session text );
 lemonldap-ng=>​ q lemonldap-ng=>​ q
 </​code>​ </​code>​
  
-<note important>​Change char(32) by char(64) if you use the now recommanded ​SHA256 hash algorithm. See [[documentation:​latest:​sessions|Sessions]] for more details</​note>​+<note important>​Change ​''​char(32)'' ​by ''​varchar(64)'' ​if you use the now recommended ​SHA256 hash algorithm. See [[documentation:​latest:​sessions|Sessions]] for more details</​note>​
  
 ==== Manager ​ ==== ==== Manager ​ ====
Line 80: Line 82:
 ^  Name  ^  Comment ​ ^  Example ​ ^ ^  Name  ^  Comment ​ ^  Example ​ ^
 |  **DataSource** ​ | The [[https://​metacpan.org/​pod/​DBI|DBI]] string | dbi:​Pg:​dbname=sessions;​host=10.2.3.1 | |  **DataSource** ​ | The [[https://​metacpan.org/​pod/​DBI|DBI]] string | dbi:​Pg:​dbname=sessions;​host=10.2.3.1 |
-|  **UserName** ​ | The database username | lemonldapng ​|+|  **UserName** ​ | The database username | lemonldap-ng ​|
 |  **Password** ​ | The database password | mysuperpassword | |  **Password** ​ | The database password | mysuperpassword |
 |  **Commit** ​ | Required for PostgreSQL | 1 | |  **Commit** ​ | Required for PostgreSQL | 1 |
-|  **TableName** ​ | Name of the table | sessions |+|  **TableName** ​ | //​(Optional)// ​Name of the table | sessions |
  
-You must read the man page corresponding to your database ([[https://​metacpan.org/​pod/​Apache::​Session::​MySQL|Apache::​Session::​MySQL]],​ ...) to learn more about parameters. You must also install the database connector ([[https://​metacpan.org/​pod/​DBD::​Oracle|DBD::​Oracle]],​ [[https://​metacpan.org/​pod/​DBD::​Pg|DBD::​Pg]],​...)+You must read the man page corresponding to your database ([[https://​metacpan.org/​pod/​Apache::​Session::​MySQL|Apache::​Session::​MySQL]],​ ...) to learn more about parameters. You must also install the database connector ([[https://​metacpan.org/​pod/​DBD::​Oracle]],​ [[https://​metacpan.org/​pod/​DBD::​Pg|DBD::​Pg]],​...)
  
-<​note ​tip>+<​note ​important>
 For MySQL, you need to set additional parameters: For MySQL, you need to set additional parameters:
   * LockDataSource   * LockDataSource
Line 94: Line 96:
 </​note>​ </​note>​
  
-If you choose to use MySQL, read [[performances#​apachesession_performances|how to increase ​MySQL performances]].+<note tip> 
 +For better performances, ​you can use specific [[browseablesessionbackend|browseable session backend]]. 
 + 
 +Learn more at [[performances#​apachesession_performances|how to increase ​Data Base performances]]. 
 +</​note>​ 
 + 
 +=== UTF8 support === 
 + 
 +If you may store some non-ASCII characters, you must add the parameter corresponding to your database. 
 + 
 +^  Database ​ ^  Parameter name  ^  Value  ^ 
 +|  MySQL  |  mysql_enable_utf8 ​ |  1  | 
 +|  PostgreSQL ​ |  pg_enable_utf8 ​ |  1  | 
 +|  SQLite ​ |  sqlite_unicode ​ |  1  |
  
 ===== Security ===== ===== Security =====