Messages from list : cormas@cirad.fr

Choose a topic among the following archives :

Re: utilisation d'un SGBD pour intitialiser un modele

New Message Reply Date view Thread view Subject view Author view

Subject: Re: utilisation d'un SGBD pour intitialiser un modele
From: Pierre Bommel (bommel@cirad.fr)
Date: Tue May 09 2006 - 16:22:03 CEST

Bonjour Fredj,
(je répond en anglais car cette liste héberge de nombreux
non-francophones)
Even if I don't know any model that uses Access to be initialized,
there is some facilities to connect Cormas to Access.
On the tutorial web page (http://cormas.cirad.fr/en/outil/outguid.htm)
you can read the CormasTutorial2.pdf. The last chapter is dedicated to
the connexion to Access in the purpose of saving your simulation data
into a database.
To set up the ODBC bridge under Windows, you can see the end notes
(Appendices p.33)
To get data from the tables of a data base, I advise you to see the
ODBC and ODBC_AccessRequest protocols at the level of CormasModel
class. Here, you have the usefull following methods :
* opening a ODBC connexion to Access :
- createAccessConnection: username password: password base: aDataBase
        "Create a ODBC connection on base aDataBase (<String>) with username
(<String>) and password (<String>).
        This method may be called from your model in order to save or get
values from a database."
* Then you can use SQL command to get the data from a request :
- getDataFromAccess_sql: sqlRequest
that returns a collection from an SQL request on Access.
Be carefull: Except in case of error, the connexion with the database
won't be release.
* closing the connexion :
- disconnectAccessConnection

If you just need one single request, you should rather use :
- getDataFromAccess: aDataBase username: username password: password
sql: sqlRequest
This returns a collection from an SQL request on Access. It creates an
ODBC connection on base aDataBase (<String>) with username (<String>)
and password (<String>).
Then it send the request (<String>) and finally releases the connexion.

sqlRequest should be a String. Examples : 'SELECT * FROM myTable'
If you need quotes in your request, you should double the quotes. Be
careful: Two quotes (' + ') are differents from quotation marks ('').
Ex:
        'SELECT * FROM myTable WHERE version LIKE ''ECEC.st'' '

Example:
        self getDataFromAccess: 'cormasSimulations' username: 'bommel'
password: '' sql: 'SELECT * FROM SimName WHERE version LIKE
''ECEC.st'''

Hope it help,

        Pierre

Le 9 mai 06, à 03:57, toukabri fredj a écrit :

>
> bonjour
> Je suis un eleve ingenieur Informaticien, dans le cadre de mon projet
> de fin d'etudes Je suis en train d'implémenter
> un modèle multi-agent qui va simuler la dynamique spatiale (
> occupation du sol ) et sociale dans un micro bassin versant d'une zone
> aride du sud-est tunisien,
> je veux une documentation sur l'utilisation d'une base de donnees
> pour intialiser mon modele c a dire tout ce qui configuration
> connection a la base et requettes de selection
>
> merci d'avance.
>
> Fredj Toukebri
>
> Eleve ingenieur à l'Ecole Nationnale des Sciences de l'Informatique
> de Tunis.
> Encadrants: Bruno Romagny chercheur a l'IRD Tunisie
>
> Wided Chaari docteur en informatique a l 'ENSI tunisie.
>
>
>
> mail: toukebri_fredj@mail2tunisia.com
>
> Tel: 00(216)95 954 932.
>
> _______________________________________________________________
> Get the FREE email that has everyone talking at
> http://www.mail2world.com
> Unlimited Email Storage – POP3 – Calendar – SMS – Translator – Much
> More!
        Pierre Bommel - CIRAD - UR Green
        Universidade de Brasília - Centro de Desenvolvimento Sustentável
        SHIS QI 26, Conjunto 15, Casa 18
        71670-150
        Brasília DF
        tel: (00 55 61) 3367 3405
        http://www.cirad.fr/ur/green

New Message Reply Date view Thread view Subject view Author view
 

Back to home