Monday, February 19, 2007

OC4J Connection Pooling and non-Oracle databases

In my last entry I blogged about using MySql database with OC4J. I provided an example of native datasource that connects to the MySql database. Native data sources do not use connection pooling capabilities of OC4J. If you want use OC4J connection pooling with third-party databases you have to use a managed data source.

Here is an example managed data source for MySql database.


<connection-pool name="test Connection Pool">
factory-class="com.mysql.jdbc.jdbc2.optional.MysqlDataSource"

user="user1"
password="user1"
url="jdbc:mysql://144.25.134.24/Test">
</CONNECTION-FACTORY>
</CONNECTION-POOL>

<managed-data-source>
connection-pool-name="test Connection Pool"
jndi-name="jdbc/mysql"
name="mysql"/>


You have to make sure that the factory-class in the connection-factory tag points to the DataSource class for your your database.



Wednesday, February 14, 2007

Using MySQL with OC4J 10.1.3.x

When you have OracleXE available for free you would probably not use MySQL, but you may have a valid requirement to use MySQL with OC4J 10.1.3.

1. Upload JDBC Driver You have to make JDBC drivers (e.g. mysql-connector-java-3.0.11-stable-bin.jar) for your database available to Oracle Application Server. You have to copy those to %ORACLE_HOME%/j2ee/home/applib directory.

2. Create a Native DataSource

You can use the ASC to create a native data source as follows:


jndi-name="jdbc/MyDS"
description="Native DataSource" data-source-class="com.mysql.jdbc.jdbc2.optional.MysqlDataSource"
user="user"
password="password"
url="jdbc:mysql://localhost:3306/mydatabase">


Now you should be able to access the DataSource connecting to MySQL database with a JNDI location "jdbc/MyDS".

Wednesday, February 07, 2007

EJB 3 In Action Book Update

Here is an update for book EJB 3 In Action. We are done writing and editing and going thru final round of proof reading before getting published. The book will be published next month. The eBook will be available first week of March and print book will be available Mar 15.

You can purchase and read the final draft of the book using Manning's MEAP program or pre-order from Amazon .

If you have any questions about the book or found any technical errors please report to the Author forum

Here is Table of contents of the book:


1. What's what in EJB
2. A First taste of EJB
3. Building Business Logic with Session beans
4. Messaging and Developing Message Driven Beans
5. Learning Advanced EJB Concepts
6. Transactions and Security
7. Implementing Domain Models with EJB 3
8. Object-Relationship Mapping using EJB 3 JPA
9. Manipulating entities with EntityManager API
10. Using the Query API and the Java Persistence Query Language
11. Packaging EJB 3 Applications
12. Effectively Integrating EJB 3 across Your Application Tiers
13. Taming Wild EJBs: Performance and Scalability
14. Migrating to EJB 3
15. Exposing EJBs as Web Services
16. EJB 3 and Spring

Appendix A. RMI and JNDI
Appendix B. Reviewing relational databases
Appendix C. Annotations reference
Appendix D. Deployment descriptors reference
Appendix E. Installing and configuring the Java EE 5 SDK