How to get the NONSTOP hp db driver?

396 views Asked by At

How can I connect to a sql/mp or sql/mx database on Nonstop using python.?

i have followed this to get the connection established to HP nonstop database, I am getting error as driver DRIVER={NonStop ODBC/MX 3.6} is not found.

Help is appreciated.

2

There are 2 answers

0
laurent alsina On

for this I use jpype:

import jpype
import jpype.imports
from jpype.types import *
from jpype import JString
driver_jar_path = "C:\\develop\\automation\\libraries\\t4sqlmx-3.8.1.jar"
jvmPath = jpype.getDefaultJVMPath()
args='-Djava.class.path=%s' % driver_jar_path
jpype.startJVM(jvmPath, args)
from java.util import EnumSet
from java.util.logging import Level
from java.util.logging import Logger
from java.sql import SQLException
from java.util import Properties
from com.tandem.t4jdbc import SQLMXDriver
my_properties = Properties()
my_properties.setProperty("user", "myuser")
my_properties.setProperty("password", "mypassword")
my_properties.setProperty("catalog", "CAT_SOMETHING")
my_properties.setProperty("schema", "SOMETHING_ALIAS")
my_driver = SQLMXDriver()
conn = my_driver.connect(JString("jdbc:t4sqlmx://myaddress:1234"), my_properties)
stmt = conn.createStatement()
stmt.executeQuery("""...
0
UDAY REDDY KAIPA On

To connect the NonStop sql or for any relevant databases, a ODBC or JDBC driver is required.

From my experience JDBC works with JAVA only thought there are pyodbc and other python libs are available( they didn't work for me and they internally depends on java.)

Better to do it in java. In my case I called the java class from python using os level commands and result stored in excel which is read from python again.