Connection URL Used with JDBC Driver Manager Example

You can use code like the following example to connect through a connection URL used with JDBC Driver Manager. Replace sample values with the values available under Your Configuration on the SuiteAnalytics Connect Driver Download page. For more information, see Connect Driver Download Page section.

          import java.sql.Connection;
import java.sql.DriverManager;

public class ConnectionTest
{
   public static void main(String[] args) throws Exception
   {
      Connection connection = null;
      try
      {
         Class.forName("com.netsuite.jdbc.openaccess.OpenAccessDriver");
         String connectionURL =
                  "jdbc:ns://<ServiceHost>:1708;" +
                  "ServerDataSource=NetSuite.com;" +
                  "Encrypted=1;" +
                  "NegotiateSSLClose=false;" +
                  "CustomProperties=(AccountID=<accountID>;RoleID=<roleID>)";
         connection = DriverManager.getConnection(connectionURL, "User", "Password");
         System.out.println("Connection success");
      }
      finally
      {
         if (connection != null)
               connection.close();
      }
   }
} 

        
Note:

The <ServiceHost>, <accountID>, and <roleID> variables correspond to your host name, account ID, and role ID. The values are available on the SuiteAnalytics Connect Driver Download page under Your Configuration. You can access the SuiteAnalytics Connect Driver Download page using the Set Up Analytics Connect link in the Settings portlet when you are logged in to NetSuite. For more information, see Finding Your Settings Portlet.

Related Topics

General Notices