Category Archives: Databases

Microsoft SQL Server: Database Replication (Mirroring)

By | October 25, 2017

Microsoft SQL Server Standard Edition has a great feature present in this basic license: Database Replication in Synchronous mode. To activate the database replication of a database from Primary Site (PR) to Disaster Recovery Site (DR) where the database to be replicated is called myDB the following simple steps must be performed: On PR site… Read More »

Microsoft SQL Server: Snapshot isolation

By | February 9, 2017

Snapshot isolation is a guarantee that all reads made in a transaction will see a consistent snapshot of the database. The transaction itself will successfully commit only if no updates it has made, conflicts with any concurrent updates made since that snapshot. By using it, deadlock situations when a read operation (intense resource consuming operation)… Read More »

DB2 SQL Error: SQLCODE=-302, SQLSTATE=22001, SQLERRMC=null

By | February 21, 2019

This error is the DB2 cryptic way of informing you that a value which an insert query tries to insert in a table is too large. Usually when using java + hibernate we can define a member of an EJB as: @Column(length = 10) protected String receiver; If somehow when the object is created we… Read More »

DB2 + Websphere : Feature is not implemented: PreparedStatement.setBinaryStream

By | February 8, 2017

From a very strange reason after updating the hibernate4 from version 4.1.4 to 4.2.5 there was suddenly a weird behaviour of the EJB3.1 enterprise application I am working on. A piece of code that commits to the database an object (ProcessingStatus) containing a BLOB was throwing the following: [1/31/16 23:37:15:922 EET] 000000eb AbstractBatch Z org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl… Read More »

Hibernate+DB2 : Adding new primitive data type member to an entity issue

By | February 8, 2017

This is an annoying issues of hibernate with DB2. Trying to add a new primitive type to an already existing entity will result in an error when updating the associated database table. As a result no update of the schema is done. Why is that ? When adding to an entity a new primitive type… Read More »

Oracle: Get the real size of a table with blobs

By | February 8, 2017

As we now in case of a table with BLOBs in the actual table row only a reference to the BLOB is stored. In order to get the real table size of my table ‘MY_BLOB_TABLE’ including the refereed BLOBs the following query holds in Oracle: SELECT sum( bytes)/1024/1024 size_in_MB FROM user_segments WHERE (segment_name = ‘MY_BLOB_TABLE’… Read More »

Oracle: Resolve blocking processes

By | February 8, 2017

Sometimes an oracle query goes nuts and blocks the DB. To find the blocked processes started by user MYUSER execute: SELECT s.inst_id, s.sid, s.serial#, p.spid, s.username, s.program FROM gv$session s JOIN gv$process p ON p.addr = s.paddr AND p.inst_id = s.inst_id where s.username like ‘MYUSER’; To kill the blocking process: ALTER SYSTEM KILL SESSION ‘sid,serial#’

DB2: Inline LOBS

By | February 8, 2017

LOBS is the DB2 way of dealing with big data. In db2 you can have a table that contains a column defined as LOB where one can dump large binary data (images, compressed text files, video or audio). The problem is the way this LOBS are stored by DB2. By default they are stored “offline”… Read More »

DB2: Limit an UPDATE/DELETE query in DB2

By | February 8, 2017

There are times when a simple UPDATE or DELETE cannot be used directly on the database due to the huge amount of data stored in the table. We already covered the topic of increasing the transaction log, see post, but sometimes this is not enough. In the cases when too much data is going to… Read More »

DB2: (SQL Error: -30090) caused by XA access to a nickname to a federated database

By | February 8, 2017

In a setup having an enterprise application depending on a database instance where some tables are defined as nicknames to tables from a federated database, it can happen to get this very cryptic DB2 error. [12/10/15 18:06:54:895 IST] 00000073 SqlExceptionH Z org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions SQL Error: -4229, SQLState: null [12/10/15 18:06:54:903 IST] 00000073 SqlExceptionH Z org.hibernate.engine.jdbc.spi.SqlExceptionHelper… Read More »