Enable JDBC logging
import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; public class Main { public static void main(String args[]) throws Exception { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); String URL = "jdbc:odbc:dbName"; Connection dbConn = DriverManager.getConnection(URL, "user", "pass"); PrintWriter w = new PrintWriter(new OutputStreamWriter(System.out)); DriverManager.setLogWriter(w); dbConn.close(); PreparedStatement prepstmt; prepstmt = dbConn.prepareStatement("SELECT id FROM employee"); prepstmt.execute(); prepstmt.close(); dbConn.close(); } }