View previous topic :: View next topic |
Author |
Message |
jescab
Joined: 28 Jan 2008 Posts: 254
|
Posted: Tue Apr 03, 2012 1:51 pm Post subject: Error in attachDB() in the Rdb module. |
|
|
Hi.
In later Python dists there is some problem with the Rdb module.
See the difference:
Code: |
$ ld sh /All
%LD-I-CONNECTED, Connected _$1$LDA1: to DSA101:[PYTHON]JFPLIB0004A.DSK;1
%LD-I-CONNECTED, Connected _$1$LDA2: to DSA101:[PYTHON]JFPPY0014A.DSK;1
$
$ python
Python 2.5.4 (r254:67916, Jun 1 2010, 18:42:11) [DECC] on OpenVMS
Type "help", "copyright", "credits" or "license" for more information.
>>> import rdb
>>> rdb.attachDB('SA001DB', 'SADB')
>>> Exit
$ |
Code: |
$ ld sh /all
%LD-I-CONNECTED, Connected _$1$LDA1: to $1$DGA1410:[PYTHON]JFPLIB0004A.DSK;2
%LD-I-CONNECTED, Connected _$1$LDA2: to $1$DGA1410:[PYTHON]JFPPY0100A.DSK;1
$
$ python
Python 2.7.2+ (default, Oct 27 2011, 18:50:31) [DECC] on OpenVMS
Type "help", "copyright", "credits" or "license" for more information.
>>> import rdb
>>> rdb.attachDB('SA001DB', 'SADB')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/python_root/local/rdb/__init__.py", line 122, in attachDB
fnpart = list(vms.rms.parse(filename))
vms.rms.error: [Errno 100052] %RMS-F-SYN, file specification syntax error
>>> Exit
$ |
The definition of teh logical name SA001DB is the same in both systems (uses the "Rdb Transparent Gateway for Oracle") :
Code: |
$ show log sa001db
"SA001DB" = "/TYPE=ORACLE/USER="hquser"/PASS="hquser"/NODE=NYASATT/TABLES=(HV06)" (LNM$SYSTEM_TABLE)
$ |
attachDB should *not* try to parse the string as a VMS filename ! |
|
Back to top |
|
 |
jescab
Joined: 28 Jan 2008 Posts: 254
|
Posted: Tue Apr 03, 2012 1:59 pm Post subject: |
|
|
Temporalily "solved" by commenting out 4 lines in __init__.py:
Code: |
def attachDB(filename, alias = ""):
"""Attach to a database, using an optionally alias
If the alias is already used, just return.
"""
log.debug("attachDB filename:'%s' alias:'%s'" % (filename,alias))
alias = alias.upper()
dbs = _rdb.getDatabases()
# fnpart = list(vms.rms.parse(filename))
# if fnpart[4] == '.':
# fnpart[4] = '.RDB'
# filename = ''.join([x.upper() for x in fnpart])
if dbs.has_key(alias):
if dbs[alias] != filename:
raise ProgrammingError
return |
|
|
Back to top |
|
 |
jfp
Joined: 12 Jul 2004 Posts: 636
|
Posted: Fri Apr 06, 2012 2:42 pm Post subject: |
|
|
Hi,
the reason for parsing is if you attach to the same Rdb database using, for example, a different logical you will have some problems.
What can be done is, if the parse failed, just continue and try to attach to the database instead of raise a error.
JF
Last edited by jfp on Sat Apr 07, 2012 3:08 pm; edited 1 time in total |
|
Back to top |
|
 |
jescab
Joined: 28 Jan 2008 Posts: 254
|
Posted: Sat Apr 07, 2012 1:50 am Post subject: |
|
|
OK.
One could argue that it is up to the user/programmer if he want to make multiple attached to the same database.
Anyway, it currently works by removing the check. |
|
Back to top |
|
 |
jescab
Joined: 28 Jan 2008 Posts: 254
|
Posted: Wed Jul 25, 2012 12:15 pm Post subject: |
|
|
I just saw an update in "History, what's new" that points to :
http://hg.vmspython.org/vmspython/rev/ab44119330de.
Is that a fix of the issue reported in this thread ?
It seems to be araound the same code as I posted.
Best Regards
Jan-Erik. |
|
Back to top |
|
 |
jfp
Joined: 12 Jul 2004 Posts: 636
|
Posted: Wed Jul 25, 2012 5:12 pm Post subject: |
|
|
If have forgotten this thread...
I have included the fix for your problem.
Sorry,
JF |
|
Back to top |
|
 |
jescab
Joined: 28 Jan 2008 Posts: 254
|
Posted: Fri Jul 27, 2012 12:06 am Post subject: |
|
|
No reason to be sorry !
I can't complain, I think I got exactly what I payed for....
Thanks again for your work.
Jan-Erik. |
|
Back to top |
|
 |
|