DKM
DKM

Reputation: 1801

Oracle NetSuit ERP Connect Using Python

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()
 

Upvotes: 1

Views: 401

Answers (2)

Data Source should be 'NetSuite2.com'

You can check the documentation here: https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_4047458230.html#Data-Source-Example

Upvotes: 0

devale
devale

Reputation: 51

you should try it with NetSuite2.com:

ServerDataSource=NetSuite2.com

Upvotes: 0

Related Questions