Data Access Technologies in Java
Database access has been part of Java since Sun Microsystems added the JDBC API as an addon to Java 1.0. Since then, Sun has also added Enterprise JavaBeans (EJBs) and most recently Java Data Objects (JDO) to Java. That isnâ€™t all; Sun is only one of the many organizations supporting database access from Java. Numerous vendors have sprung up over the years to provide JDBC implementations and Object-Relational Mapping (O/R) frameworks for Java.
There are a lot of choices for data access in JSP. In this tutorial, weâ€™ll sort out the choices by dividing them into five categories starting with the simplest and ending with the most sophisticated. The five data access technologies, from simplest to most sophisticated, are as follows:
â€¢ JSP tags for SQL
â€¢ O/R frameworks
â€¢ EJB entity beans
When you choose a data access technology, you should consider both the nature of the web application that youâ€™re developing and the skills of your development and support teams. Generally speaking, if you have simple requirements and a less experienced team, you should favor the simple end of the spectrum. If you have more complex requirements and a more experienced team, you should favor the sophisticated side. Here are some questions to consider:
Does your application have fairly simple database access requirements? Perhaps you need only to display a couple of reports based on information in a database. For simple applications, you might want to avoid the learning curve, complexity, and overhead of a more sophisticated data access technology.
Will your application have a complex Java object model that must be persisted to a database? If so, you might find that you really cannot do without the sophisticated automated object-relational mapping capabilities of an O/R framework or of EJB container-managed persistence (CMP).
Is your application one that is highly transactional, requires high availability, and is likely to support a large number of concurrent users? If so, you might need the declarative transaction support, fault tolerance, and load balancing provided by EJB servers.
Which Java data access technologies do your developers know? What level of database knowledge do your developers have? Will you need training? If your team has previous experience with database access, that might influence your selection of a database access technology.
Comment on this tutorial
- Data Science
- Cloud Computing
- Java Beans
- Mac OS X
- Office 365
- Tech Reviews
TEXT datatype SPLIT in MSSQL - to solve the 8000 limit set by varchar
What is Referential Integrity in databases?
Handling CSV in Stored Procedures
java.lang.NoClassDefFoundError and java.lang.NoSuchMethodError
Calling a Stored Procedure from JDBC in Java
setSavepoint and releaseSavepoint Example in Java
PreparedStatement Example in Java
Creating Database Tables Using ANT
Using the DriverManager Class vs Using a DataSource Object for a connection
Stored Procedures example in SQL
Result Sets, Cursors and Transactions in SQL