Subject Re: Embedded FB1.5 Doesn't Like "localhost".
Author barfingdog_2004
--- In firebird-support@yahoogroups.com, Elmar Haneke <elmar@h...> wrote:
> > database_id = IBPP::DatabaseFactory(DB_SERVER_NAME,
> > database_path_and_name,
> > DB_USER_NAME,
> > DB_PASSWORD,
> > "", "",
> > "PAGE_SIZE 8192");
>
> Such an definition needs some correction inside to be used with local
> connections. The FB-Api expects Server-Name and database-Path to be in
> a single string with an colon in between. If the server-name is left
> out, the colon has to be ommitted to get an correct connection string
> for local connection.
>
> You should have a look at the source of your IBPP near to
> "isc_attach_database" and check what is passed as third parameter to
> isc_attach_database. You either will have to modify your source or to
> use some "Beta" code which does contain the relevant fix.
>
> Elmar

Thanks Elmar:

Geeze... You want me to help? I prefer to sit on my fat
butt and complain about the product of others dedication and
hard work.

Ok. First, when I posted I had an FDB file. I've deleted
that file and the battlefield has shifted to a different part
of my application. We are now at the battle of Create Database.
The error includes the same "Engine Code : 335544375" number,
so I think we are talking about the same issue.

My app looks for the ".FDB" file and if it's absent, it calls
my create database program. This is a simplified representation:

bool NR_DATABASE_RECORD::create_database(
char *database_path_and_name)

try
{
database_id =
IBPP::DatabaseFactory(DB_SERVER_NAME,
database_path_and_name,
DB_USER_NAME,
DB_PASSWORD,
"", "",
"PAGE_SIZE 8192");

database_id->Create(3);

// Get service from factory, setup synctwrite
// and other things, disconnect from service.

// Connect to database, create tables, disconnect.
}

It's easier to read with indents.

After calling DatabaseFactory, database_id's vfptr array has
reasonable looking addresses for a bunch of functions.

Tracing the "Create()" into the debug build of IBPP'
database.cpp eventually takes us to this point inside
void DatabaseImpl::Create(int dialect). Again, I'm sorry
for what I'm sure will be the loss of indentation.

// Call ExecuteImmediate to create the database
(*gds.Call()->m_dsql_execute_immediate)(status.Self(),
&mHandle, &tr_handle,
0, const_cast<char*>(create.c_str()),
short(dialect), NULL);
if (status.Errors())
throw ExceptionImpl(&status,
"Database::Create",
"isc_dsql_execute_immediate failed");

The call to (*gds.Call()->m_dsql_execute_immediate) returns
with status.Errors() errors asserted, and the instruction
pointer is at the "throw" statement. Here are the argument
values for the execute immediate, cut and pasted from the
debugger's watch window to avoid typos:

mHandle 0x00000000

tr_handle 0x00000000

create {0x00865689 "CREATE DATABASE
"E:\larryl\usr\work\xxxx\CODE\c++\xxxx\..\database\xxxx.fdb" USER
"yyyy" PASSWORD "zzzz" PAGE_SIZE 8192"}

dialect 3

It looks like the separating colon is absent, as it should
be.

One more experiment. I'll use a relative reference for the
database, this is the watch window info:

create {0x008657e1 "CREATE DATABASE "..\database\xxxx.fdb" USER "yyyy"
PASSWORD "zzzz" PAGE_SIZE 8192"}

Same problem.

Does this offer any clue?

Thanks
Larry