DataDirect being called by Progress

Posted by clive@applog.co.nz on 24-Sep-2014 15:27

Has anyone called the unix datadirect odbc from progress code.

Progress v11.4  datadirect odbc SQL native driver.

I can use the supplied tool to access the SQL database, but I now need to call the odbc from progress, and cannot find any where in the manual how to do this. The samples are all in c.

Can anyone point me to a reference or has some sample code they can share.

Many thanks

Clive Biddulph

All Replies

Posted by Jean Richert on 25-Sep-2014 04:36

Hi Clive, you initially posted your question into our DataDirect Cloud forum but as your questions refers to the OE ODBC driver I moved your post in our OE forum.

Posted by Tinco on 25-Sep-2014 05:37

Hi Clive,

If you want to access a Microsoft SQL database using 4GL code then using a dataserver to access the Microsoft SQL database would probably be the way to go. The MS SQL permissions needed are described in knowledgebase.progress.com/.../000050107

More information about the MS SQL dataserver product can be found here:

documentation.progress.com/.../index.html

Once configured the dataserver will then make the conversions between the OpenEdge 4GL queries to the MS SQL queries and then convert the MS SQL result sets into an OpenEdge format.

Kind regards,

Tinco van Engen

Posted by Peter Judge on 25-Sep-2014 07:56

You can look at the SQL Dataserver product which allows you to write normal ABL against a MSSQL database.

If you just want to use ODBC, you can use the sample and approach at this page: community.progress.com/.../2179.integrating-datadirect-cloud-and-progress-easyl-into-openedge-using-the-odbc-bridge-sample-applications.aspx .

You will need to modify src\OpenEdge\Data\ODBC\DriverManagerLib.i to point to the ODBC .so and will need to recompile the ABL, but after that it /should/ work.

-- peter

Posted by clive@applog.co.nz on 25-Sep-2014 14:58

Sorry I did not fully detail the problem.
 
I want to call the odbc from a unix machine not a windows machine.
 
The dataserver does not handle xml data types ( yes I can load a view to handle this ) but the supplier of the DB  has said you change the DB in any way then all the issues you log may be  chargeable as you have changed the DB.
 
The samples are all windows based and the ERP is based on unix.
 
I have got the ODBC connect to work using the sample code which is compiled C code so the system should work I just want it to work with progress 4gl.
 
 
Progress 11.4 on red hat.
SQL 2014 in server 2008
Datadirect odbc.
 
 
So this would be easy if it was windows based.
 
Clive Biddulph
Analyst/Programmer
 
 
Applied Logic Systems Ltd
Level 1, 1 Marewa Road, Greenlane, Auckland 1051 | PO Box 74-552, Market Road, Auckland 1546
 
 
Ph        +64 9 520 1853
Fax      +64 9 520 8051
 
The information contained in this email is intended for the recipient(s) only.  It may contain privileged or confidential information.  If you are not the intended recipient of this email, you must not copy, distribute or take any action that relies on it. If you have received this email in error, please notify the sender immediately and then delete the message.   Whilst Applied Logic Systems Ltd uses virus scanning software, we exclude all liability for viruses or similar in this email or in any attachment.
 
[collapse]
From: Peter Judge [mailto:bounce-pjudge@community.progress.com]
Sent: Friday, 26 September 2014 12:57 a.m.
To: TU.OE.General@community.progress.com
Subject: RE: [Technical Users - OE General] DataDirect being called by Progress
 
Reply by Peter Judge

You can look at the SQL Dataserver product which allows you to write normal ABL against a MSSQL database.

If you just want to use ODBC, you can use the sample and approach at this page: community.progress.com/.../2179.integrating-datadirect-cloud-and-progress-easyl-into-openedge-using-the-odbc-bridge-sample-applications.aspx .

You will need to modify src\OpenEdge\Data\ODBC\DriverManagerLib.i to point to the ODBC .so and will need to recompile the ABL, but after that it /should/ work.

-- peter

Stop receiving emails on this subject.

Flag this post as spam/abuse.

[/collapse]

Posted by Marian Edu on 26-Sep-2014 00:48

For *nix you're left only with C and shared libraries, this should work if you make some kind of data access library that will use the ms$sql odbc libraries and wrap those samples you have in something along the lines of:

procedure sqlSelect external 'odbc_sql.so':
   define input  parameter sqlStatement as character.
   define return parameter resultSet    as long.
end.

procedure freeResult external 'odbc_sql.so':
   define input parameter resultSet    as long.
end.

define variable pResultSet as int64.
define variable memResult  as memptr.

run sqlSelect("select * from customer", output resultSet).

/* get result set data from memory, json/xml your own serialization */
set-pointer-value(memResult) = resultSet.

finally:
/* don't forget to free the memory allocated by library */
run freeResult(resultSet).
end finally.

or maybe you get mono to work with a .net wrapper but guess that this is still not supported by PSC.

Posted by Marian Edu on 26-Sep-2014 01:09

Wow, kudos for that Peter... definitively more than just a sample there ;)


Peter is right, updating the odbc library location in that definition file should give you a working solution... the only drawback on using directly the odbc library from 4gl is you'll end up doing a lot of calls that will kinda ruin the performance even if external procedures are defined as persistent.

Writing a small wrapper around odbc that will pack the result set: definition and data (either read-complete or row-by-row using a cursor) will greatly reduce the number of calls and if native progress temp-table serialization is used will be even better. 

This thread is closed