For configuring a datasource, you just need a *-ds.xml file which needs to be placed in the server/< serverName>/deploy folder. For more details about how to configure a datasource, have a look at http://wiki.jboss.org/wiki/Wiki.jsp?page=ConfigDataSources. That wiki article also has specific examples for different databases. Once you have successfully deployed the datasource, in order to use this datasource, you will have to do a JNDI lookup in your code as follows:
Context ctx = new InitialContext(); Datasource ds = (Datasource) ctx.lookup("java:/TheJNDINameThatYouSpecifiedForYourDatasource");
calling that data source from a stand alone program.
Have a look at http://wiki.jboss.org/wiki/Wiki.jsp?page=HowCanIAccessADataSourceFromAClient