This chapter completes the configuration of the application server, by adding a comprehensive description of the Java Enterprise services that can be run on top of the application server. Each service itself is a core subsystem, which can be included or removed, depending on the kind of applications you are delivering. Here, we will describe the most interesting ones, which have been increasingly adopted by the application server end-users, going in the following order of topics:
In any application server, you can configure database connectivity by adding datasources to your server configuration.
Each datasource contains a pool of database connections that are reserved as soon as the server is started up. Applications acquire a database connection from the datasource by looking it up on the JNDI tree and then calling getConnection().
Connection result = null; try { Context initialContext = new InitialContext(); DataSource datasource = (DataSource)initialContext.lookup(“java:/MySqlDS”); result = datasource.getConnection(); } catch ( Exception ex ) { log(“Cannot get connection: ” + ex); }
Once the connection is established, the application should call connection.close() as early as possible, which returns the database connection to the pool for other applications to use.
Earlier JBoss AS releases needed a well-known datasource configuration file (ending in –ds.xml), which had to be deployed in order to be used by applications. Since the release 7 of JBoss AS, you need to use a different approach, because of the modular nature of the application server.
Out of the box, the application server ships with the H2 open source database engine (HTTP://WWW.H2DATABASE.COM), which can be used for testing purposes because of its small footprint and its useful browser-based console.
However, a real world application requires an industry standard database, such as Oracle database or MySQL. In the following section, we will show how to configure a datasource for the MySQL database.
Basically, any database configuration requires a two-step procedure:
Frequently asked Jboss Interview Questions
Our work-support plans provide precise options as per your project tasks. Whether you are a newbie or an experienced professional seeking assistance in completing project tasks, we are here with the following plans to meet your custom needs:
Name | Dates | |
---|---|---|
JBoss Training | Nov 19 to Dec 04 | View Details |
JBoss Training | Nov 23 to Dec 08 | View Details |
JBoss Training | Nov 26 to Dec 11 | View Details |
JBoss Training | Nov 30 to Dec 15 | View Details |
I am Ruchitha, working as a content writer for MindMajix technologies. My writings focus on the latest technical software, tutorials, and innovations. I am also into research about AI and Neuromarketing. I am a media post-graduate from BCU – Birmingham, UK. Before, my writings focused on business articles on digital marketing and social media. You can connect with me on LinkedIn.