By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,091 Members | 1,546 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,091 IT Pros & Developers. It's quick & easy.

Connecting to Firebird database using Kinterbasdb+Python

P: n/a
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
Jul 21 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Maurice LING wrote:
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

Jul 21 '05 #2

P: n/a
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

Jul 21 '05 #3

P: n/a
Mathias Waack wrote:
Maurice LING wrote:

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?


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
Jul 21 '05 #4

P: n/a
On Tue, 05 Jul 2005 09:35:25 +1000, Maurice LING <ma*********@acm.org>
declaimed the following in comp.lang.python:

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>
-- ================================================== ============ <
wl*****@ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG <
wu******@dm.net | Bestiaria Support Staff <
================================================== ============ <
Home Page: <http://www.dm.net/~wulfraed/> <
Overflow Page: <http://wlfraed.home.netcom.com/> <

Jul 21 '05 #5

P: n/a
Maurice LING wrote:
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
Jul 21 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.