If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Informix > Java program not able to insert in table in transactional database

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-03-03, 05:00
sumo sumo is offline
Registered User
 
Join Date: Apr 2003
Posts: 9
Exclamation 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
File Type: zip problem.zip (1.3 KB, 17 views)
Reply With Quote
  #2 (permalink)  
Old 04-04-03, 11:07
eherber eherber is offline
Registered User
 
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
***********************************************
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On