Question What is the best way to connect mysql db from Openedge Application running on Linux Server?

wishwa

New Member
I just need to connect to mysql db from Openedge application which is running on RedHat server. Progress DataDirect is not an option for our case as the price is too much. Can someone suggest a good approach to resolve my problem.
 

Rob Fitzpatrick

ProgressTalk.com Sponsor
Depending on your release, you might be able to use DataServer for ODBC. However that is not a long-term solution as that product has been discontinued as of 11.6.
 

Tarby777

Member
You could just install MySql's ODBC driver - which is free - then you can access the database directly from the 4GL with code like this:

def var chConnection as com-handle no-undo. def var chRecordset as com-handle no-undo. def var chCommand as com-handle no-undo. def var cCommand as char no-undo. CREATE "ADODB.Connection" chConnection. CREATE "ADODB.Recordset" chRecordset. CREATE "ADODB.Command" chCommand. chConnection:Open("data source=mysql-instance;server=localhost","username","password",0) NO-ERROR. chCommand:ActiveConnection = chConnection. cCommand = "SELECT * from schema.table;".

Obviously, I've anonymised my user name, password, schema and table name in this snippet, and you also need code to iterate through the result set. There are some good examples of how to do it in the Progress Knowledgebase. I'm using code like this to migrate application data from MySql to OE 11.6; this approach is working fine for me.

HTH
Tarby
 

wishwa

New Member
Hi Tarby

Thank you for your reply. I don't think ADODB will work on Linux environment. It will work in WIndows environment. In knowladge base, they have mentioned the 5767 error will appear when try to using ADODB commands in linux environment.

Best Regards
Wishwa
 

Tarby777

Member
Hi Tarby

Thank you for your reply. I don't think ADODB will work on Linux environment. It will work in WIndows environment. In knowladge base, they have mentioned the 5767 error will appear when try to using ADODB commands in linux environment.

Best Regards
Wishwa

Hi Wishwa,

I haven't tried on Linux, so I can't say for sure... but the way I read that knowledgebase entry, it seems to be talking about getting an error if you try to run the Progress code on Linux. I was suggesting running the Progress code on Windows, hooking it up to a MySql instance that is on Linux.

For example, this statement:

chConnection:Open("data source=mysql-instance;server=localhost","username","password",0) NO-ERROR.

would contain the name of the Linux server, instead of localhost. It's probably at least worth a try.

HTH
Tarby
 
Top