DATABASE EXCLUSIVE Error
Posted in 1993
I have posted this sometime ago with no avail. I'm sending along a sample
of the code (Very small program) that errors on our system every time.
We are having a problem with the "DATABASE <db-name> EXCLUSIVE" statement.
We are using:
INFORMIX-RDS Version 4.10.UC3
INFORMIX-SQL Version 4.10.UC2
INFORMIX-SE Version 4.10.UD2
for SCO 3.2.2
Cut between the snips and save to a file. Then type in 'sh filename'
to generate the following files:
error.4gl
error.per
error.sql
# START ----snip----snip----snip----snip----snip----snip----snip----snip----
echo "Creating error.4gl ..."
cat > error.4gl <<!
{ error.4gl }
DATABASE db_name
MAIN
WHENEVER ERROR STOP
CALL do_first_cursor()
CALL do_next_step()
CALL do_first_cursor()
END MAIN
FUNCTION do_first_cursor()
DEFINE tr_first_fld CHAR(12),
tr_second_fld CHAR(35),
tr_cnt INTEGER,
wbuf CHAR(500)
OPEN WINDOW w1 AT 5,5 WITH FORM "error" ATTRIBUTE(BORDER)
CONSTRUCT wbuf ON
table_name.acct_no,
table_name.acctname,
table_name.source,
table_name.usr
FROM
sc_table_name.acct_no,
sc_table_name.acctname,
sc_table_name.source,
sc_table_name.usr
DELETE FROM new_table
LET wbuf = "SELECT acct_no,acctname FROM table_name WHERE ",wbuf clipped
PREPARE first_prep FROM wbuf
DECLARE first_curs CURSOR FOR first_prep
LET tr_cnt = 0
FOREACH first_curs INTO tr_first_fld,tr_second_fld
INSERT INTO new_table VALUES ( tr_first_fld,tr_second_fld )
LET tr_cnt = tr_cnt + 1
END FOREACH
FREE first_prep
ERROR "Inserted ",tr_cnt," record(s)"
SLEEP 3
CLEAR SCREEN
CLOSE WINDOW w1
END FUNCTION
FUNCTION do_next_step()
ERROR "Setting Database to exclusive mode"
DATABASE db_name EXCLUSIVE
SLEEP 2
ERROR "Closing Database"
CLOSE DATABASE
SLEEP 2
ERROR "Setting Database to normal mode"
DATABASE db_name
SLEEP 2
CLEAR SCREEN
END FUNCTION
!
echo "Creating error.per ..."
cat > error.per <<!
{ error.per }
DATABASE db_name
SCREEN
{
Account Number [a ]
Account Name [b ]
Account Source [c ]
Account Usr [d ]
}
TABLES
table_name
ATTRIBUTES
a = table_name.acct_no,REVERSE;
b = table_name.acctname,REVERSE;
c = table_name.source,REVERSE;
d = table_name.usr,REVERSE;
INSTRUCTIONS
DELIMITERS " "
SCREEN RECORD sc_table_name( acct_no thru usr)
!
echo "Creating error.sql ..."
cat > error.sql <<!
{ error.sql }
create database db_name;
create table table_name (
acct_no char(12),
acctname char(35),
source char(10),
usr char(10) );
create table new_table (
field1 char(12),
field2 char(35) );
insert into table_name values ( "12345","ABC Company","","");
insert into table_name values ( "12346","ABC Company #2","","");
insert into table_name values ( "12347","ABC Company #3","","");!
echo "Complete"
# END ----snip----snip----snip----snip----snip----snip----snip----snip----
To Duplicate, run 'isql' and choose the 'error' Query-Language script and
Run it or type in:
isql < error.sql <CR>
Compile the program and form.
fglpc error.4gl <CR>
form4gl error.per <CR>
Run the program and inquire on * within Name or Number field, then hit escape.
Watch and wait.
Re-inquire on * within Name or Number field, then hit escape.
Error -410 occurs on insert statement.
Any possible solutions/hints are greatly appreciated.
Robert Minter |Data Systems Support| \\\\\\_///
Programmer, Software Development | Orange, CA | ( o o )
internet: rob@dssmktg.com | Tel: 714.771.0454 | (| ^ |)
bangpath: uunet.uu.net!dssmktg!rob| Fax: 714.771.3028 | \\ O /
I thought I was there but, then, I found out I was .... \\_/