Skip to main content

Access to SQLite with AcuCobol 9.2

  • March 18, 2020
  • 15 replies
  • 0 views

I would like to write in SQLite with AcuCobol 9.2.5 and use sqlite3.dll. Is it possible and when yes, where can I find an example?

Thank you in advance.
Werner

15 replies

Claude Greiner
  • Participating Frequently
  • March 19, 2020

I would like to write in SQLite with AcuCobol 9.2.5 and use sqlite3.dll. Is it possible and when yes, where can I find an example?

Thank you in advance.
Werner

For mssql you can use this code, for sqllite may be the same, only the connectstring must be other:

see zip-file

 


Claude Greiner
  • Participating Frequently
  • March 19, 2020

I would like to write in SQLite with AcuCobol 9.2.5 and use sqlite3.dll. Is it possible and when yes, where can I find an example?

Thank you in advance.
Werner

For Ms-access the connectring can be:
move 'ODBC;DSN=msaccess;database=FDARTSTA;Uid=Admin;Pwd;' to sql-connectstring

SQLITE is nearly the same!

Claude Greiner
  • Participating Frequently
  • March 19, 2020

I would like to write in SQLite with AcuCobol 9.2.5 and use sqlite3.dll. Is it possible and when yes, where can I find an example?

Thank you in advance.
Werner

Here you can find all informations you Need:
https://sqlite.org/index.html

  • March 22, 2020
Here you can find all informations you Need:
https://sqlite.org/index.html

Vielen Dank für die Antwort und die Datei. Ich werde diese morgen testen.

In einem Beitrag habe ich diesen Ansatz über die sqlite3.dll gefunden und eingebaut:
call "sqlite3_exec" using by value sqlite3-db
by reference sqlQuery
by value 0
by value 0
by reference err-msg
returning RC
end-call.

Das Schreiben in die SQlite-DB-Tabelle und das Löschen der Daten funktioniert so. Nur Retour-Werte kann ich nicht auswerten. Offenbar funktioniert dieser Aufruf nur in eine Richtung.


Claude Greiner
  • Participating Frequently
  • March 22, 2020

Vielen Dank für die Antwort und die Datei. Ich werde diese morgen testen.

In einem Beitrag habe ich diesen Ansatz über die sqlite3.dll gefunden und eingebaut:
call "sqlite3_exec" using by value sqlite3-db
by reference sqlQuery
by value 0
by value 0
by reference err-msg
returning RC
end-call.

Das Schreiben in die SQlite-DB-Tabelle und das Löschen der Daten funktioniert so. Nur Retour-Werte kann ich nicht auswerten. Offenbar funktioniert dieser Aufruf nur in eine Richtung.

Hi Werner,

you must become the result code (RC) in the field RC, rc=0 will be succesfull, otherwise error.

you must call to begin of your Programm: call "sqlite3.dll"

Can you share your Little program, i have many time and will help you to include all SQL possibilities as for other database as mssql, mysql, Oracle, db2 and other.

Thank you for giving us the possibility to help you and the community

 


  • March 22, 2020

Hi Werner,

you must become the result code (RC) in the field RC, rc=0 will be succesfull, otherwise error.

you must call to begin of your Programm: call "sqlite3.dll"

Can you share your Little program, i have many time and will help you to include all SQL possibilities as for other database as mssql, mysql, Oracle, db2 and other.

Thank you for giving us the possibility to help you and the community

 

writing works well, also delete, open and close. Just reading ist not possible.

I don't get a return and RC is not zero. I think the data types are wrong with USING BY. I also do not recognize in which field / table the return values ​​would be output.


Claude Greiner
  • Participating Frequently
  • March 22, 2020

Hi Werner,

you must become the result code (RC) in the field RC, rc=0 will be succesfull, otherwise error.

you must call to begin of your Programm: call "sqlite3.dll"

Can you share your Little program, i have many time and will help you to include all SQL possibilities as for other database as mssql, mysql, Oracle, db2 and other.

