Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

How To Guides
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Problem Solutions
Privacy Policy




7.2. Using MySQL as the Default DataSource

MySQL is a one of the most popular open source databases around and is used by many prominent organizations from Yahoo to NASA. The official JDBC driver for it is called Connector/J . For this example we’ve used MySQL 4.1.7 and Connector/J 3.0.15. You can download them both from .

7.2.1. Creating a Database and User

We’ll assume that you’ve already installed MySQL and that you have it running and are familiar with the basics. Run the mysql client program from the command line so we can execute some administration commands. You should make sure that you are connected as a user with sufficient privileges (e.g. by specifying the -u root option to run as the MySQL root user).
First create a database called jboss within MySQL for use by JBoss.
mysql> CREATE DATABASE jboss; 
Query OK, 1 row affected (0.05 sec)
Then check that it has been created.
| Database | 
| jboss    | 
| mysql    | 
| test     | 
3 rows in set (0.00 sec)
Next, create a user called jboss with password password to access the database.
mysql> GRANT ALL PRIVILEGES ON jboss.* TO [email protected] IDENTIFIED BY 'password'; 
Query OK, 0 rows affected (0.06 sec)
Again, you can check that everything has gone smoothly.
mysql> select User,Host,Password from mysql.User; 
| User  | Host      | Password         | 
| root  | localhost |                  |
| root  | %         |                  | 
|       | localhost |                  | 
|       | %         |                  | 
| jboss | localhost | 5d2e19393cc5ef67 | 
5 rows in set (0.02 sec)

  Published under the terms of the Open Publication License Design by Interspire