[DB-SIG] kinterbasdb Strange problem.. PLS HELP...

David Rushby davidrushby at yahoo.com
Wed May 21 03:28:50 EDT 2003


--- Vivek Kumar <vivsar_guve at yahoo.co.uk> wrote:
[about a problem connecting to Firebird via kinterbasdb from Apache CGI]
> 
> The configuration I am using...
> Windows 2k professional
> Python 2.2.2
> KInterbasDB 3.0.2
> FirebirdSQL WI-V6.2.908 Firebird 1.0
> Apache 2.0.44

You're running Apache as a Windows service, correct?  Yet you're trying to
connect to the following DSN:
  "C:/data/SHOP.FDB"

Firebird will use the LOCAL connection protocol for that connection, as
opposed to the REMOTE (network) protocol that would be used if the DSN were:
  "localhost:C:/data/SHOP.FDB"

Firebird's local protocol is implemented in such a way that any program that
uses it must have access to "the desktop" (the actual implementation of the
local protocal varies between 1.0 and 1.5, but local connections in both
versions require access to local Windows resources, not just standard network
connectivity).

Unless you've specifically configured the Apache service by checking the
"Allow service to interact with desktop" checkbox under the "Log On" tab of
the Windows service config dialog, LOCAL Firebird connections made from
within the Apache service will not be able to attach to the database.

I suggest that you use the remote protocol rather than the local.  Although
you could change the Apache service configuration to allow it to interact
with the desktop, using local connections will probably come back to bite you
later (any time you write code that will run in the context of a Windows
service, the local protocol causes complications), so it's not worth the
trouble.

------

I also noticed the following snippet in your code:
---
cur.execute("""select gen_id(buyer_id_gen,1) from dummy""")
rst=cur.fetchone()
if len(rst)==0:
   ...
else:
   ...
---
In that code, rst will always be a tuple containing a single element (the
generated id); the first clause of the if statement will never be executed. 
If there's an error while generating/fetching the id, an exception will be
raised.

Also, you can use the "magic" table RDB$DATABASE as the target in arbitrary
select expressions, rather than establishing a dummy table.  Like this:
cur.execute("select gen_id(buyer_id_gen,1) from rdb$database")

__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com



More information about the DB-SIG mailing list