Quick links: Content - sections - sub sections
EN

Trace: fin database-config

This is an old revision of the document!


Configuring the database access

Before going further with code, you have to configure Jelix to be able to access a database, and feed this databasea little bit. We will indeed store our news in a table

Jelix can handle mysql, postgresql, sqlite and pdo. Through its driver system, it is possible to add other types of databases (if you don't want to use pdo).

Access configuration file

The access to a database is configured in the actu.org/var/config/dbprofils.ini.php file. In this file, you can specify one or several connexion profiles, then one ore several connexions.

Each profile has a name and is specified like this :

[ProfileName]
driver="mysql"    ; name of the driver to use
database="foo"    ; name of the base to use
host= "localhost" ; name of the machine of the database server
user= "john"      ; connexion user
password="doo"    ; password
persistent= on    ; indicating if the connexion is persistent

Except the dirver parameter, which is mandatory, the other parameters depend on the driver which is used. In general, you will have the database, host, user and password parameters. Change the content of this file according to your configuration. We will take as profile name “actu.org” for example, and we will define this profile as the default one by specifying it with the “default” parameter.

default = actu.org
 
[actu.org]
driver="mysql"
database="actu"  
host= "localhost"
user= "actu"   
password="actu"
persistent= on 

Check in the actu.org/var/config/config.classic.ini.php file that the dbprofil parameter shows the dbprofils.ini.php clearly.

 dbProfils = dbprofils.ini.php

It is indeed sometimes interesting to have several entrance points, then several settings sharing the same connexion profiles file, or that each one has its own connexions file.

en/tutorial/database-config.1159519914.txt.gz · Last modified: 2006/10/17 20:31 (external edit)

Recent changes RSS feed Creative Commons License