Thank you for giving us the possibility to help you and the community

 

here a example to read a database with mssql (see attachment)

 


Claude Greiner
  • Participating Frequently
  • March 22, 2020

Vielen Dank für die Antwort und die Datei. Ich werde diese morgen testen.

In einem Beitrag habe ich diesen Ansatz über die sqlite3.dll gefunden und eingebaut:
call "sqlite3_exec" using by value sqlite3-db
by reference sqlQuery
by value 0
by value 0
by reference err-msg
returning RC
end-call.

Das Schreiben in die SQlite-DB-Tabelle und das Löschen der Daten funktioniert so. Nur Retour-Werte kann ich nicht auswerten. Offenbar funktioniert dieser Aufruf nur in eine Richtung.

Achtung! Attention!
with "sqlite3_exec" there will be a procedure that is call, this is possible with all database and you must know what is describe in this _exec!

  • March 22, 2020

here a example to read a database with mssql (see attachment)

 

Thank you very much. How can I use this code in AcuCobol 9.2?

EXEC SQL doesn't work

Du you have a complete sample I can test in AcuBench, please?


Claude Greiner
  • Participating Frequently
  • March 22, 2020

I would like to write in SQLite with AcuCobol 9.2.5 and use sqlite3.dll. Is it possible and when yes, where can I find an example?

Thank you in advance.
Werner

Werner, it exist a odbc Driver for sqlite and then you can use normal SQL commands,

see https://www.devart.com/odbc/sqlite/download.html

 


Claude Greiner
  • Participating Frequently
  • March 23, 2020

writing works well, also delete, open and close. Just reading ist not possible.

I don't get a return and RC is not zero. I think the data types are wrong with USING BY. I also do not recognize in which field / table the return values ​​would be output.

Werner, i have a running Version with full functionality via odbc driver, here a possible connectstring:
Driver=Devart ODBC Driver for SQLite;Database=p:\\cobol\\sqlite\\sqlite3.db;LongNames=0;Timeout=1000;NoTXN=0;SyncPragma=NORMAL;StepAPI=0;Force Create Database=True;
This must run with acucobol, my example run with netexpress 5.x and Visual Cobol 5.x

Claude Greiner
  • Participating Frequently
  • March 23, 2020

writing works well, also delete, open and close. Just reading ist not possible.

I don't get a return and RC is not zero. I think the data types are wrong with USING BY. I also do not recognize in which field / table the return values ​​would be output.

rc must be pic s9(09) comp-5. !!!!
Otherwise you become not the fully return code!
in wich variables do you become the select fields?

  • March 24, 2020
Werner, i have a running Version with full functionality via odbc driver, here a possible connectstring:
Driver=Devart ODBC Driver for SQLite;Database=p:\\cobol\\sqlite\\sqlite3.db;LongNames=0;Timeout=1000;NoTXN=0;SyncPragma=NORMAL;StepAPI=0;Force Create Database=True;
This must run with acucobol, my example run with netexpress 5.x and Visual Cobol 5.x

Thank you once more. I'll test the ODBC-Version with AcuCobol 10.3 in some days. Up to now I'm using the DLL-Access.


Claude Greiner
  • Participating Frequently
  • March 24, 2020

Thank you once more. I'll test the ODBC-Version with AcuCobol 10.3 in some days. Up to now I'm using the DLL-Access.

What do you mean with DLL-Access?
Is it not necessary to upload a full working example for sqlite?
The ODBC-Driver will cost 150$

Stephen Hjerpe
  • Participating Frequently
  • March 24, 2020

Thank you very much. How can I use this code in AcuCobol 9.2?

EXEC SQL doesn't work

Du you have a complete sample I can test in AcuBench, please?

If you are using EXEC SQL within your Acu COBOL program, in addition to the regular compiler and runtime,  you need to have the  AcuSQL PreCompiler and AcuSQL runtime installed