JDBC Data Source Example
Here's an example of how 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.
NetSuite email address and password authentication method can't be used with a role that requires 2FA. For more information, see Two-Factor Authentication for All Roles and SuiteAnalytics Connect.
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();
}
}
}
The <ServiceHost>, <accountID>, and <roleID> variables correspond to your host name, account ID, and role ID. Find the values 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're logged in to NetSuite. For more information, see Finding Your Settings Portlet.