How to connect to Mysql datasource defined in Wildfly 8

I managed to add a JDBC datasource for Mysql in Wildfly 8, but how can I connect to it from a standalone client using the standard Java SE JNDI API? according to this page of Wildfly developer guide in section Standard Java SE JNDI API, Im trying to put this line to get connection:

 DataSource ds=(DataSource) ic.lookup("java:global/test");
 Connection con = ds.getConnection();

is this the right procedure?
Im getting: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial

Thanks in advance, and forgive if it sound stupid, Im really new to wildfly and the whole JNDI API.


Download how.to.connect.to.mysql.datasource.defined.in.wildfly.8.zip
Direct Link


Download


Download how.to.connect.to.mysql.datasource.defined.in.wildfly.8.zip
Mediafire


Download


Download how.to.connect.to.mysql.datasource.defined.in.wildfly.8.zip
Fileparadox


Download

Both comments and pings are currently closed.

Comments are closed.