Connecting to Firebird database using Kinterbasdb+Python

M

Maurice LING

Hi,

I've been using FB1.5 and access the database using Kinterbasdb +
Python. My connection is established using kinterbasdb.connect() method
and the parameters host, dns, database, user, password are all defaulted
to 'None'.

On my own machine running Mac OSX 10.3, I can connect using the following:
host = 'localhost'
database = '<my path to FB database>'
user = '<user>'
password = '<password>'

At the same time, I can also connect if I set host=None on my machine.

However, I cannot use 'localhost' on a shared Linux machine (not
allowed. Don't ask why, system admin's mandate. And the Linux machine is
without inetd). So when I set host=None, I get this error:

Connecting to Muscopedia Database
Connection:
localhost:/mnt/disk/home/mling/muscorian/BioDatabases/muscopedia.fdb:mouse:mouse
<-- default
None <-- actual host (with 'print self.dbhost' where
kinterbasdb.connect(host = self.dbhost,.....)
OperationalError
(-902, 'isc_attach_database: Unable to complete network request to host
"localhost".. Failed to establish a connection.. Connection refused. ')
File "muscorian.py", line 641, in main
result = mosys.run(command)

File "muscorian.py", line 597, in run
elif (command[0] == 'linkmuscopedia'):
self.commandLinkMuscopediaDB(command)

File "muscorian.py", line 129, in commandLinkMuscopediaDB
self.muscopedia = PubMedGrabber.FBUtilities(str(command[1]))

File "abcrawl/PubMedGrabber.py", line 340, in __init__
user = self.dbuser, password = self.dbpwd, charset='UNICODE_FSS')

File "/usr/lib/python2.2/site-packages/kinterbasdb/__init__.py", line
470, in connect
return Connection(*args, **keywords_args)

File "/usr/lib/python2.2/site-packages/kinterbasdb/__init__.py", line
608, in __init__
self._C_con = _k.attach_db(dsn, dpb, dialect)

Any ideas or solutions?

Thanks in advance.

Cheers
maurice
 
M

Mathias Waack

Maurice said:
I've been using FB1.5 and access the database using Kinterbasdb +
Python. My connection is established using kinterbasdb.connect() method
and the parameters host, dns, database, user, password are all defaulted
to 'None'.

On my own machine running Mac OSX 10.3, I can connect using the following:
host = 'localhost'
database = '<my path to FB database>'
user = '<user>'
password = '<password>'

At the same time, I can also connect if I set host=None on my machine.

However, I cannot use 'localhost' on a shared Linux machine (not
allowed. Don't ask why, system admin's mandate. And the Linux machine is
without inetd). So when I set host=None, I get this error:

Just for my understanding: if you start your script on the machine hosting
the DB you're able to connect. If you start it on a different machine, you
are not able to connect without giving a hostname? Whats wrong with
offering the the name (or IP-address) of your MacOS-box instead of
'localhost' to the script?

Mathias
 
G

Grig Gheorghiu

How is your Firebird database configured -- Classic Server or Super
Server? If it's in classic server mode, you don't need to worry about
the host portion. You do need to worry about permissions on the
database file. I got it to work by making it 664 and owner + group
firebird.

Grig
 
M

Maurice LING

Mathias said:
Maurice LING wrote:




Just for my understanding: if you start your script on the machine hosting
the DB you're able to connect. If you start it on a different machine, you
are not able to connect without giving a hostname? Whats wrong with
offering the the name (or IP-address) of your MacOS-box instead of
'localhost' to the script?

Hi Mathias,

What I am trying to do is "port" a workable program from my own machine
(Mac OSX) to a larger machine (Linux). So, the DB and the program are
also on the same Linux machine.

On the Linux machine, I cannot use localhost, so I set host parameter in
kinterbasdb.connect() method to None, which is the default kinterbasdb
uses. On Linux machine, I get the error as posted. On my Mac OSX
machine, initiating host parameter to 'localhost' or None has no
difference, it works.

Thanks and cheers
Maurice
 
D

Dennis Lee Bieber

On the Linux machine, I cannot use localhost, so I set host parameter in

So... Does the machine have a defined name? Plug that name into
the connect.

Or just hard-code "127.0.0.1", the loopback IP # that normally
is assigned to "localhost" <G>


--
 
M

Mathias Waack

Maurice said:
What I am trying to do is "port" a workable program from my own machine
(Mac OSX) to a larger machine (Linux). So, the DB and the program are
also on the same Linux machine.

On the Linux machine, I cannot use localhost, so I set host parameter in
kinterbasdb.connect() method to None, which is the default kinterbasdb
uses. On Linux machine, I get the error as posted. On my Mac OSX
machine, initiating host parameter to 'localhost' or None has no
difference, it works.

How do you connect to the Linux-DB using tools like isql?

Check you firebird config (most likely in /etc/firebird2/firebird.conf) for
the parameters "RemoteServicePort" and "RemoteBindAddress". And at least
try "netstat -alp | grep fbserv" (as root) to check if the firebird is
running properly.

If you're running the classic server you can simply follow Grig's advice and
connect "directly" to the db files.

Mathias
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top