[jboss-user] [Datasource Configuration] - Connection problem to mySQL database

sebastien ferrand do-not-reply at jboss.com
Thu Mar 25 05:38:49 EDT 2010


sebastien ferrand [http://community.jboss.org/people/microbe] created the discussion

"Connection problem to mySQL database"

To view the discussion, visit: http://community.jboss.org/message/533898#533898

--------------------------------------------------------------
Hi everyone,

Like you all, i'm using JBoss and i'm trying to connect it to a database, which is mySQL.

So I'm using JDBC to set a connection, like I did with a local application, but it doesn't work, even if i've done all requiered configurations.

The problem come from the connection, which is established by this line :

         con = DriverManager.getConnection("databaseName", "user", "password");

==> con is null when i run the portlet

Because I succed in getting a connection with a local app, I think the problem come from the configuration of JBoss because this time, It's J2EE.

So here are exact steps I followed :

- Putting mysql-connector-java-5.1.12-bin.jar in /home/myName/Bureau/jboss-portal-2.7.2/server/default/lib
- Moving mysql-ds.xml from I don't remember where to /home/myName/Bureau/jboss-portal-2.7.2/server/default/deploy
- Overwritted mysql-ds.xml with :

<?xml version="1.0" encoding="UTF-8"?

<datasources>
  <local-tx-datasource>
    <jndi-name>MySQLDB</jndi-name>
    <connection-url>jdbc:mysql://localhost/databaseName</connection-url>
    <driver-class>com.mysql.jdbc.Driver</driver-class>
    <user-name>user</user-name>
    <password>password</password>
    
    <min-pool-size>5</min-pool-size>
    <max-pool-size>20</max-pool-size>

    <idle-timeout-minutes>5</idle-timeout-minutes>

    <exception-sorter-class-name>com.mysql.jdbc.integration.jboss.ExtendedMysqlExceptionSorter</exception-sorter-class-name>
    <valid-connection-checker-class-name>com.mysql.jdbc.integration.jboss.MysqlValidConnectionChecker</valid-connection-checker-class-name>


  </local-tx-datasource>
</datasources>

That's all i've done, maybe should I say that I use the plugin JBoss tools in eclipse.

Thank you for your future help.

--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/533898#533898]

Start a new discussion in Datasource Configuration at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2077]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100325/d5f4600d/attachment.html 


More information about the jboss-user mailing list