Skip to main content

on mssql tool the database is created, with visual Cobol not, i become mssql-error-code -102 or -226

What is wrong?

Please see the Notepad document in attachment

 

to create tables is not the Problem! create DATABASE

 

 

 

 

on mssql tool the database is created, with visual Cobol not, i become mssql-error-code -102 or -226

What is wrong?

Please see the Notepad document in attachment

 

to create tables is not the Problem! create DATABASE

 

 

 

 

Hello Greiner,

 

I believe the 226 error is caused by the fact that you are trying to execute a CREATE DATABASE statement in transaction mode, when SQL Server does not allow such statements (CREATE DATABASE, ALTER DATABASE) to be executed in a program that uses SQL transactions.

 

By default, Visual COBOL uses transaction mode with OpenESQL. To instead have this statement committed as soon as it is executed (momentarily turn off transaction mode), you can use:

 

EXEC SQL SET AUTOCOMMIT ON END-EXEC

 

just before the CREATE DATABASE statement, and then use:

 

EXEC SQL SET AUTOCOMMIT OFF END-EXEC

 

just after the CREATE DATABASE to resume transaction support in your COBOL program.

 

(note, fixed a couple of typo's above...)


Hello Greiner,

 

I believe the 226 error is caused by the fact that you are trying to execute a CREATE DATABASE statement in transaction mode, when SQL Server does not allow such statements (CREATE DATABASE, ALTER DATABASE) to be executed in a program that uses SQL transactions.

 

By default, Visual COBOL uses transaction mode with OpenESQL. To instead have this statement committed as soon as it is executed (momentarily turn off transaction mode), you can use:

 

EXEC SQL SET AUTOCOMMIT ON END-EXEC

 

just before the CREATE DATABASE statement, and then use:

 

EXEC SQL SET AUTOCOMMIT OFF END-EXEC

 

just after the CREATE DATABASE to resume transaction support in your COBOL program.

 

(note, fixed a couple of typo's above...)

Thank you for this Information, i will test it today and give you a answer so soon as possible!

Hello Greiner,

 

I believe the 226 error is caused by the fact that you are trying to execute a CREATE DATABASE statement in transaction mode, when SQL Server does not allow such statements (CREATE DATABASE, ALTER DATABASE) to be executed in a program that uses SQL transactions.

 

By default, Visual COBOL uses transaction mode with OpenESQL. To instead have this statement committed as soon as it is executed (momentarily turn off transaction mode), you can use:

 

EXEC SQL SET AUTOCOMMIT ON END-EXEC

 

just before the CREATE DATABASE statement, and then use:

 

EXEC SQL SET AUTOCOMMIT OFF END-EXEC

 

just after the CREATE DATABASE to resume transaction support in your COBOL program.

 

(note, fixed a couple of typo's above...)

Yes, it works perfectly!

Yes, it works perfectly!
Glad to hear it worked out for you - thanks for letting us know.



Yes, it works perfectly!

Glad to hear it worked out for you. Thank you for letting us know!