configure jdbcdslog for Jboss AS + MySQL

162 views
Skip to first unread message

Dmitry Egorov

unread,
Oct 5, 2010, 11:51:27 AM10/5/10
to jdbcdslog-discuss
Hi all!
Could anybody give me advice, how configure jdbcdslog to use with
Jboss AS 5 and datasource MySQL.
I see sample in wiki, but still can't help.

Andriy Kolyadenko

unread,
Oct 5, 2010, 12:06:28 PM10/5/10
to jdbcdslo...@googlegroups.com
Hi Dmitry,

could you describe problems you have(exceptions, errors, etc)?

Thanks.

Dmitry Egorov

unread,
Oct 5, 2010, 12:06:46 PM10/5/10
to jdbcdslo...@googlegroups.com
Hi Andriy,
   
No exception,  i could not make just first step, i don't know how to configure
my mysql-ds.xml or anything else?
  Please, give sample for jboss 5 + Mysql
Thanks.
P.S. Что мне подсказывает, что на русском мы быстрее поймем друг друга. Я прав Андрей?
 
2010/10/5 Andriy Kolyadenko <akoly...@gmail.com>

Andriy Kolyadenko

unread,
Oct 5, 2010, 2:37:56 PM10/5/10
to jdbcdslo...@googlegroups.com
Dmitry,

I will update wiki when will have a time, but could you try to use
following example? Thanks.

<local-tx-datasource>
<jndi-name>pr_data_source</jndi-name>

<connection-url>jdbc:mysql://localhost:3306/pr;targetDriver=com.mysql.jdbc.Driver</connection-url>
<driver-class>org.jdbcdslog.DriverLoggingProxy</driver-class>
<user-name>root</user-name>
<password>1</password>

<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
<metadata>
<type-mapping>mySQL</type-mapping>
</metadata>
</local-tx-datasource>

On Tue, 5 Oct 2010 20:06:46 +0400, Dmitry Egorov
<egorov.dm...@gmail.com> wrote:
> Hi Andriy,

Dmitry Egorov

unread,
Oct 6, 2010, 1:50:46 AM10/6/10
to jdbcdslo...@googlegroups.com
Thanks for advice, i will try today.
  Regards Dmitry  

2010/10/5 Andriy Kolyadenko <akoly...@gmail.com>

Dmitry Egorov

unread,
Oct 6, 2010, 3:55:57 AM10/6/10
to jdbcdslo...@googlegroups.com
Andriy, 

  It didn't work: 
[JBossManagedConnectionPool] Throwable while attempting to get a new connection: null
org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown database 'pr;targetdriver=com.mysql.jdbc.driver')
at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:225)
at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:195)
...

What i did:
1. Copy jdbcdslog-1.0.5.jar, slf4j-api-1.5.10.jar and slf4j-log4j12-1.5.10.jar to JBOSS_HOME/lib 
2. edit mysql-ds.xml
   ...
    <connection-url>jdbc:mysql://localhost:3306/pr;targetDriver=com.mysql.jdbc.Driver</connection-url>
    <driver-class>org.jdbcdslog.DriverLoggingProxy</driver-class>
   ...
3. add jdbcdslog category entry to log4j configuration file
JBoss 5.1, Windows XP

What missing?
Regards Dmitry.

2010/10/5 Andriy Kolyadenko <akoly...@gmail.com>

Andriy Kolyadenko

unread,
Oct 6, 2010, 12:12:40 PM10/6/10
to jdbcdslo...@googlegroups.com
Ok, I need some time to reproduce and investigate how to fix it. Thank you
for your feedback.

On Wed, 6 Oct 2010 11:55:57 +0400, Dmitry Egorov

Dmitry Egorov

unread,
Oct 6, 2010, 1:24:26 PM10/6/10
to jdbcdslo...@googlegroups.com
Thanks Andriy.
Look forward.
Dmitry. 

2010/10/6 Andriy Kolyadenko <akoly...@gmail.com>

Andriy Kolyadenko

unread,
Oct 7, 2010, 3:56:14 PM10/7/10
to jdbcdslo...@googlegroups.com, egorov.dm...@gmail.com
Dmitry,

could you try one more modification: could you try to use following
connection string in your datasource definition:
jdbc:jdbcdslog:mysql://localhost:3306/pr;targetDriver=com.mysql.jdbc.Driver

Thanks.

On Wed, 6 Oct 2010 21:24:26 +0400, Dmitry Egorov

Dmitry Egorov

unread,
Oct 8, 2010, 3:16:23 AM10/8/10
to jdbcdslo...@googlegroups.com
Hi, Andriy!
  It works, thanks!
 One remark, in my case (Windows XP, JBoss 5.1, MySQL, Java 1.6) lib files must copy to JBOSS_HOME/common/lib (not JBOSS_HOME/lib)

Full instruction for use on Windows XP/JBoss 5.1/MySQL:
jdbcdslog-1.0.5.zip and uzip; 
1. Copy jdbcdslog-1.0.5.jar, slf4j-api-1.5.10.jar (from path jdbcdslog-1.0.5\jdbcdslog\lib\slf4j\slf4j-api\1.5.10\) and slf4j-log4j12-1.5.10.jar (from path jdbcdslog-1.0.5\jdbcdslog\lib\slf4j\slf4j-log4j12\1.5.10\) to JBOSS_HOME/common/lib 
2. edit mysql-ds.xml
   <local-tx-datasource>
    <jndi-name>pr_data_source</jndi-name>
        <!-- without SQL logging
    <connection-url>jdbc:mysql://localhost:3306/pr</connection-url>
    <driver-class>com.mysql.jdbc.Driver</driver-class>
           -->

        <!--  SQL logging -->
    <connection-url>jdbc:jdbcdslog:mysql://localhost:3306/pr;targetDriver=com.mysql.jdbc.Driver</connection-url>
    <driver-class>org.jdbcdslog.DriverLoggingProxy</driver-class>
    <user-name>login</user-name>
    <password>password</password>
    <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
    <metadata>
       <type-mapping>mySQL</type-mapping>
    </metadata>
  </local-tx-datasource>

3. Edit file JBOSS_HOME\server\default\conf\jboss-log4j.xml 
  add entry 
   <!-- Limit JDBS logger   -->
   <category name="org.jdbcdslog">
    <priority value="INFO"/>
   </category>   
Thats all.
Thanks to Andriy ahother time!
Regards Dmitry.
    

2010/10/7 Andriy Kolyadenko <akoly...@gmail.com>
Reply all
Reply to author
Forward
0 new messages