Adsense

Tuesday, October 28, 2014

Solution for DB2 transaction log for the database is full. SQLSTATE=57011 .

Before go to the solution, Please go through the post to understand the LOGFILSIZ parameter and how to change the log file size. In DB2 ,Some times you may get the following error,when any transaction like Insert, Update or Delete occurs on a database. DB21034E The command was processed as an SQL statement because it was not a valid Command Line Processor command. During SQL processing it returned: SQL0964C The transaction log for the database is full. SQLSTATE=57011. The above error may be caused due to the database log file is not...

Create Database in DB2 with Unicode (UTF-8) support - Command

By default, in DB2, databases are created in the code page of the application which creates them. In windows, Simply create a database with the following command db2 create db employee             - where employee is the database name. By default employee database is created with the code page 1252 where as code page 1208 will have utf-8 support. You can see the codeset of a database by giving the following command. In Windows :  db2 get db cfg for employee | find "code" In Linux :   db2 get db cfg...

Tuesday, October 21, 2014

Db2 Jars and Class Path set to connect db2 database using java code with JDBC driver.

If your are using DB2 database in your java application, it is always required to write code for connecting DB2 database. Db2 Database can be connected by either using connection pool or  using JDBC. The following example java code is for connecting and accessing DB2 database using JDBC. It loads the DB2 JDBC Driver using Class.forName  and connects to the DB2 database Employee and prints the records of the table Department....

Saturday, October 18, 2014

How to read images from BLOB field in db2 database table using java code.

     Tn this tutorial, we are going to see how to read Blob images stored in a db2 database table using java code. Let us assume that large objects like images or audio file (eg. Employee photos or Mp3 file) are stored in a db2 database table using BLOB fields. For storing images in db2 table, you can visit Store Images in BLOB. The images or audio files are stored as bytes in DB2. Db2 table stores only descriptor (locator...

Thursday, October 16, 2014

Execute query using PreparedStatement in DB2 with example code in java

       Some times you may need to execute the same SQL statement many times with different parameters (input values). In this situation the best option is to use a PreparedStatement object. PreparedStatement in java is an interface that define the methods and properties that enable you to send SQL statements and receive data from database server. JDBC Drivers developed by database vendors provide classes that implement the PreparedStatement interface. Without a driver you cannot create objects on this interface.   ...

Storing Images with BLOB in db2 , How to insert Large Objects (audio , photo, etc) in db2 using java

           Do you need to store Large data objects such as Images (jpg, jpeg, gif , bmp , etc ..) and audios (MP3, etc..) in db2 database. DB2 provides specialized data types called LOBs (Large Objects) for storing large data objects. For storing large text, CLOB data type is used. For storing binary data ( photo images, audio songs), you can use BLOB type.           BLOB is Binary Large Object which can store binary data and the default size for BLOB is 1 mb. It can contain up to 2 gigabytes...