Connection from datasource configured in WAS server via standalone client
1. In your standalone client
Context initialContext=null ;
Properties properties=new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory");
properties.put(Context.PROVIDER_URL,"iiop://machineip:portnumber");
initialContext=new InitialContext(properties);
DataSource datasource = (DataSource)initialContext.lookup("DataSourceName");
connection=datasource.getConnection("username","password");
2. Add following jars
a. j2cImpl.jar
b.naming.jar
c.naminngclient.jar
d.ojbdc14.jar
If you are not passing username and password to the getConnection method you will get a exception