Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2003
    Posts
    9

    Exclamation Unanswered: Java program not able to insert in table in transactional database

    Hi,

    I am having problems while trying to insert values inside a table when the database has transactional logging enabled.

    I created the database thus:
    "create database dbname with log mode ansi"

    Next I created a table thus:
    "create table tablename(col1 as char(10))"

    When I use a test java program to insert values into this table, I am getting error -271("Could not insert new row into the table.")

    I am attaching the Java program as well as the log in the zip file. The Java program makes use of a number of methods in DatabaseMetaData and Connection interface of java.sql package to give an idea of the environment I am working on.

    Using:
    > Informix Dynamic Server 9.3
    > Win2k Server
    > JDBC driver version 2.30.JC1N814


    Thanks for all the help,
    Sumanto
    Attached Files Attached Files

  2. #2
    Join Date
    Aug 2002
    Location
    Bonn/Germany
    Posts
    152
    The isam error tells you the exact cause of the
    problem ("the file is locked...").

    Are you running this program concurrently or is another
    program trying to change (insert, update, delete or select)
    the same rows ?

    You should create your table with row-level-locking
    not page-level-locking, i.e.:


    create table tablename(col1 as char(10)) lock mode row;

    And perform the statement 'set lock mode to wait 5' in your
    jdbc program.
    This should help to avoit the problem.

    Be careful with mode-ansi-databases. You have automatically
    the default isolation level of 'repeatable read'. This is in
    most cases not what you want. So you should either change
    the isolation level to committed read or cursor stability or
    you should normal 'unbuffered' databases, but not mode-ansi (create database <db> with log).

    Best regards

    Eric
    --
    IT-Consulting Herber
    WWW: http://www.herber-consulting.de
    Email: eric@herber-consulting.de

    ***********************************************
    Download the IFMX Database-Monitor for free at:
    http://www.herber-consulting.de/BusyBee
    ***********************************************

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •