Tuesday, February 3, 2015

SLF4J DBSPY TEST CODE

Required Libs

log4j-1.2.16.jar
log4jdbc4-1.2.jar
log4j-over-slf4j-1.7.5.jar
slf4j-api.jar
slf4j-jdk14.jar
slf4j-log4j12-1.7.5.jar

slf4j-simple-1.7.5.jar

Code

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;

public class SpyEngine {

public static void main(String[] rk) {

try {

  Class.forName("net.sf.log4jdbc.DriverSpy");
Connection conn = DriverManager.getConnection( "jdbc:log4jdbc:oracle:thin:@192.168.8.87:1521:aaadb", "username", "password");

PreparedStatement prStmt = conn.prepareStatement("select * from tablename");
prStmt.execute();
prStmt.close();

  conn.close();
 
} catch (Exception e) {
System.out.println("Error: " + e);

}

}

Keep Visiting..
Write your comment..


No comments:

Post a Comment

Scrum and Scrum master

Scrum  Scrum is a framework which helps a team to work together.  It is like a rugby team (the scrum name comes from rugby game). Scrum enco...