You should prepare a "data source configuration" deployment file.
Those files are deploying by dropping them in the "deploy" directory of your running AppServer as usual. As far as I know They must end with "-ds" suffix. For example:
For MySQL, a practical example can be:
<?xml version="1.0" encoding="UTF-8"?> <!-- ========================================== --> <!-- --> <!-- JBoss Server Configuration --> <!-- --> <!-- ========================================== --> <!-- ========================================== --> <!-- Datasource config for MySQL --> <!-- ========================================== --> <datasources> <local-tx-datasource> <jndi-name>MyAppMySQLConnection</jndi-name> <connection-url>jdbc:mysql://localhost/mysqldatabase</connection-url> <driver-class>org.gjt.mm.mysql.Driver</driver-class> <user-name>mysqluser</user-name> <blocking-timeout-millis>500</blocking-timeout-millis> <password>mysqlpassword</password> </local-tx-datasource> </datasources>
Don't forget to place MySQL JDBC driver in server's lib directory before you even start JBOSS.
Hope this help.
I have copied this fie into the deploy directory, but when I try to connect I get the following error:
no ClassLoaders found for com.mysql.jdb.Driver
Any idea what can be wrong?
with version of the mysql jdbc driver do you use ?
Have you place it in the /server/default(or?)/lib/ directory ?
I think that in your "com.mysql.jdb.Driver" a 'c' is missing in the .jdb.
ops, of course you are right. Thats just a typo in the post. Sorry about that. I think it is version 3.1.
Re your sure that com.mysql.jdbc.Driver is driver class for MySQL JDBC's implementation?
As fbiaggi stated, make sure that driver's jar is in:
$JBOSS_HOME/server/default/lib directory "before" you start JBOSS.
Hope this helps.
thanks for all the help
I have tried a new driver, and I think I got a little bit closer.
The error I get now is:
Could not create connection
Communication exception during handshake
Can you post your "-ds.xml" file?
this seem to be an authorisation or connection problem.
Are you using a local or remote instance of mysql ?
To test it edit the user table in the mysql database (ex. with mysql query browser),
open a new user with an empty host/userid/password and give Y to all privililedges.
Restart mysql and retry, if now works you have found the problem.
pay attention that your mysql is now open to all users on any system with all auth.