1. download it from http://code.google.com/p/log4jdbc/
log4jdbc4-1.2beta2.jar: for JDBC 4 (JDK 1.6 and 1.7) Featured Jun 2010 62.2 KB 4647
log4jdbc3-1.2beta2.jar: for JDBC 3 (JDK 1.4 and 1.5) Featured Jun 2010 50.4 KB 2146
I uses log4jdbc4-1.2beta2.jar donwload it ot desktop.
2. add to your maven server:
http://localhost:8081/nexus/index.html#view-repositories log in as admin/admin123
click Repositories on the left menu.
then 3rd party --> then on the bottom right panel click "Artifact Upload":
GAV Definition: GAV Parameters.
Group: net.sf.log4jdbc
Artifact: log4jdbc4
version: 1.2beta2
Packaging: jar
Then click "Select Artifacct(s) to Upload... to find the jar file.
Click "Add Artifact" button
click "Upload Artifact(s)
The artifact is stored in the nexus now. to verify it: click "Brownse Storage" --> Refresh --> net.sf..... you find it.,
3. to use it in your project:
3.1 add the pom to your pom file:
<dependency>
<groupId>net.sf.log4jdbc</groupId>
<artifactId>log4jdbc4</artifactId>
<version>1.2beta2</version>
</dependency>
3.2 suppose that you have setup slf4j log system already.
3.3 Set your JDBC driver class to
net.sf.log4jdbc.DriverSpy
in your application's configuration
3.4 Prepend log4jdbc to the normal jdbc url that you are using.
For example, if your normal jdbc url is
original: jdbc:derby://localhost:1527//db-derby-10.2.2.0-bin/databases/MyDatabase
new jdbc:log4jdbc:derby://localhost:1527//db-derby-10.2.2.0-bin/databases/MyDatabase
then You would change it to:
jdbc:log4jdbc:derby://localhost:1527//db-derby-10.2.2.0-bin/databases/MyDatabase
to use log4jdbc.
Here is the example:
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="net.sf.log4jdbc.DriverSpy"/>
<property name="url" value="jdbc:log4jdbc:hsqldb:mem:test"/>
<property name="username" value="sa"/>
<property name="password" value=""/>
</bean>
Original one:
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="org.hsqldb.jdbcDriver"/>
<property name="url" value="jdbc:hsqldb:mem:test"/>
<property name="username" value="sa"/>
<property name="password" value=""/>
</bean>
// if you can do it like that, you can wrap it :
final Connection conn = ds().getConnection();
Connection connection = new net.sf.log4jdbc.ConnectionSpy(conn);
分享到:
相关推荐
How To Use REF Cursors in JDBC Program
How to use projector
How to use SFTP (with client validation - public key authentication) The topic How to use SFTP (with client validation - password authentication) discusses the simplest form of client ...
How to use CPU frequency scaling How to use CPU frequency scaling DVFS DVFM
How to Use Objects Code and Concepts Holger Gast
How to create branch and how to do the integration between the different branch in p4
as I have concerned the pack is about how to use vector
this article introduces how to use awk in linux
How to use the Bayes Net Toolbox? This documentation was last updated on 29 October 2007.
How To Use Adobe Photoshop CS2 <br>Photoshop CS2使用指南 <br>By Daniel Giordan, Doug Nelson <br>Publisher: Sams Publishing <br>Have you ever looked at your color pictures and wished ...
how to use eclipse Stephenie Meyer 3. Eclipse.pdf
DDR2使用指南英文版how to use ddr2,应用ddr2必备。
how to use Notes7, very detail user manual
How to use OpenCV step by step in VC, 介绍如何使用opencv
This program Demonstrates how to use LIKE operator in Jet SQL Query (uses DAO).
How to use epoll A complete example in C How to use epoll A complete example in C How to use epoll A complete example in C How to use epoll A complete example in C
The I2C-bus and how to use it (including specifications)
How to Use Objects Code and Concepts 英文无水印pdf pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请...
teaching material for how to use MS Access
教你怎么使用SDRAM,纯英文文档,讲解很详细,适合开发参考。