Posts

Showing posts from April 24, 2016

Netbeans Issues with tableChanged event for JTable

Image
I've struggled most of the day today to get the tableChanged() event to fire for a JTable I created to link to a database table, and wanted to share my solution.

As the linked video shows, after creating a custom listener that implements TableModelListener, and adding the listener to the table model object, the listener refused to fire.

Long story short, the answer turned out to be that I had failed to provide a name for the Default elements binding object. (See screenshot immediately below)

























Here is a video of me demonstrating this phenomenon more thoroughly. I hope you find it instructive.



SQL Server: T-SQL JOB to kill sessions with long-running transactions

We have a situation in a build/test server in which the application server (jboss, in this case) is unceremoniously killed by the build process.
This is leaving us with transactions that are not committed, nor are they rolled back. I like to call these zombies. SQL Server thinks they're just happily executing.

Because SQL Server has no server side lock, transaction, or query timeout, I developed this job to simulate a 10 minute transaction timeout.

It's not sophisticated, but it will give you a good starting point in case you should have to create your own .

if not exists (select * from sys.schemas where name = 'LOGSCHEMA')
EXEC ('CREATE SCHEMA [LOGSCHEMA] AUTHORIZATION [dbo]')
GO
if exists (select * from sys.tables where name = '#OLD_SPIDS')
EXEC ('DROP TABLE #OLD_SPIDS')
GO  /* NOTE: In the following, I fully qualified the Kill_Long_Running_tran_log table as dbname.schema.tablename. DB_NAME will need to be changed */
if not exists (select * from s…