Overload 2

Parameters:

URL The XDB Server URL (String)
Connection Properties The data connection properties defined in a single instance of a Properties Object

Comments:

Use Overload 2 if you have a Java development environment that supports Properties Objects and you have a number of properties that you want to set for each data connection.

In addition to specifying the property values in a Properties Object, you can:

  • Override property values in the URL itself
  • Use predefined property values by specifying the name of a data profile in your Properties Object

Example:

This example uses Overload 2 to set properties in a Properties Object and then pass the properties with the URL. Note that you must add the prefix mf. to every property name except user and password in a Properties Object.

void  Connection login (String sUser, String sPassword) {
          
            Properties props;
            String sURL = “ jdbc:mf://myhost”;

            //create a Properties Object
            props = new Properties();

            //load properties from a properties file
            props.load(new FileInputStream(“mydb.properties”));

            //set the numthreads property to 1
            props.put(“mf.numthreads”, “1”);
 
            // Set the user name and password
            props.put(“user”, sUser);
            props.put(“password”, sPassword);
 
            //connect to the database
            return DriverManager.getConnection(sURL, props);

}