Viewing database configuration properties

In this recipe we'll see how the database properties list command lets us view the list of database properties and their values, as specified in the database.properties file.

Getting ready

Refer to the Setting up a JPA provider for your project recipe to create a flight-app Roo project and to set up a persistence provider using the persistence setup command.

Note

You won't need this recipe if you're using a JNDI-bound data source in your Roo project.

How to do it...

Follow these steps to view database properties:

  1. Start the Roo shell from the C: oo-cookbookch02-recipes directory.
  2. To view database properties defined in the database.properties file located in SRC_MAIN_RESOURCESMETA-INFspring directory, you can use the database properties list command, as shown here:
    roo> database properties list
    
    database.driverClassName = com.mysql.jdbc.Driver
    database.password =
    database.url = jdbc:mysql://localhost:3306/myFlightAppDB
    database.username =
    

How it works...

The database properties list command is processed by the JPA add-on . Instead of using the database properties list command you can use the properties list command (refer to the Viewing properties defined in a properties file recipe of Chapter 1), which shows the properties contained in a properties file. The end result of using either of the commands is the same, the only difference being that you need to specify the name and path arguments in the properties list command to refer to the database.properties file.

There's more...

Instead of using Spring Roo, you can also view the database.properties file using an IDE like Eclipse or STS. The whole idea of using Spring Roo's database properties list command is to allow developers to look at the database properties without switching to the IDE.

See also

  • The next recipe, Managing database configuration properties, shows how you can add, remove, and modify properties defined in the database.properties file of your Roo project.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.139.105.159