Fuzzmaster
New Member
Hopefully this helps someone as it certainly caused me fits...
Problem:
Webspeed application needed to connect and retrieve from both Progress and mySQL databases.
Problem Compounded:
ODBC DataServer is out as Progress does not support mySQL connections. (Many thanks to this forum saving me that aggravation).
Solution:
Matthew Lang (A Friggin' Genius & Hero) wrote API mapping for mySQL functions dubbed "pro2mysql". Available (for now) here:
http://www.oehive.org/amduus/pro2mysql/
Additional Problem:
"pro2mysql" was written for use on solaris/unix/linux systems based on the mySQL shared library "libmysqlclient.so" (not so cool for Windows servers running IIS - No shared libraries).
How I somehow managed to get it to work:
<!--WSS
{./inc/sys_fnc.i} /* ### Include Pro2MySQL Functions - Thanks Matthew Lang! */
DEF VAR conn AS memptr NO-UNDO.
DEF VAR rs AS memptr NO-UNDO.
DEF VAR dbERR AS INT NO-UNDO.
DEF VAR dbMSG AS CHAR NO-UNDO.
DEF VAR dbSQL AS CHAR NO-UNDO.
DEF VAR dbROW AS INT NO-UNDO.
ASSIGN dbERR = 0
dbROW = 0.
dbSQL = "SELECT * FROM table;". /* ### QUERY */
db_connect(conn).
ASSIGN dbERR = db_query(conn,dbSQL).
IF dbERR <> 0 THEN
ASSIGN dbMSG = "Query Error: " + db_last_error(conn).
ELSE
ASSIGN rs = db_use_result(conn)
dbROW = db_fetch_into_array(rs).
IF dbERR <> 0 THEN DO: -->
<H1>`dbMSG`</H1>
<!--WSS END. IF dbROW <> 1 THEN DO: /* ### No Records */ -->
<H3 CLASS="noprint">No Records Found Matching Search Criteria.</H3>
<!--WSS END. /* ### No Records */ ELSE DO: /* ### Records Exist */ -->
<TABLE>
<TR><TH CLASS="left">Field</TH></TR>
<!--WSS DO WHILE dbROW EQ 1: /* ### While Records Exist */ -->
<TR><TD CLASS="left">`mysql-row[1]`</TD></TR>
<!--WSS ASSIGN dbROW = db_fetch_into_array(rs). END. /* ### While Records Exist */ -->
</TABLE>
<!--WSS END. /* ### Records Exist */ -->
Problem:
Webspeed application needed to connect and retrieve from both Progress and mySQL databases.
Problem Compounded:
ODBC DataServer is out as Progress does not support mySQL connections. (Many thanks to this forum saving me that aggravation).
Solution:
Matthew Lang (A Friggin' Genius & Hero) wrote API mapping for mySQL functions dubbed "pro2mysql". Available (for now) here:
http://www.oehive.org/amduus/pro2mysql/
Additional Problem:
"pro2mysql" was written for use on solaris/unix/linux systems based on the mySQL shared library "libmysqlclient.so" (not so cool for Windows servers running IIS - No shared libraries).
How I somehow managed to get it to work:
- Download "pro2mysql" and copy "mysql-functions.i" to the webspeed working directory.
- Install mysql-client (I used version 5.0) on Webserver, including additional library option.
- Copy "libmysql.dll" and "libmysql.lib" files from the mySQL installation directory to SYSTEM32 folder (Not sure you need to do this).
- Add these Environment Variables to Windows ("Environment Variables..." - Advanced Tab - after right-clicking on "My Computer"):
- MYSQLHOST - Hostname of mysql server
- MYSQLDB - Name of mysql database
- MYSQLPORT - Port used by mysql server (Optional).
- MYSQLUSER - Username
- MYSQLPASS - Password
- Reboot (I couldn't find another way).
- Find and Replace every instance of "libmysqlclient.so" with "libmysql.dll" in the file "mysql-functions.i".
- Change your drawers as you may have made a mess watching it work.
<!--WSS
{./inc/sys_fnc.i} /* ### Include Pro2MySQL Functions - Thanks Matthew Lang! */
DEF VAR conn AS memptr NO-UNDO.
DEF VAR rs AS memptr NO-UNDO.
DEF VAR dbERR AS INT NO-UNDO.
DEF VAR dbMSG AS CHAR NO-UNDO.
DEF VAR dbSQL AS CHAR NO-UNDO.
DEF VAR dbROW AS INT NO-UNDO.
ASSIGN dbERR = 0
dbROW = 0.
dbSQL = "SELECT * FROM table;". /* ### QUERY */
db_connect(conn).
ASSIGN dbERR = db_query(conn,dbSQL).
IF dbERR <> 0 THEN
ASSIGN dbMSG = "Query Error: " + db_last_error(conn).
ELSE
ASSIGN rs = db_use_result(conn)
dbROW = db_fetch_into_array(rs).
IF dbERR <> 0 THEN DO: -->
<H1>`dbMSG`</H1>
<!--WSS END. IF dbROW <> 1 THEN DO: /* ### No Records */ -->
<H3 CLASS="noprint">No Records Found Matching Search Criteria.</H3>
<!--WSS END. /* ### No Records */ ELSE DO: /* ### Records Exist */ -->
<TABLE>
<TR><TH CLASS="left">Field</TH></TR>
<!--WSS DO WHILE dbROW EQ 1: /* ### While Records Exist */ -->
<TR><TD CLASS="left">`mysql-row[1]`</TD></TR>
<!--WSS ASSIGN dbROW = db_fetch_into_array(rs). END. /* ### While Records Exist */ -->
</TABLE>
<!--WSS END. /* ### Records Exist */ -->