Netsuite error - The driver could not open a JDBC connection. Check the URL

KristiLogos
Contributor

I'm trying to connect to Netsuite2 with the JDBC driver I added to my cluster. I'm testing this in my Sandbox Netsuite and I have the below code but it keeps saying:

requirement failed: The driver could not open a JDBC connection. Check the URL: jdbc:netsuite://xxxxx-sb1.connect.api.netsuite.com:1708;ServerDataSource=NetSuite2.com;Encrypted=1;NegotiateSSLClose=false ;

 

The role I created has the following Permissions -> Setup: Access Token Management, Log in using Access Tokens, REST Web Services, SOAP Web Services, SuiteAnalytics Connect (All set to FULL)
 
account_id = "xxx_SB1"
role_id = "1174" 
consumer_key = "xxx"
consumer_secret = "xxx"
token_id = "xxx"
token_secret = "xxx"

 
host = "xxx-sb1.connect.api.netsuite.com"
port = 1708
driver = "com.netsuite.jdbc.openaccess.OpenAccessDriver"

 
jdbc_url = (f"jdbc:netsuite://{host}:{port};"
            f"ServerDataSource=NetSuite2.com;"
            f"Encrypted=1;"
            f"NegotiateSSLClose=false;")

connection_properties = {
    "driver": driver,
    "CustomProperties": (
        f"AccountID={account_id};"
        f"RoleID={role_id};"
        f"AuthType=TOKEN;"
        f"TokenID={token_id};"
        f"TokenSecret={token_secret};"
        f"ConsumerKey={consumer_key};"
        f"ConsumerSecret={consumer_secret}"
    )
}

# testing on oa_tables..
df = spark.read.jdbc(
    url=jdbc_url,
    table="OA_TABLES",
    properties=connection_properties
)

display(df)