Topic : DB SPY
log4jdbc SPY should be use for DB related issue Tracking/Logs
Advantage
It is useful to SPY / DEBUG database related issue tracking. It generates all kind of user
required logs
Libs Required
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"
ojdbc6-11.0.2.0.jar"
Example
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:rajdb", "rajusername", "rajpassword");
PreparedStatement prStmt = conn.prepareStatement("select * from tbdata");
prStmt.execute();
prStmt.close();
conn.close();
} catch (Exception e) {
System.out.println("Error: " + e);
}
}
}
log4jdbc SPY should be use for DB related issue Tracking/Logs
Advantage
It is useful to SPY / DEBUG database related issue tracking. It generates all kind of user
required logs
Libs Required
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"
ojdbc6-11.0.2.0.jar"
Example
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:rajdb", "rajusername", "rajpassword");
PreparedStatement prStmt = conn.prepareStatement("select * from tbdata");
prStmt.execute();
prStmt.close();
conn.close();
} catch (Exception e) {
System.out.println("Error: " + e);
}
}
}
No comments:
Post a Comment