You are here: Client Development > Using the NuoDB Java JDBC Driver > Notes for Using Java JDBC Driver > Specifying Properties on the Connection URL

Specifying Properties on the Connection URL

You can specify connection properties on the JDBC URL directly, as shown:

jdbc://com.nuodb://host[:port]/database_name?[connection properties]

where connection properties are a set of key-value pairs separated by ampersands (&).

This is an important feature for situations where you control only the JDBC URL and none of the underlying Java code.

Recognized properties can be found at Connection Properties.

In the example below, we are connecting to a database named test, with user "cloud" and password "user", and using the schema "mytest".

jdbc:com.nuodb://localhost/test?user=cloud&password=user&schema=mytest

You can also set properties programmatically, as shown below:

String connectURL = "jdbc:com.nuodb://broker_host:48004/my_database";
   Properties connectProperties = new Properties();
   connectProperties.put("user", DB_USER);
   connectProperties.put("password", DB_PASSWORD);
   connectProperties.put("schema", "test");
   connectProperties.put("isolation", "write_committed");
   try {
       connection = DriverManager.getConnection(connectURL, connectProperties);
       connection.setAutoCommit(false);
   } catch (SQLException e) {
       throw new RuntimeException(
           "TestConnection: cannot open database " + database +
               " at " + connectURL +
               "; check user credentials and broker status.",
           e );
   }