Category: Java

JDBC and Oracle Database Change Notification

Below is a simple example of a cutdown example of using DCN in Oracle with JDBC. I plan on presenting this to our developers as an alternative to the ATG InventoryCache manager module. import java.sql.*; import java.util.*; import oracle.jdbc.*; import…

Finding java thread consuming CPU

Periodically, we will have an application server go to 100% CPU utilization on a single java process. Below is the methodology I use to troubleshoot a high CPU thread consumer in java. 1. As the user running the Java Virtual…

Print thread dump for a single thread

We had an issue where a single thread was using all the CPU. We wanted to check it at the command line while troubleshooting. We used what is below… [atg@CMHLDECOMAP01 ~]$ jstack 3000 | awk ‘{if ($1 == “\”Thread-9\””) {i…

Query SQL Server stored procedure text with JDBC

I needed to quickly print the text associated with several stored procedures across multiple database servers to individual files. I used what is below. import java.sql.*; import com.microsoft.sqlserver.jdbc.*; import java.io.*; public class sqlProcedures { public static void main(String[] args) {…

Multiple threads using same physical connection

This just doesn’t sound good. Having multiple threads use the same physical connection sounds like an exercise in frustration. Although the OracleDataSource connection object is thread safe, there is really no need to create a smaller number of connections than…