Quick links: Content - sections - sub sections
EN

Trace: tutorial 1.2.x 1.4 1.3.x

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:tutorials:main:database-config [2007/09/17 22:42] – external edit 127.0.0.1en:tutorials:main:database-config [2008/11/19 21:42] (current) laurent
Line 1: Line 1:
-====== Configuring the database access ====== 
  
 Before going further with code, you have to configure Jelix to be able to access a database, and feed this database a bit. We will indeed store our news in a table. Before going further with code, you have to configure Jelix to be able to access a database, and feed this database a bit. We will indeed store our news in a table.
Line 7: Line 6:
 ===== Access configuration file ===== ===== Access configuration file =====
  
-The access to a database is configured in the news.org/var/config/dbprofils.ini.php file. In this file, you can specify one or several connexion profiles, then one ore several connexions.+The access to a database is configured in the news.org/var/config/dbprofils.ini.php file. In this file, you can specify one or more connection profiles, then one or more connections.
  
-Each profile has a name and is  specified like this :+Each profile has a name and are specified like this :
  
 <code ini> <code ini>
 [ProfileName] [ProfileName]
 driver="mysql"    ; name of the driver to use driver="mysql"    ; name of the driver to use
-database="foo"    ; name of the base to use +database="foo"    ; name of the database to use 
-host= "localhost"name of the machine of the database server +host= "localhost"hostname or ip to database server 
-user= "john"      ; connexion user+user= "john"      ; connection user
 password="doo"    ; password password="doo"    ; password
-persistent= on    ; indicating if the connexion is persistent+persistent= on    ; indicating if the connection is persistent
 force_encoding = off; force_encoding = off;
 </code> </code>
  
-Except the driver 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. +Except the driver parameter which is mandatory, the other parameters depends on the driver which are used. In general, you will have the database, host, user and password parameters. 
  
 Now change the content of this file according to your configuration. We will take as profile name "news.org" for example, and we will define this profile as the default one by specifying it with the "default" parameter. Now change the content of this file according to your configuration. We will take as profile name "news.org" for example, and we will define this profile as the default one by specifying it with the "default" parameter.
Line 39: Line 38:
  
  
-Note: It is indeed sometimes interesting to have several entry points, then several settings sharing the same connexion profiles file, or that each one has its own connexions file.  If you want to have different configuration files for the database access, create other ini files, and push their name in the **dbProfils** option in the configuration file of the entry point.+Note: It is indeed sometimes interesting to have several entry points, then several settings sharing the same connection profiles file, or that each one has its own connections file.  If you want to have different configuration files for the database access, create other ini files, and push their name in the **dbProfils** option in the configuration file of the entry point.
  
 <code ini> <code ini>
Line 71: Line 70:
 We are now ready to use this data in our application. We are now ready to use this data in our application.
  
----- 
-   * Next : [[en:tutorials:main:using-dao|Using a DAO]] 
-   * Previous : [[en:tutorials:main:creating-action|Creating an action]] 
-   * [[en:tutorials:main|Back to the summary]] 

en/tutorials/main/database-config.1190068942.txt.gz · Last modified: 2008/06/26 09:12 (external edit)

Recent changes RSS feed Creative Commons License