0

I am trying to connect with Oracle ERP Netsuit using a JDBC driver in python code but it is giving me an error below, also I am not sure about connection string if its the correct way of setting up.

Error:

Connection error: java.sql.SQLNonTransientConnectionException: Internal network error, connection closed.

Code:

import jaydebeapi

def main():
    connection = None
    try:
        # Load the Netsuite JDBC driver
        driver = "com.netsuite.jdbc.openaccess.OpenAccessDriver"
        jar_path = "NQjc.jar"  # Path to the NQjc.jar file
        conn_str = "jdbc:ns://https://<ServiceHost>:1708;" \
                   "ServerDataSource=NetSuite.com;" \
                   "Encrypted=1;" \
                   "NegotiateSSLClose=false;" \
                   "CustomProperties=(AccountID=<accountID>;RoleID=1000)"
        user = "USERNAME"
        password = "PASSWORD"

        # Establish the connection
        connection = jaydebeapi.connect(driver, conn_str, [user, password], jars=jar_path)
        print("Connection success")
    except Exception as e:
        print(f"Connection error: {str(e)}")
    finally:
        if connection is not None:
            connection.close()

if __name__ == "__main__":
    main()
 
DKM
  • 1,761
  • 2
  • 19
  • 34

0 Answers0