An in-depth analysis of design examples
Requirements:
This paper assumes that the reader is familiar with the EJB technology and has a certain understanding of SQL. Because EJB involves a lot of technology, although each time only tells a technology, but the various technology is related, therefore wants the reader to understand, because this is not very good organization.
Instance background
Database: SQL Server 2000
Operating system: Windows 2000
Development tools: JBuilder 7
EJB Server: WebLogic 7.0
Machine IP Address, 10.11.12.58
Example: through stateless session beans get the data of entity beans of container management, and then give the data of the stateless session beans to the JSP page, so that the customer can see the result. This process allows you to know how easy it is to write an EJB component.
Preparatory work
Configure the JDBC driver for SQL Server 2000 (Microsoft website is available for download, or it can be provided with Bea!). This example uses Microsoft JDBC), JBuilder 7 + WebLogic 7, and others.
Development process
1. To configure a JDBC data source: This process consists of two steps, first configuring the connection pool (Connection pools). (Why connection pooling: Developers do not want to write database code, replace the system becomes simple, limit the number of connections to the database, do not need to establish a new connection for each customer.) The concept of this pool appears in many places in Java EE, such as the EJB itself, with the following parameters:
Name:cacd
URL:JDBC:MICROSOFT:SQLSERVER://10.11.12.58:1433;USER=SA;PASSWORD=CACD;
Driver ClassName:com.microsoft.jdbc.sqlserver.SQLServerDriver
Initial Capacity:3
Maximum capacity:10
Second, the JDBC data source is configured with the following parameters configured in TX Data sources:
Name:cacd
JNDI NAME:CACD
Pool NAME:CACD (to match the front!) )
What is the difference between the Tx data Sources and the general data Sources? Read to the reader to think and discuss. )
Where, in the URL, you need to configure a username SA for SQL Server 2000, the password is CACD, because it uses type 4 JDBC, so you need to modify SQL Server 2000 's user authentication to: Nt+sql Server 2000 hybrid authentication.