Extension tool - DB connection : getting Checksum fail Error

primuppaprimuppa Posts: 5

I am getting below error
Error Message:
Error during script execution. View Details for more information.

Checksum fail

Additional Details:
Checksum fail

java.sql.SQLRecoverableException: IO Error: Checksum fail

at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:682)

at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:715)

at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:385)

at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtensio

for the jython script written in extension tool. Can you please help me resolving the same. I have ojdbc7.jar set in the preferences->JDBC. I tried even ojdbc8.jar.

I am not able to use the DB tool as I need to get the db password from the vault which I get in the response of a setup script. So had to explicitly use extension tool.

Below is the script

from java.sql import DriverManager
from soaptest.api import *
from com.parasoft.api import *
from com.parasoft.api import Context as context
from javax.naming import Context

def main(input,context):
connection = getConnection(input,context)
accountNo = str(context.getEnvironmentVariableValue('BillingAccountId'))
statement = connection.createStatement()
cspquery = "query='"+accountNo+"'"
resultSet = statement.executeQuery(cspquery)
connection.commit()

def getConnection(input,context):
# load drive
driverName = "oracle.jdbc.driver.OracleDriver"
DB_URL = "url"
DB_USER = str(context.getValue('','db_username'))
DB_PASSWD = str(context.getValue('','db_password'))
# get connection to database
SQLUtil.getConnection(driverName, DB_URL, DB_USER, DB_PASSWD)

Best Answers

  • benken_parasoftbenken_parasoft Posts: 981 ✭✭✭
    edited April 12 Accepted Answer
  • williammccuskerwilliammccusker Posts: 499 ✭✭✭
    Accepted Answer

    Another idea might be to use the script to instead return the password from the vault to a text databank and then use that password in the DB tool. That way the DB Tool can take care of creating the connection and running the query.

    I attached an example using dummy values that show how it would work. Basically the extension tool would script accessing the password from the vault. The script then returns the password as a string and then the value is added data banked by the Text Data Bank that is chained to the return value of the extension tool.

    The DB Tool, which is after the extension tool, can be configure with the data bank column from the Text Data Bank. In this case the Text Data Bank is creating a column named "password" so in the Password field of the DB Tool the value is accessed by typing in the following

    ${password}

    Throughout the product when ${} is used it tells the tool to look for a data banked value in a column with the name inside the ${}. In this case the DB Tool will look up the "password" in the Text Data Bank which came from the vault.

    I used example values for everything so it won't run, you'll need to setup something similar in put in the actual Driver, URL, etc. into the DB Tool and create the script for reading from the vault.

    Hope this helps!

Answers

  • primuppaprimuppa Posts: 5

    Thank you @benken_parasoft for your quick response. jar update helped with the checksum fail error. but now I see below error
    Traceback (most recent call last):

    File "", line 12, in main

    AttributeError: 'NoneType' object has no attribute 'createStatement'

  • benken_parasoftbenken_parasoft Posts: 981 ✭✭✭
    edited April 12

    AttributeError: 'NoneType' object has no attribute 'createStatement'

    Your getConnection() method returned nothing. So you call "createStatement" on nothing. I think you are missing a "return" statement in getConnection(). You want "return SQLUtil.getConnection(..."

  • williammccuskerwilliammccusker Posts: 499 ✭✭✭

    Hi,

    It sounds like perhaps. the connection that was returned was null? Can you check if the code in the script was able to successfully create a connection?

  • primuppaprimuppa Posts: 5

    Thank you @williammccusker I actually tried this ${password} but was getting checksum fail error. I thought it might be issue with password being given as ${password}. But I tried now again with the new ojdbc jar provided by @benken_parasoft It works now... So removed the extension script. Using DB tool. Thank you once again for quick response @williammccusker @benken_parasoft

  • williammccuskerwilliammccusker Posts: 499 ✭✭✭

    Happy to help!

Sign In or Register to comment.