Connecting to Firebird database using Kinterbasdb+Python

2005-07-04 Thread 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 = ''
user = ''
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
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Connecting to Firebird database using Kinterbasdb+Python

2005-07-04 Thread Mathias Waack
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 = ''
> user = ''
> 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

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Connecting to Firebird database using Kinterbasdb+Python

2005-07-04 Thread 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

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Connecting to Firebird database using Kinterbasdb+Python

2005-07-04 Thread Maurice LING
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 = ''
>>user = ''
>>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
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Connecting to Firebird database using Kinterbasdb+Python

2005-07-04 Thread Mathias Waack
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
-- 
http://mail.python.org/mailman/listinfo/python-list