skip to main content
Using the driver : Connecting from an application : Connecting using data sources : Creating data sources : Example Data Source
  

Try DataDirect Drivers Now
Example Data Source
To configure a data source using the example files, you will need to create a data source definition. The content required to create a data source definition is divided into three sections. For example:
import com.ddtek.jdbcx.SForce.SForceDataSource;
Next, you will need to set the values and define the data source. For example, the following definition contains the minimum properties required to establish connection:
Important: Setting the password and security token using a data source is generally not recommended. The data source persists all properties, including the Password and SecurityToken properties, in clear text.
SForceDataSource mds = new SForceDataSource();
mds.setDescription("My Salesforce Datasource");
mds.setServerName("login.salesforce.com");
mds.setUser("abc@defcorp.com");
mds.setPassword("secret");
mds.setSecurityToken("XaBARTsLZReM4Px47qPLOS");
Finally, you will need to configure the example application to print out the data source attributes. Note that this code is specific to the driver and should only be used in the example application. For example, you would add the following section for the minimum properties required to establish a connection:
if (ds instanceof SForceDataSource)
{
SForceDataSource jmds = (SForceDataSource) ds;
System.out.println("description=" + jmds.getDescription());
System.out.println("serverName=" + jmds.getServerName());
System.out.println("user=" + jmds.getUser());
System.out.println("password=" + jmds.getPassword());
System.out.println("securityToken=" + jmds.getSecurityToken());
System.out.println();
}