Tuesday, September 7, 2010

Oracle Documentation

Oracle Documentations can be found in the below link

http://www.oracle.com/technetwork/indexes/documentation/index.html

Application Development Document libraries can be found here

http://www.oracle.com/pls/db102/portal.portal_db?selected=5

Saturday, February 28, 2009

What is a Servlet and a Servlet Container ?


A servlet is a Java programming language class used to dynamically process client requests and provide responses.

The javax.servlet and javax.servlet.http packages provide the interfaces and classes used to write Java Servlets. Servlet Life-Cycle methods are defined in the Servlet interface.

Servlets are controlled by the Container.

The container's role in s servlet's life

1.Communication Support
Provides a way for the servlets to talk with the Web Server.

2.Lifecycle Management
Controls the life and death of servlets. Please refer the diagram below.

The container creates a HttpServletResponse and HttpServletRequest object when a user clicks on a link to a servlet. A new thread is created for each request and these two objects are passed to the servlet's service method. The servlet figures out which method to call (doGet or doPost) based on the HTTP method sent by the client. The Response is written by the response object and it goes through the container.The service method completes and the thread dies or goes to a container managed thread pool. The objects go out of scope and will be collected by the garbage collector. The client will get the response.

3.Multithreaded Support.
A new thread is created for each servlet request.

4.Declarative Security
You can use the XML Deployment descriptor to configure security settings.

5.JSP Support
Translates JSPs to Java


Web Servers , Web Containers & Application Servers



Web Servers


Web Servers accept http requests from the clients and serve them with http responses.
A web application runs within the web container of a web server.

Eg: Apache

Web Containers

Web Containers provide an environment to run Servlets and JSPs. It implements the web component contract of the J2EE architecture which specifies a runtime environment for web components that includes security, concurrency, life-cycle management, transaction, deployment, and other services.

At the beginning tomcat was just a servlet container and was not able to handle web requests on its own. It was also much slower and was not able to support heavy traffic production environments and it did not support SSL. As a result it was used in conjunction with the Apache web server to gain higher performance and security.

Over time Tomcat was improved as a standalone web server and running it alone was faster or just as fast as running it in conjunction with Apache Web Server.The current tomcat also has full support for SSL.


Eg: Tomcat

Application Servers

Application Servers provide a J2EE platform for the development, deployment, and management of enterprise applications. It provides an applet container, a Web container, and an EJB container.

Eg: JBOSS , Websphere

Sunday, February 22, 2009

List of JDBC Drivers

IBM DB2
jdbc:db2://HOST:PORT/DB
COM.ibm.db2.jdbc.app.DB2Driver

JDBC-ODBC Bridge
jdbc:odbc:DB
sun.jdbc.odbc.JdbcOdbcDriver

Microsoft SQL Server
jdbc:weblogic:mssqlserver4:DB@HOST:PORT
weblogic.jdbc.mssqlserver4.Driver

Oracle Thin
jdbc:oracle:thin:@HOST:PORT:SID
oracle.jdbc.driver.OracleDriver

PointBase Embedded Server
jdbc:pointbase://embedded[:PORT]/DB
com.pointbase.jdbc.jdbcUniversalDriver

Cloudscape
jdbc:cloudscape:DB
COM.cloudscape.core.JDBCDriver

Cloudscape RMI
jdbc:rmi://HOST:PORT/jdbc:cloudscape:DB
RmiJdbc.RJDriver

