Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.
CarloB Absent Member.
Absent Member.
5807 views

Read Data From AcuCobol File...

Jump to solution

Hi all,
my enterprise software platform runs on AcuCobol. I would like to access the data produced by it in C #. I installed AcuODBC and through WinSql can query the database, but I can not do the same via an ASP.NET page that uses the same ODBC connection. You know you help me?

thanks a lot

0 Likes
1 Solution

Accepted Solutions
DougP Outstanding Contributor.
Outstanding Contributor.

RE: Read Data From AcuCobol File...

Jump to solution

You are using the old AcuODBC product so genesis_home does not apply.  However I suspect the problem is still with the environment.  Specifically, the location specified in the DSN, Data Directory setting.  Is that using a mapped drive to a remote server?  If so then likely the environment where your ASP.NET page is executing doesn't know that mapping.  If this is the case try using UNC notation instead.

View solution in original post

0 Likes
11 Replies
Micro Focus Expert
Micro Focus Expert

RE: Read Data From AcuCobol File...

Jump to solution

A few questions .. is the ASP.Net running on the same server as the data? Is the ASP.Net using  ADO to query the data? Is your AcuODBC DSN a file DSN or System DSN?

0 Likes
CarloB Absent Member.
Absent Member.

RE: Read Data From AcuCobol File...

Jump to solution

is the ASP.Net running on the same server as the data?

------>YES

Is the ASP.Net using  ADO to query the data?

this is my Code below....

string connectionString ="DSN=GESA";

       string sql = "select * from GEDAMAGA where codice_articolo='7659'";

       OdbcConnection conn = null;

       OdbcCommand comm = null;

       OdbcDataReader dr = null;

       try

       {

           conn = new OdbcConnection(connectionString);

           conn.Open();

           DataTable dt = conn.GetSchema(OdbcMetaDataCollectionNames.Tables);

           comm = new OdbcCommand(sql, conn);

           dr = comm.ExecuteReader();

           while (dr.Read())

           {

               Response.Write(dr.GetValue(0).ToString());

               Response.Write(dr.GetValue(1).ToString());

               Response.Write(dr.GetValue(2).ToString());

           }

           dr.Close();

       }

       catch (OdbcException oe)

       {

           Response.Write("An ODBC exception occurred: " + oe.Message.ToString());

       }

       catch (Exception ex)

       {

           Response.Write("An exception occurred: " + ex.Message.ToString());

       }

       finally

       {

           if (conn.State == System.Data.ConnectionState.Open)

           {

               conn.Close();

           }

           comm.Dispose();

           conn.Dispose();

       }

The DSN in A SYSTEM DSN.....



this is the error:

An ODBC exception occurred: ERROR [42S02] [Acucorp][ODBC AcuODBC driver]Base table or view not found: File GEDAMAGA does not exist or bad XFD record length


the same query in WinSql work fine...

0 Likes
Micro Focus Expert
Micro Focus Expert

RE: Read Data From AcuCobol File...

Jump to solution

I believe the issue is environment variable related ... when running the Winsql query you had GENESIS_HOME set, whereas the ASP.Net is run by some other account and GENESIS_HOME is probably not set. Can you make sure that GENESIS_HOME is set.

0 Likes
CarloB Absent Member.
Absent Member.

RE: Read Data From AcuCobol File...

Jump to solution

In the account where I use WinSql There is no variable called GENESIS_HOME....

0 Likes
CarloB Absent Member.
Absent Member.

RE: Read Data From AcuCobol File...

Jump to solution

heelp

0 Likes
Micro Focus Expert
Micro Focus Expert

RE: Read Data From AcuCobol File...

Jump to solution

Chapter 5:Installing AcuXDBC > 5.2 Installing AcuXDBC/AcuXDBC Server >

5.2.1 Windows Installations ... The installation process sets an environment variable known as GENESIS_HOME with the location for configuration files and the installation directory. The default installation directory is C:\Program Files\Micro Focus\Acucbl9xx\AcuGT\ on Windows. Though you can have several different configuration files and refer to different ones in your DSNs, they must always reside in the directory pointed to by GENESIS_HOME.

0 Likes
CarloB Absent Member.
Absent Member.

RE: Read Data From AcuCobol File...

Jump to solution

ok, but i have no genesis_home variable and my winsql can query acuODBC driver...Why?

0 Likes
Micro Focus Expert
Micro Focus Expert

RE: Read Data From AcuCobol File...

Jump to solution

That one is harder to explain, however if you start the query in the directory where GENESIS_HOME would be set to (usually the AcuGT\acucbl9xx directory) then the query would succeed. On Windows you can check Control Panel\All Control Panel Items\System\Advance System settings\Environment variables .. it is possible that Genesis_Home is set for the user and not for the System.

0 Likes
CarloB Absent Member.
Absent Member.

RE: Read Data From AcuCobol File...

Jump to solution

I've set the variable but nothing changed....

0 Likes
DougP Outstanding Contributor.
Outstanding Contributor.

RE: Read Data From AcuCobol File...

Jump to solution

You are using the old AcuODBC product so genesis_home does not apply.  However I suspect the problem is still with the environment.  Specifically, the location specified in the DSN, Data Directory setting.  Is that using a mapped drive to a remote server?  If so then likely the environment where your ASP.NET page is executing doesn't know that mapping.  If this is the case try using UNC notation instead.

View solution in original post

0 Likes
CarloB Absent Member.
Absent Member.

RE: Read Data From AcuCobol File...

Jump to solution

PERFECT 😉 ...thank you

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.