Message6100

Author a_mehlig
Recipients a_mehlig
Date 2010-09-27.00:50:50
SpamBayes Score 4.1332138e-10
Marked as misclassified No
Message-id <1285548653.5.0.822917128535.issue1659@psf.upfronthosting.co.za>
In-reply-to
Content
I have been unable to call Sybase stored procedures from zxJDBC. 
Calls to callproc() always return None and I get a DatabaseError of "no results" when I subsequently call fetchone() or fetchall(). This is true both for procs with and without parameters. Raw SQL strings called via execute() seem to work fine, however. Please see below for a sample function to reproduce the error.

This is the Sybase version string:
Adaptive Server Enterprise/12.5.4/EBF 16128 ESD#9/P/Sun_svr4/OS 5.8/ase1254/2143/64-bit/FBO/Thu Feb  5 02:50:34 2009

I briefly checked the zxJDBC test module in the Jython source and it seems that the code has only been tested against Oracle & MS SQL Server.
I guess that it must be difficult to test all possible database platforms, so I would be happy to do a little beta testing against ASE 12.5.4 if it would help... ;)

Kind Regards,

Adrian Mehlig


def get_index_divisor(mds_code, query_date):
    
    url = config.get('Nikkei Database', 'URL') 
    login = config.get('Nikkei Database', 'Login')
    password = config.get('Nikkei Database', 'Password') 
    driver = config.get('Nikkei Database', 'Driver')
    
    try: 
        conn = zxJDBC.connect(url, login, password, driver)
        conn.autocommit = True
        cursor = conn.cursor()
        
        cursor.execute('select @@version')
        print str(cursor.rowcount) + ' rows returned'
        resultset = cursor.fetchall()
        for row in resultset:
            print row      

        cursor.execute('select top 5 * from dbo.Monthly_Price')
        print str(cursor.rowcount) + ' rows returned'
        resultset = cursor.fetchall()
        for row in resultset:
            print row   
            
        rc = cursor.callproc('sp_helpdb')
        print 'rc = ' + str(rc)
        print str(cursor.rowcount) + ' rows returned'
        resultset = cursor.fetchall()
        for row in resultset:
            print row   
        
        params = ['JP_NKY', query_date.strftime('%Y%m%d')]
        print params
        cursor.callproc('SpGetDivisorForMDS', params)
         
#        result = cursor.fetchall()        
        result = cursor.fetchone()
        for row in result:
            print row
                
    except zxJDBC.DatabaseError, e:
        print 'DatabaseError: ', e
        
    finally:
        if cursor:
            cursor.close()
        if conn:
            conn.close()
History
Date User Action Args
2010-09-27 00:50:53a_mehligsetrecipients: + a_mehlig
2010-09-27 00:50:53a_mehligsetmessageid: <1285548653.5.0.822917128535.issue1659@psf.upfronthosting.co.za>
2010-09-27 00:50:53a_mehliglinkissue1659 messages
2010-09-27 00:50:50a_mehligcreate