We will open a course next semester-J2EE
I have been reading books a few days ago. <J2EE: the complete reference> (J2EE reference), I feel pretty good, so I am eager to practice it :-)
To practice, of course, there must be practical objects, So I first found a set of IBM J2EE exercises to follow.
I have posted the exercise questions to my blog. You can check them out:
However, the development environment Used in the tutorial is wsad (WebSphere Studio Application Developer) + WebSphere + DB2, all of which are big headers, and I am using Linux. I have read it, webSphere does not seem to support my Linux release --!
In the end, I thought that using MJm (myeclipse + JBoss + MySQL) should take the open-source path as much as possible (you can also use the eclipse version of for Java EE, but I still don't think myeclipse is convenient)
Okay, let's talk about it. Next, let's take a look at one of the key points of this post: Development Environment configuration.
1. Eclipse & myeclipse
Download eclipse classic edition to the http://www.eclipse.org/downloads,
Http://www.myeclipseide.com/download myeclipse, pay attention to download the corresponding version of Eclipse.
Here I use eclipse euroqa + myeclipse 6.0 M1
2. JBoss
Download JBoss from http://labs.jboss.com.
Here I use JBoss 4.2.1
3. MySQL and related connection drivers
Download MySQL and the corresponding connection driver to the http://www.mysql.org.
Here I downloaded the installation directly from the Ubuntu source, the version is MySQL 5.0.38-Ubuntu_0ubuntu1-log,
The connection driver is mysql-connector-java-5.0.6-bin.jar
OK. The second point of this post is the configuration of MySQL database connection.
1. Engineering Scenario Description
Refer to IBM's J2EE excercise 3. Here is a brief introduction to the practice experiment. In the experiment, three projects are created respectively,
Enterprise Application project, Java project, and web project. It should be because this experiment has not introduced ejbs or some of its business logic frameworks or persistence layer frameworks. Therefore, Java projects mainly process business logic and database operations.
Generally, the J2EE application needs to connect to the database in a Java project.
2. Compile the configuration file for database connection
In that exercise, a configuration file named databaseinformation. properties is read. The configuration file information is as follows:
Type = driver
Initialcontextfactory = com. IBM. websphere. Naming. wsninitialcontextfactory
Lookupurl = IIOP :///
LookupName = JDBC/Library
Userid = userid
Password = Password
Url = JDBC: DB2: Library
Driver = com. IBM. db2.jdbc. App. db2driver
Modify as follows:
Type = driver
Initialcontextfactory = com. IBM. websphere. Naming. wsninitialcontextfactory
Lookupurl = IIOP :///
LookupName = JDBC/Library
Userid = <your ID>
Password = <your password>
Url = JDBC: mysql: // localhost: 3306/Library
Driver = com. MySQL. JDBC. Driver
Write the configuration file and place it under jboss_home/Server/default/CONF/. (assume that you are the JBoss with the default configuration)
3. Configure the database connection driver
Put the downloaded mysql-connector-java-5.0.6-bin.jar in jboss_home/Server/default/lib /.
Suppose you are the default JBoss configuration)
4. Start/restart the JBoss Server
It should be possible to access the database.
(To be continued ....)