C & C++ API calls - creating a database from a template

C API: 5.0.3C++ API: 2.01

C call: NSFDbCreateAndCopy

C++ call: CreateDatabaseFromTemplate

both return the following msg:

Attempt to insert duplicate template into database - rejected

Has anyone else experienced this behaviour and/or found a workaround? It appears as though the database is created successfully. I have found that R6 is a lot more picky about duplicate template names than R5 was, but I’m attempting to create a database from a template, not a template from a template.

Thanks for listening,

Subject: C & C++ API calls - creating a database from a template

Firstly, which C++ which overloaded function are you using?CreateDatabaseFromTemplate( &templatedb, &newdb_path, &newdb_server, *newdb )

CreateDatabaseFromTemplate( &templatedb, &newdb_path, &newdb_server, &options, *newdb );

CreateDatabaseFromTemplate( &templatedb_path, &templatedb_server, &newdb_path, &newdb_server, *newdb );

CreateDatabaseFromTemplate( &templatedb_path, &templatedb_server, &newdb_path, &newdb_server, &options, *newdb );

I’d advise using the last function and specify the DBOptions you need, and its better to be safe than sorry by always populating all parameters. Even if the newdb_server is the same as the templatedb_server, don’t leave it blank and assume that the calling function will do as you expect… supply all data… I’ve learnt this the hard way.

I like doing manual tests in code to ensure everything is moving along smoothly. Try getting the ‘new’ database’s title after creating it. For more info have a look at the C++ sample called ‘copydb’.

And, whenever a function is giving me the @$#%^, I take a deep breath :), open a new compiler instance, and write a quick stand alone EXE that only performs that function and exits.

Hope this helps.

Sean

Subject: RE: C & C++ API calls - creating a database from a template

Hello Guys

I have a problem too with the mail template file

why I can not specify a mail template file when I register user using C++ API (LNCertifier::RegisterUser())?

The LNRegistrationOptions class does not has a “SetMailTemplateFileName()” function.

Is there any way i can specify the mail template file while user creation with the help of LNCertifier class

Any help is more than welcome…

Sunil