# Inserts into ADABAS SQL gateway

**URL:** <https://techcommunity.softwareag.com/t/inserts-into-adabas-sql-gateway/98045>\
**Category:** Forum\
**Tags:** Adabas-Natural, Adabas, Adabas-Add-on-Products, SQL-Access, Mainframe-Integration, CONNX\
**Created:** [August 16, 2011, 1:17am UTC](https://techcommunity.softwareag.com/t/inserts-into-adabas-sql-gateway/98045 "2011-08-16T01:17:14Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Craig\_Soehnlin](https://avatars.discourse-cdn.com/v4/letter/c/ee59a6/32.png) [@Craig\_Soehnlin](https://techcommunity.softwareag.com/u/Craig_Soehnlin)\
**Post date:** [August 16, 2011, 1:17am UTC](https://techcommunity.softwareag.com/t/inserts-into-adabas-sql-gateway/98045/1 "2011-08-16T01:17:14Z")

</div>

Our using has a tool that is building the INSERTS but the primary key is the ISN. Since they don’t provide a number for the insert, it blows up with an SQL error (primary key cannot be null).  
What is the normal technique to solve this issue? Do you query the file and capture the highest ISN then add 1 to it and do the INSERT? or is there a cleaner way to accomplish this?  
Thanks,  
Craig Soehnlin

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [August 16, 2011, 2:47am UTC](https://techcommunity.softwareag.com/t/inserts-into-adabas-sql-gateway/98045/2 "2011-08-16T02:47:43Z")

</div>

Is there no way around having the ISN as the primary key ?

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [August 16, 2011, 2:43pm UTC](https://techcommunity.softwareag.com/t/inserts-into-adabas-sql-gateway/98045/3 "2011-08-16T14:43:05Z")

</div>

Generally, the ISN-Field should not be included in the INSERT statement.

For Example - the following table was created by FDT IMPORT  
and contains the columns:

- ISN\_ADABAS\_FILE\_19
- AA
- AB

The recommended syntax for INSERT is -  
insert into ADABAS\_FILE\_19 (AA, AB) values (‘TEXT VALUE’, 12345);

Mandatory Usage:  
The ISN-Field must be used, is when inserting values into a Sub-Table; e.g. a table representing an MU-Field or a PE-Group. In this case the usage ISN is mandatory, as it is part of the FOREIGN KEY releationship.

---

<div class="post-metadata">

**Author:** ![Craig\_Soehnlin](https://avatars.discourse-cdn.com/v4/letter/c/ee59a6/32.png) [@Craig\_Soehnlin](https://techcommunity.softwareag.com/u/Craig_Soehnlin)\
**Post date:** [August 16, 2011, 4:44pm UTC](https://techcommunity.softwareag.com/t/inserts-into-adabas-sql-gateway/98045/4 "2011-08-16T16:44:47Z")

</div>

Our tables were created using the SYSTRANS IMPORT feature of the data dictionary for COONNX. By default, every table received a primary key of ISN. I thought that was how CONNX was supposed to work. Once it is the primary keyk, you cannot do an INSERT without it, right? Or are you saying that CONNX will allow that to pass through?

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [August 16, 2011, 5:09pm UTC](https://techcommunity.softwareag.com/t/inserts-into-adabas-sql-gateway/98045/5 "2011-08-16T17:09:18Z")

</div>

Adabas will automatically assign the ISN.

With the exception of INSERTing into Sub-Tables,  
it is thus recommended NOT to provide the ISN during an INSERT.

---

<div class="post-metadata">

**Author:** ![Craig\_Soehnlin](https://avatars.discourse-cdn.com/v4/letter/c/ee59a6/32.png) [@Craig\_Soehnlin](https://techcommunity.softwareag.com/u/Craig_Soehnlin)\
**Post date:** [August 16, 2011, 6:11pm UTC](https://techcommunity.softwareag.com/t/inserts-into-adabas-sql-gateway/98045/6 "2011-08-16T18:11:42Z")

</div>

Thank you Richard for that answer. I am going to ask the user to call the company that makes Hibernate and see what they need to do to make it recognize the ISN field as an “identity” field.

---

<div class="post-metadata">

**Author:** ![jimmy\_helu](https://avatars.discourse-cdn.com/v4/letter/j/9d8465/32.png) [@jimmy\_helu](https://techcommunity.softwareag.com/u/jimmy_helu)\
**Post date:** [September 8, 2012, 5:24pm UTC](https://techcommunity.softwareag.com/t/inserts-into-adabas-sql-gateway/98045/7 "2012-09-08T17:24:03Z")

</div>

On the UI, sometimes we need to access the data only from Adabas, … One way to solve this problem, is to define a Linked Server in SQL

---

<div class="post-metadata">

**Author:** ![inno\_tect](https://avatars.discourse-cdn.com/v4/letter/i/bb73d2/32.png) [@inno\_tect](https://techcommunity.softwareag.com/u/inno_tect)\
**Post date:** [May 17, 2013, 6:32pm UTC](https://techcommunity.softwareag.com/t/inserts-into-adabas-sql-gateway/98045/8 "2013-05-17T18:32:20Z")

</div>

i am agree to your comment. your idea is all right. :roll:

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [April 2, 2021, 3:00pm UTC](https://techcommunity.softwareag.com/t/inserts-into-adabas-sql-gateway/98045/9 "2021-04-02T15:00:46Z")

</div>


