forum.vmspython.org Forum Index forum.vmspython.org
Forum system
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Error in attachDB() in the Rdb module.

 
Post new topic   Reply to topic    forum.vmspython.org Forum Index -> Python for OpenVMS
View previous topic :: View next topic  
Author Message
jescab



Joined: 28 Jan 2008
Posts: 254

PostPosted: Tue Apr 03, 2012 1:51 pm    Post subject: Error in attachDB() in the Rdb module. Reply with quote

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
View user's profile Send private message
jescab



Joined: 28 Jan 2008
Posts: 254

PostPosted: Tue Apr 03, 2012 1:59 pm    Post subject: Reply with quote

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
View user's profile Send private message
jfp



Joined: 12 Jul 2004
Posts: 636

PostPosted: Fri Apr 06, 2012 2:42 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
jescab



Joined: 28 Jan 2008
Posts: 254

PostPosted: Sat Apr 07, 2012 1:50 am    Post subject: Reply with quote

OK.
One could argue that it is up to the user/programmer if he want to make multiple attached to the same database. Smile
Anyway, it currently works by removing the check.
Back to top
View user's profile Send private message
jescab



Joined: 28 Jan 2008
Posts: 254

PostPosted: Wed Jul 25, 2012 12:15 pm    Post subject: Reply with quote

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
View user's profile Send private message
jfp



Joined: 12 Jul 2004
Posts: 636

PostPosted: Wed Jul 25, 2012 5:12 pm    Post subject: Reply with quote

Embarassed If have forgotten this thread...

I have included the fix for your problem.

Sorry,

JF
Back to top
View user's profile Send private message Send e-mail Visit poster's website
jescab



Joined: 28 Jan 2008
Posts: 254

PostPosted: Fri Jul 27, 2012 12:06 am    Post subject: Reply with quote

No reason to be sorry !
I can't complain, I think I got exactly what I payed for.... Smile

Thanks again for your work.

Jan-Erik.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vmspython.org Forum Index -> Python for OpenVMS All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group