-
1. Re: connecting to mysql
pablojavierpy Feb 15, 2005 6:42 AM (in response to teddyert)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:
myapp-ds.xml
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. -
2. Re: connecting to mysql
teddyert Feb 15, 2005 7:41 AM (in response to teddyert)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? -
3. Re: connecting to mysql
fbiaggi Feb 15, 2005 12:36 PM (in response to teddyert)Hi,
with version of the mysql jdbc driver do you use ?
Have you place it in the /server/default(or?)/lib/ directory ?
Ev. try:
<driver-class>com.mysql.jdbc.Driver</driver-class> -
4. Re: connecting to mysql
fbiaggi Feb 15, 2005 12:39 PM (in response to teddyert)Hi again,
I think that in your "com.mysql.jdb.Driver" a 'c' is missing in the .jdb. -
5. Re: connecting to mysql
teddyert Feb 15, 2005 3:04 PM (in response to teddyert)ops, of course you are right. Thats just a typo in the post. Sorry about that. I think it is version 3.1.
-
6. Re: connecting to mysql
pablojavierpy Feb 16, 2005 5:29 AM (in response to teddyert)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. -
7. Re: connecting to mysql
teddyert Feb 16, 2005 7:56 AM (in response to teddyert)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 -
8. Re: connecting to mysql
pablojavierpy Feb 16, 2005 9:51 AM (in response to teddyert)Can you post your "-ds.xml" file?
-
9. Re: connecting to mysql
fbiaggi Feb 16, 2005 1:28 PM (in response to teddyert)Hi,
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. -
10. Re: connecting to mysql
teddyert Feb 17, 2005 2:32 AM (in response to teddyert)It worked!
Thank you -
11. Re: connecting to mysql
fbiaggi Feb 18, 2005 12:25 PM (in response to teddyert)Good,
pay attention that your mysql is now open to all users on any system with all auth.