Subject | How do you use the fbembed.dll? |
---|---|
Author | Jeff Lynn |
Post date | 2006-04-11T19:52:48Z |
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) {
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) {