Personalize Database Connection Settings to Aid in Team Development

When a development team is developing a system that requires accessing a database, it is a common practice to setup local databases on each of the development environment and populate them with all the required schema of the system so that developers can develop and test the function they implement with test data in their own database, rather than working with actual data with production database.

Working with testing data in development environment

Working with testing data in development environment

Visual Paradigm supports designing database schema with Entity Relationship Diagram (ERD), exporting the design to a database and generating Hibernate ORM code for accessing database. We also enable users to share the design through team collaboration function, so that all the development and production environments can work consistently with the same and latest database design. Although different environments can share the same database design, it is impractical to have them share the same set of database connection information. For instance, developer Peter may have ‘demo’ as database name, with ‘peter’ as login, while developer Mary may have ‘dev’ as database name and ‘mary’ as login. The production environment, certainly won’t name the database as ‘demo’ or ‘dev’, but with more meaningful name like ‘shop’ that reflect the nature of the system.

Different environments have their own database settings

Different environments have their own database settings

Due to fact that different environments can have their own set of database settings, it is a bad idea to bind the database connection setting required in generating ORM code and updating database along with the design. If that’s the case, all users will require a re-configuration of setting for their own environments prior to generating ORM code and/or updating database schema. This is not just cumbersome, but may corrupt important data in database if a wrong connection setting is supplied by mistake. For these reasons, Visual Paradigm supports personalizing the database connection information so that each user can have their own set of database connection setting. To be specific, the personalized setting is stored within workspace instead of project. Therefore, it will not affect any other user and the production environment. It affects only the generated Hibernate files and the database in specific environment.

Let’s take a look at how to personalize the database connection information. When you generate ORM code (Tools > Hibernate > Generate Code…) or database (Tools > Database > Generate Database…), you will be prompted the window where you can configure code and/or the way of generating database. In order to proceed with generation, you must supply the database connection information under the Database tab. At the bottom of the tab you can see the Database Configuration section where you can set the connection information. By default, the settings showed are made for production database. See the drop down menu Production:

Connection settings for production database

Connection settings for production database

You usually update the production database only when the development activities are completed, tested and confirmed to be stable. If you are going to generate code/database for the production database and you need to change the connection setting, click Database Options and update the setting in the popup window.

If you are going to generate code/database for development or any other environments, click on the Production drop down menu and select Personal.

Switch to production settings

Switch to production settings

Then, the Connection URL, User and Password field will become editable. Edit them by entering the settings that matches your environment.

Personalize database connection setting entered

Personalize database connection setting entered

From now on, when you update your Hibernate code or database, you can apply your own database connection setting without overwriting anyone else setting.

Related Links

1 reply

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply