<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic JDBC Connection to NetSuite SuiteAnalytics Using Token-Based-Authentication (TBA) in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/jdbc-connection-to-netsuite-suiteanalytics-using-token-based/m-p/100165#M40208</link>
    <description>&lt;P&gt;I'm trying to connect to NetSuite2.com using Pyspark from a Databricks Notebook utilizing a JDBC driver.&lt;/P&gt;&lt;P&gt;I was successful in setting up my DBVisualizer connection by installing the JDBC Driver (JAR) and generating the password with the one-time hashing NONCE as required.&lt;/P&gt;&lt;P&gt;However, when I tried to run the same URL, JAR, and Password (utilizing NONCE) in pyspark (within Databricks)--- I came up with the following error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;SparkException: Job aborted due to stage failure: Task 0 in stage 36.0 failed 4 times, most recent failure: Lost task 0.3 in stage 36.0 (TID ***) (*** executor 1): java.sql.SQLException: [NetSuite][SuiteAnalytics Connect JDBC Driver][OpenAccess SDK SQL Engine]Failed to login using TBA. Error ticket# m3z*********cp2f[232]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I followed the password regeneration rules the same I did for DBVisualizer, but this still did not work. I tried multiple combinations in CustomProperties and keep getting this error.&lt;/P&gt;&lt;P&gt;Please look at the following code and identify the error and how to correct it:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;pwd = generate_tba_password(account_id, consumer_key, token_id, consumer_secret, token_secret)

# Construct the JDBC URL
jdbc_url = f"jdbc:ns://{host}:{port};ServerDataSource=NetSuite2.com;Encrypted=1;NegotiateSSLClose=false;" \
f"CustomProperties=(AccountID={account_id};RoleID={role_id};AuthType=TOKEN;" \
f"TokenID={token_id};TokenSecret={token_secret};ConsumerKey={consumer_key};ConsumerSecret={consumer_secret})"

# Read data from NetSuite
df = spark.read.format("jdbc") \
.option("url", jdbc_url) \
.option("User", "TBA") \
.option("Password", pwd) \
.option("driver", "com.netsuite.jdbc.openaccess.OpenAccessDriver") \
.option("dbtable", "customer") \
.load()

df.show()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 26 Nov 2024 23:37:52 GMT</pubDate>
    <dc:creator>ashap551</dc:creator>
    <dc:date>2024-11-26T23:37:52Z</dc:date>
    <item>
      <title>JDBC Connection to NetSuite SuiteAnalytics Using Token-Based-Authentication (TBA)</title>
      <link>https://community.databricks.com/t5/data-engineering/jdbc-connection-to-netsuite-suiteanalytics-using-token-based/m-p/100165#M40208</link>
      <description>&lt;P&gt;I'm trying to connect to NetSuite2.com using Pyspark from a Databricks Notebook utilizing a JDBC driver.&lt;/P&gt;&lt;P&gt;I was successful in setting up my DBVisualizer connection by installing the JDBC Driver (JAR) and generating the password with the one-time hashing NONCE as required.&lt;/P&gt;&lt;P&gt;However, when I tried to run the same URL, JAR, and Password (utilizing NONCE) in pyspark (within Databricks)--- I came up with the following error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;SparkException: Job aborted due to stage failure: Task 0 in stage 36.0 failed 4 times, most recent failure: Lost task 0.3 in stage 36.0 (TID ***) (*** executor 1): java.sql.SQLException: [NetSuite][SuiteAnalytics Connect JDBC Driver][OpenAccess SDK SQL Engine]Failed to login using TBA. Error ticket# m3z*********cp2f[232]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I followed the password regeneration rules the same I did for DBVisualizer, but this still did not work. I tried multiple combinations in CustomProperties and keep getting this error.&lt;/P&gt;&lt;P&gt;Please look at the following code and identify the error and how to correct it:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;pwd = generate_tba_password(account_id, consumer_key, token_id, consumer_secret, token_secret)

# Construct the JDBC URL
jdbc_url = f"jdbc:ns://{host}:{port};ServerDataSource=NetSuite2.com;Encrypted=1;NegotiateSSLClose=false;" \
f"CustomProperties=(AccountID={account_id};RoleID={role_id};AuthType=TOKEN;" \
f"TokenID={token_id};TokenSecret={token_secret};ConsumerKey={consumer_key};ConsumerSecret={consumer_secret})"

