Subject Re: [firebird-support] How do you use the fbembed.dll?
Author Helen Borrie
At 05:52 AM 12/04/2006, you wrote:
>Hi,
>
>I was unsuccessful in using FBEmbed.dll (renamed to FBClient.dll with
>conf and msg file copied application directory,
>
>I can compiel and link successful, however, when I tried to create a
>database, it always returns sqlcode == -902, which is database already
>exists.
>
>How come?
>
>Here is my sample code:
>
> isc_db_handle newdb = NULL; // database handle
> isc_tr_handle trans = NULL; // transaction handle
> long sqlcode;
> char dbName[] = "new.fdb";
> char szSQL[1024];
>
> sprintf(szSQL, "create database \'%s\'", dbName);
>
> ISC_STATUS_ARRAY status; /* status vector */
>
> if (isc_dsql_execute_immediate(status, &newdb, &trans, 0, szSQL,
>1, NULL)) {
> // create database failed
> // Extract SQLCODE from the status vector.
> sqlcode = isc_sqlcode(status);
> if (sqlcode == -902)
> printf("Database %s already exists\n", dbName]);
> else {
> printf("Create database: %s failed, sqlcode: %d!\n",
>dbName, sqlcode);
> isc_print_status(status);
> }
> }
> else {
> isc_commit_transaction(status, &trans);
> printf("Created database '%s'.\n\n", bbName);
>
> } // if (isc_dsql_execute_immediate(status, &newdb, &trans, 0,
>create_db, 1, NULL)) {
>
> if (newdb != NULL) {
> printf("* * * detaching database...\n");
> isc_detach_database(status, &newdb);
> } // if (newdb != NULL) {

There are actually 66 errors that can throw sqlcode -902. Perhaps
more research is needed?

Additionally, embedded is intended for deployment, not
development. Develop your app using the full Superserver so that you
avoid I/O errors when connecting to a database during development.

./heLen