Have you read the MLDBM documentation? It is very clear on the prerequisites and there is a fine example included, which can easily be adapted to your purposes. Perhaps you should post your current code and we can let you know where you're going wrong.