JDBC Data Source Example

You can use code like the following example to connect through JDBC Data Source. Replace bold text with the values available under Your Configuration on the SuiteAnalytics Connect Driver Download page. For more information, see Connect Driver Download Page section.

          import com.netsuite.jdbcx.openaccess.OpenAccessDataSource;
import java.sql.Connection;

public class ConnectionTest
{
   public static void main(String[] args) throws Exception
   {
         Connection connection = null;
         try
         {
            OpenAccessDataSource sds = new OpenAccessDataSource();
            sds.setServerDataSource("NetSuite2.com");
            sds.setServerName("<ServiceHost>");
            sds.setPortNumber(1708);
            sds.setCustomProperties("(AccountID=<accountID>;RoleID=<roleID>)");
            sds.setEncrypted(1);
            sds.setNegotiateSSLClose("false");
            connection = sds.getConnection("User", "Password");
         }
         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

JDBC Code Examples
Connection URL Used with JDBC Driver Manager Example

General Notices