cduce ocaml-mysql

miniserveur at ifrance.com miniserveur at ifrance.com
Tue Dec 12 21:18:39 CET 2006


Bonjour à tous,
Je suis actuellement en train de tester la connexion à une base de
données MySQL avec CDuce.

Malheuresment je ne suis pas programmeur Ocaml, mais aimerait bien
comprendre et solutionner mon erreur.
Voici mon code :

(* variables de connexion *)
let hote = "localhost"
let base = "PRPC"
let port = 8080
let login = "jonas"
let pass = ""

(* connexion à la base *)
let db = Mysql.connect ~host:hote ~database:base ~port:None
~password:None ~user:login;;

(* affichage des informations relatives à la base *)
print [
  'Client info: ' !(Mysql.client_info []) '\n'
  'Host info: ' !(Mysql.host_info db) '\n'
  'Server info: ' !(Mysql.server_info db) '\n'
  'Proto info: ' !(string_of (Mysql.proto_info db)) '\n'
];;

(* COMPILATION
 * cduce --compile mysql.cd -I `ocamlfind query mysql`
 * ocamlfind ocamlc -o mysql -pp "cduce --mlstub" -impl mysql.cdo   \
 * -package cduce,mysql -linkpkg
 *)

L'erreur se trouve ici :

let db = Mysql.connect ~host:hote ~database:base ~port:None
~password:None ~user:login;;

Le probléme est que je ne comprends pas l'API
(http://raevnos.pennmush.org/code/ocaml-mysql/doc/Mysql.html)
donc, par conséquent je n'arrive pas à me connnecter à ma base.

D'avance merci.

----------------------------------------------------------------------------------------------------------------------------------------------------------------------

Hello everybody,

I testing the connection at the databases MySQL with CDuce.

Unfortunaly, i'm not ocaml developer, but i'd like find the solution
and understand my error.

My error is :

let db = Mysql.connect ~host:hote ~database:base ~port:None
~password:None ~user:login;;

The problem is that I don't understand the API
(http://raevnos.pennmush.org/code/ocaml-mysql/doc/Mysql.html)
and so, I don't can to connect with the database.

Thanks. 



More information about the Cduce-users mailing list