Firebird (JCA/JDBC Driver)
jdbc:firebirdsql:[//HOST[:PORT]/]DB
org.firebirdsql.jdbc.FBDriver

IDS Server
jdbc:ids://HOST:PORT/conn?dsn='ODBC_DSN_NAME'
ids.sql.IDSDriver

Informix Dynamic Server
jdbc:informix-sqli://HOST:PORT/DB:INFORMIXSERVER=SERVER_NAME
com.informix.jdbc.IfxDriver

InstantDB (v3.13 and earlier)
jdbc:idb:DB
jdbc.idbDriver

InstantDB (v3.14 and later)
jdbc:idb:DB
org.enhydra.instantdb.jdbc.idbDriver

Interbase (InterClient Driver)
jdbc:interbase://HOST/DB
interbase.interclient.Driver

Hypersonic SQL (v1.2 and earlier)
jdbc:HypersonicSQL:DB
hSql.hDriver

Hypersonic SQL (v1.3 and later)
jdbc:HypersonicSQL:DB
org.hsql.jdbcDriver

Microsoft SQL Server (JTurbo Driver)
jdbc:JTurbo://HOST:PORT/DB
com.ashna.jturbo.driver.Driver

Microsoft SQL Server (Sprinta Driver)
jdbc:inetdae:HOST:PORT?database=DB
com.inet.tds.TdsDriver

Microsoft SQL Server 2000 (Microsoft Driver)
jdbc:microsoft:sqlserver://HOST:PORT[;DatabaseName=DB]
com.microsoft.sqlserver.jdbc.SQLServerDriver

MySQL (MM.MySQL Driver)
jdbc:mysql://HOST:PORT/DB
org.gjt.mm.mysql.Driver

Oracle OCI 8i
jdbc:oracle:oci8:@SID
oracle.jdbc.driver.OracleDriver

Oracle OCI 9i
jdbc:oracle:oci:@SID
oracle.jdbc.driver.OracleDriver

PostgreSQL (v6.5 and earlier)
jdbc:postgresql://HOST:PORT/DB
postgresql.Driver

PostgreSQL (v7.0 and later)
jdbc:postgresql://HOST:PORT/DB
org.postgresql.Driver

Sybase (jConnect 4.2 and earlier)
jdbc:sybase:Tds:HOST:PORT
com.sybase.jdbc.SybDriver

Sybase (jConnect 5.2)
jdbc:sybase:Tds:HOST:PORT
com.sybase.jdbc2.jdbc.SybDriver

JDBC Drivers

The Java Database Connectivity (JDBC) is an application programming interface (API) that provides database independent connectivity between java applications and a wide range of databases that supports SQL, spreadsheets and flat files.

More details on this API can be found here.

The JDBC API uses JDBC Drivers to connect to databases. There are four types of drivers.

Type 1: JDBC-ODBC Bridge

This type of drivers are used when the database doesn't have a pure Java driver for connectivity. The bridge will translate the JDBC calls into ODBC (Open Database Connectivity) calls. This method is platform dependent as ODBC is a Microsoft Windows interface to SQL.

Pros:
  • Allows access to any database which has the ODBC driver installed.
Cons:
  • Degrades the performance as the JDBC calls goes through the bridge to the ODBC driver and then through the native database connectivity interface. The results comes back through the reverse process
  • The ODBC driver and the native database connectivity interface has to be installed on the client machine.
  • Cannot be used for web based applications as client side software is needed.
Eg: JDBC-ODBC Bridge by Sun

Type 2: Native-API/partly Java driver

This type of drivers communicates directly with the databases i.e they will convert the JDBC method calls into native calls for the database APIs. It is platform dependent as the native code has to be installed on the client machines.The driver is not written entirely in java as it communicates with the native code.

Pros:
  • Better Performance than type 1 drivers.
Cons:
  • Lower performance than type 3 and 4 drivers.
  • The native code (the vendor client library) has to be installed on the client side.
  • Cannot be used for web based applications as client side software is needed.
Eg: DB2 JDBC Type 2 Driver

Type 3: Net-protocol/all-Java driver

This type of drivers are written entirely in Java. The drivers follow a 3-tier architecture approach when connecting to a database. The JDBC calls are sent to the middleware server which directly or indirectly ( depending on the drivers used.) translates the JDBC requests to database specific calls through the native database connectivity interface. These drivers are platform independent.

Pros:
  • Vendor database libraries do not have to be present on client machines.
  • The middle ware server can provide middle ware services like caching (Query Results, Connections etc), Load balancing , System administration features such as logging and auditing.
Cons:
  • Database specific coding has to be done in the middle tier.
  • The Middle ware Server layer might result in a time bottle neck.
Eg: IDS Driver by IDS Software

Type 4: Native-protocol/all-Java driver

This type of drivers convert JDBC calls directly into the vendor-specific database protocols. The drivers are written purely in Java and is installed inside the JVM. As a result these drivers are platform independent.

Pros:
  • Provides better performance as there is no need for translating JDBC requests to intermediary forms or a middle ware server to service the requests.
  • Provides easier debugging as all aspects of the application to the database connection can be managed within the JVM.
Cons:
  • A seperate driver is needed for each database.
Eg: Oracle thin driver