Did you put the MySQL JDBC driver JAR in JBOSS_HOME/server/default/lib or whatever is appropriate for your run-time instance - normally default is the run-time instance unless you override the bootstrap with an option for run.sh.
Yes. I put mysql-java-connector-java-3.0.9-stable.bin.jar in JBOSS_HOME/server/default/lib
My bad. I've misinterpreted what you are trying to achieve.
I assume that code fragment is what you are using to try and connect? Should that be the case, it won't work because the DataSource is the containing object for connections.
In order to use the connection pool declared, you need to lookup the datasource and then use the connection issued from the datasource. You can only access the DataSource by performing a JNDI lookup from within the JVM that JBoss is running.
DataSource ds = (new InitialContext()).lookup("java:/DefaultDS"); Connection connection = ds.getConnection(); // get connection from datasource (connection pool) ... connection.close(); // release connection back to pool
Hope that helps.
A slight mistake in the first line. The lookup returns an object which you should cast as a DataSource.