1

am getting a syntax error in my code. Can anyone say what's wrong in the syntax? I am new to this language, don't have much of an idea.

Error Message:

WASX7017E: Exception received while running file "jdbcconnection.jy"; exception information: com.ibm.bsf.BSFException: exception from Jython: Traceback (innermost last): (no code object) at line 0 File "", line 13 AdminTask.createJDBCProvider('[-scope Node='+nodeName+',Server='+serverName' -databaseType Oracle -providerType "Oracle JDBC Driver" -implementationType "Connection pool data source" - name "Oracle JDBC Driver" -description "Oracle JDBC Driver" -classpath [${ORACLE_JDBC_DRIVER_PATH}/ojdbc6.jar] -nativePath "" ]') ^ SyntaxError: invalid syntax


My code:

import sys

def jdbcoracle(nodeName,serverName):
        print 'Create JDBC provider'
    AdminTask.createJDBCProvider('[-scope Node='+nodeName+',Server='+serverName' -databaseType Oracle -providerType "Oracle JDBC Driver" -implementationType "Connection pool data source" -name "Oracle JDBC Driver" -description "Oracle JDBC Driver" -classpath [${ORACLE_JDBC_DRIVER_PATH}/ojdbc6.jar] -nativePath "" ]')
    AdminTask.createJDBCProvider('[-scope Node='+nodeName+',Server='+serverName' -databaseType Oracle -providerType "Oracle JDBC Driver" -implementationType "XA data source" -name "Oracle JDBC Driver (XA)" -description "Oracle JDBC Driver (XA)" -classpath [${ORACLE_JDBC_DRIVER_PATH}/ojdbc6.jar] -nativePath "" ]')
        AdminConfig.save()  
    print 'JDBC provider created'   
#-------------------------------------
# Main Application starts from here
#-------------------------------------
global nodeName, cellName
nodeName = sys.argv[0]
serverName = sys.argv[1]
jdbcoracle(nodeName,serverName)
1
  • Is your indentation correct or it's just incorrect formatting? Commented Oct 19, 2016 at 8:06

1 Answer 1

2

Your syntax would be invalid in any language. You have '...Server='+serverName' ...' - you are missing a + before the reopening of the quote.

Of course, you should not be building up strings like that; you should be using one of the many string formatting features available in Python, for example:

'[-scope Node={},Server={} -databaseType...'.format(nodeName, serverName)

I suspect you also mean ORACLE_JDBC_DRIVER_PATH to be an interpolated variable, but only you know where that is supposed to be coming from.

Sign up to request clarification or add additional context in comments.

2 Comments

Can you please type the syntax for the my case. I am nw in python scripting
I just did. And as I said, the syntax would be just as invalid in Java as it is in Python.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.