Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9116055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:34:48+00:00 2026-06-17T04:34:48+00:00

This is my source code sample inspired by code samples that are part of

  • 0

This is my source code sample inspired by code samples that are part of Firebird installation directory (C:\Program Files\Firebird\Firebird_2_5\examples):

AnsiString db_path = MainForm->exeFilePath + "\\results.fdb"; // C:\Projects\DBX\bin\results.fdb
if (FileExists(db_path))
{
    return;
}

HMODULE dll = LoadLibrary(L"fbclient.dll");
if (dll == NULL)
{
    throw Exception(L"Failed to load Firebird client library FBCLIENT.DLL!\r\nApplication will exit now.");
}

Pisc_dsql_execute_immediate pisc_dsql_execute_immediate = (Pisc_dsql_execute_immediate)GetProcAddress(dll, "isc_dsql_execute_immediate");
if (pisc_dsql_execute_immediate == NULL)
{
    throw Exception(L"Failed to load 'isc_dsql_execute_immediate' entry point in FBCLIENT.DLL. It seems like Firebird installation is corrupted. "
    "Contact system administrator.\r\nApplication will exit now.");
}

Pisc_commit_transaction pisc_commit_transaction = (Pisc_commit_transaction)GetProcAddress(dll, "isc_commit_transaction");
if (pisc_commit_transaction == NULL)
{
    throw Exception(L"Failed to load 'isc_commit_transaction' entry point in FBCLIENT.DLL. It seems like Firebird installation is corrupted. "
    "Contact system administrator.\r\nApplication will exit now.");
}

Pisc_detach_database pisc_detach_database = (Pisc_detach_database)GetProcAddress(dll, "isc_detach_database");
if (pisc_detach_database == NULL)
{
    throw Exception(L"Failed to load 'isc_detach_database' entry point in FBCLIENT.DLL. It seems like Firebird installation is corrupted. "
    "Contact system administrator.\r\nApplication will exit now.");
}

Pisc_sqlcode pisc_sqlcode = (Pisc_sqlcode)GetProcAddress(dll, "isc_sqlcode");
if (pisc_sqlcode == NULL)
{
    throw Exception(L"Failed to load 'isc_sqlcode' entry point in FBCLIENT.DLL. It seems like Firebird installation is corrupted. "
    "Contact system administrator.\r\nApplication will exit now.");
}

ISC_STATUS_ARRAY status;               /* status vector */
isc_db_handle   newdb = NULL;          /* database handle */
isc_tr_handle   trans = NULL;          /* transaction handle */
AnsiString create_db;
create_db.printf("CREATE DATABASE '%s'", db_path.c_str());
long sqlcode;
UnicodeString msg;

if (pisc_dsql_execute_immediate(status, &newdb, &trans, 0, create_db.c_str(), 1, NULL))
{
    // ERROR OCCURRES HERE
    sqlcode = pisc_sqlcode(status);
    msg.printf(L"Operation 'CREATE DATABASE' failed with sqlcode %ld.\r\nApplication will exit now.", sqlcode);
    throw Exception(msg.c_str());
}

pisc_commit_transaction(status, &trans);
pisc_detach_database(status, &newdb);

FreeLibrary(dll);
dll = NULL;

Database creation is failing with sql code -902. The directory ‘C:\Projects\DBX\bin\’ exists and doesn’t contain file named ‘results.fdb’. Whats the reason for error behaviour and how can I avoid it? Is there somewhere detailed description of Firebird API?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T04:34:49+00:00Added an answer on June 17, 2026 at 4:34 am

    What I forgot were user credentials. See updated code sample (excerpt):

    ISC_STATUS_ARRAY status;               /* status vector */
    isc_db_handle   newdb = NULL;          /* database handle */
    isc_tr_handle   trans = NULL;          /* transaction handle */
    AnsiString create_db;
    create_db.printf("CREATE DATABASE '%s' USER '%S' PASSWORD '%S'", db_path.c_str(), MainForm->currentUser.name, MainForm->currentUser.password);
    long sqlcode;
    UnicodeString msg;
    
    if (pisc_dsql_execute_immediate(status, &newdb, &trans, 0, create_db.c_str(), 1, NULL))
    {
        sqlcode = pisc_sqlcode(status);
        msg.printf(L"Operation 'CREATE DATABASE' failed with sqlcode %ld.\r\nApplication will exit now.", sqlcode);
        throw Exception(msg.c_str());
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is anyone aware of any sample or open-source code that does this? Or a
I have this source code from 2001 that I would like to compile. It
I am using vala. This is the source code that gives that compile time
Inspired by this topic , I decided to write a simple program that does
I have this WxWidgets test source code that compiles, and when run, it shows
Hi I have converted this parallel extension c# code sample to VB.NET http://code.msdn.microsoft.com/Samples-for-Parallel-b4b76364/sourcecode?fileId=25353&pathId=215900242 using
I found this sample source code for C# from How to convert a Unix
How to build a .bundle from source code? This might sound like a simple
In my open-source plain C code I use this simple structure to read and
I have this source code: idx=0 b=plt.psd(dOD[:,idx],Fs=self.fs,NFFT=512) B=np.zeros((2*len(self.Chan),len(b[0]))) B[idx,:]=20*log10(b[0]) c=plt.psd(dOD_filt[:,idx],Fs=self.fs,NFFT=512) C=np.zeros((2*len(self.Chan),len(b[0]))) C[idx,:]=20*log10(c[0]) for idx

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.