Guys;
I want to connect from Progress to a mySql database using odbc.
Does Progress support ODBC out of the box or do need to have the ODBC dataserver?
You can use a regular odbc driver. I've connected to MySQL, postgreSQL + MS SQL this way.
Example using postgreSQL:
/* For a simple read-only type access, try the following: */
&scoped-define adUseNone 1
define temp-table tt
field ttnum as character form "x(15)" label "Employee Number"
field ttname as character form "x(15)" label "Employee Name"
index tt-index as primary
ttnum.
define variable SQLstr as character no-undo.
define variable chCN as com-handle no-undo.
define variable chRS as com-handle no-undo.
define variable ConnStr as character no-undo.
/* change this to your MySQL odbc settings */
assign
ConnStr = "driver=" + CHR(123) + "postgreSQL" + CHR(125) + ";uid=myusername;server=192.168.1.115;password=mypassword;database=spcdatabase".
create "adodb.connection" chCN.
assign
chCN:ConnectionString = ConnStr
chCN:ConnectionTimeout = 60.
chCN:Open(ConnStr,,,).
create "ADODB.RecordSet" chRS.
SQLstr = "select f_empl, f_name
FROM empl_inf".
chRS = chCN:Execute(SQLstr,,).
repeat:
if chRS:EOF then leave.
run "creatett-SQL".
chRS:MoveNext.
end.
chRS:Close.
chCN:Close.
release object chRS.
release object chCN.
chRS = ?.
chCN = ?.
procedure creatett-SQL:
create tt.
assign
ttnum = chRS:Fields("f_empl"):VALUE
ttname = chRS:Fields("f_name"):VALUE.
end procedure.
Great information.
Thanks Rob.