Thi is a example with datasource with oracle
//Server
package datasource;
import java.sql.*;
import javax.sql.*;
import oracle.jdbc.pool.OracleDataSource;
import javax.naming.*;
import java.util.*;
/**
* A class to create a DataSource and bind it to a directory.
*/
public class DataSourceSer
Datasource has properties which need to be altered for different containers
(container specific for physical connections in most of the cases), where
our datasource instance will be registered through JNDI API. There are
various ways for setting the datasource in Tomcat or WebSphere for that