skip to main content
Using the driver : Connecting from an Application : Connecting Using the JDBC Driver Manager : Passing Connection URLs
  

Try DataDirect Drivers Now
Passing Connection URLs
This section shows the correct format for specifying a connection URL.
Syntax
jdbc:datadirect:mongodb://host:port;
DatabaseName=database;SchemaMap=schema;[property=value[;...]]
where:
host
specifies the name or the IP address of the server to which you want to connect.
port
specifies the port number of the server listener. The default is 27017.
DatabaseName
specifies the name of the database to which you want to connect. This value is used as the default qualifier for unqualified table names in SQL queries. Required for User/ID password authentication.
Important: This value is case-insensitive if you have access privileges to query the list of databases on the server. If you do not have access, this value is case-sensitive.
SchemaMap
specifies the fully qualified path of the configuration file where the relational map of native data is written. The driver looks for this file when connecting to a MongoDB server. If the file does not exist, the driver creates one. See SchemaMap for further details.
property=value
specifies connection property settings. Multiple properties are separated by a semi-colon. For more information on connection properties, see Using Connection Properties.
This example shows how to establish a connection to a MongoDB data store with user ID/password authentication:
Connection conn = DriverManager.getConnection
("jdbc:datadirect:mongodb://MyServer:27017;DatabaseName=Test;
SchemaMap=C:\\Users\\MyUserProfile\\AppData\\Local\\Progress\\DataDirect\\MongoDB_Schema\\MyServer.config;
UserName=admin;Password=adminpass");