Connection to a Database with JDBC


Open ModelSphere can establish a JDBC connection to a database. Before trying to connect, be sure that the JDBC Driver is correctly installed. See Install JDBC Driver.


Setting a driver

To establish the connection, go to the main menu and choose: Tools > Database >Connect.



1 - Create a new connection's setting by clicking on the New button and fill the name field for the next uses.

2 - Enter the JDBC Driver class name. (See Install JDBC Driver) Test if the JDBC Driver is detected by ModelSphere by pushing the Test button.

3 - Enter the URL to connect to the database (See the next section).


URL

The format of URL depends on the target database, but looks like :

jdbc: {driver} // {host,name or ip} : {port} / {database name}

NB: host and port are optional.

Ex.
jdbc:postgresql://199.201.123.22:5400/database_1
jdbc:mysql://dbserver/mydb
jdbc:oracle:thin:@170.33.43.123:1521/oracl92

Refer to the JDBC driver provider documentation to know the exact syntax of the URL.


Default username and password

You can define a default username and a default password for the connection. But those fields can be left empty, the username and the password will be asked during the process.


Connect

Once the setting is done, click on the Select button. A window will appear for confirmation of the username and password, those fields contain the default username and password. You can modify them if you need and confirm by clicking on the OK button.



Another window will appear, to confirm the connection status and showing its informations.

To know if ModelSphere is connected, see if the database icon is active or not in the status bar.


Disconnect

To disconnect from a database, go in the main menu and choose: Tools > Database > Disconnect.


Connection Information

To see the connection information, go in the main menu and choose: Tools > Database > Show Connection Info...


Troubleshoot

If ModelSphere is unable to establish a connection with the database, here are some items to verify :