# Read data from NetSuite
df = spark.read.format("jdbc") \
.option("url", jdbc_url) \
.option("User", "TBA") \
.option("Password", pwd) \
.option("driver", "com.netsuite.jdbc.openaccess.OpenAccessDriver") \
.option("dbtable", "customer") \
.load()

df.show()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Nov 2024 23:37:52 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/jdbc-connection-to-netsuite-suiteanalytics-using-token-based/m-p/100165#M40208</guid>
      <dc:creator>ashap551</dc:creator>
      <dc:date>2024-11-26T23:37:52Z</dc:date>
    </item>
    <item>
      <title>Re: JDBC Connection to NetSuite SuiteAnalytics Using Token-Based-Authentication (TBA)</title>
      <link>https://community.databricks.com/t5/data-engineering/jdbc-connection-to-netsuite-suiteanalytics-using-token-based/m-p/100304#M40261</link>
      <description>&lt;P&gt;It seems like the issue might be related to the password generation or the JDBC URL configuration. Here are a few things you can check:&amp;nbsp;&lt;A href="https://www.nextcare-urgentcare.com" target="_self"&gt;&lt;FONT size="1 2 3 4 5 6 7" color="#FFFFFF"&gt;NextCareurgentcare&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1. Password Generation:&lt;/STRONG&gt; Ensure that the generate_tba_password function is correctly implemented and returns a valid password&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2. JDBC URL:&lt;/STRONG&gt; Make sure the JDBC URL is correctly formatted and does not contain any unnecessary parameters&lt;BR /&gt;Remove the ciphersuites parameter if it's present, as the JDBC server automatically selects the appropriate cipher suite&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;3. CustomProperties:&lt;/STRONG&gt; Double-check the CustomProperties in the JDBC URL to ensure they are correctly set.&lt;/P&gt;&lt;P&gt;Here's a revised version of your code with some adjustments:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;pwd = generate_tba_password(account_id, consumer_key, token_id, consumer_secret, token_secret)

# Construct the JDBC URL
jdbc_url = f"jdbc:ns://{host}:{port};ServerDataSource=NetSuite2.com;Encrypted=1;NegotiateSSLClose=false;" \
f"CustomProperties=(AccountID={account_id};RoleID={role_id};AuthType=TOKEN;" \
f"TokenID={token_id};TokenSecret={token_secret};ConsumerKey={consumer_key};ConsumerSecret={consumer_secret})"

# Read data from NetSuite
df = spark.read.format("jdbc") \
.option("url", jdbc_url) \
.option("User", "TBA") \
.option("Password", pwd) \
.option("driver", "com.netsuite.jdbc.openaccess.OpenAccessDriver") \
.option("dbtable", "customer") \
.load()

df.show()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Nov 2024 09:17:31 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/jdbc-connection-to-netsuite-suiteanalytics-using-token-based/m-p/100304#M40261</guid>
      <dc:creator>alicerichard65</dc:creator>
      <dc:date>2024-11-28T09:17:31Z</dc:date>
    </item>
    <item>
      <title>Re: JDBC Connection to NetSuite SuiteAnalytics Using Token-Based-Authentication (TBA)</title>
      <link>https://community.databricks.com/t5/data-engineering/jdbc-connection-to-netsuite-suiteanalytics-using-token-based/m-p/100472#M40312</link>
      <description>&lt;P&gt;Thank you. &amp;nbsp;Now I did confirm all my code works via DBVisualizer. &amp;nbsp;So the connection string and password generator appears correct.&lt;/P&gt;&lt;P&gt;I do have a question though. &amp;nbsp;I looked at the revised code and found it identical to my code. &amp;nbsp;Where you expecting to put a refinement that perhaps was lost?&lt;/P&gt;&lt;P&gt;thanks again for your help!&lt;/P&gt;</description>
      <pubDate>Sat, 30 Nov 2024 01:22:23 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/jdbc-connection-to-netsuite-suiteanalytics-using-token-based/m-p/100472#M40312</guid>
      <dc:creator>ashap551</dc:creator>
      <dc:date>2024-11-30T01:22:23Z</dc:date>
    </item>
  </channel>
</rss>

