#include "fivewin.ch"
function Main()
local oCn, oRs
local cServer := "localhost"
local cDataBase := "fwh"
local cUser := "root"
local cPassWord := "hidden"
? "Start"
oCn := FW_OpenAdoConnection( { "MYSQL", cServer, cDataBase, cUser, cPassword }, .t. )
if oCn == nil
? "Connection Fail"
return nil
else
? "Connected"
endif
oRs := FW_OpenRecordSet( oCn, "customer" )
XBROWSER oRs
oRs:Close()
oCn:Close()
return nil
How can I get data inside an array ?
aData := oRs:GetRows()
oRs:Close()
nageswaragunupudi wrote:You have 3 options.
1) Use TMySql.Lib // harbour contributions
2) Use dolphin.lib // great class from Mr Daniel
3) Use ADO
For options (1) and (2) you need to
(a) Obtain tmysql.lib or dolphin.lib built for xHarbour or Harbour
(b) Download libmysql.dll from mysql site
(c) Make implib libmysql.lib from libmysql.dll
(d) Link your application with tmysql.lib or dolphin.lib and libmysql.lib
(e) Keep libmysql.dll in the exepath.
There are many users in our forum who are using these libs and can help you where to get them from.
Another option is to use ADO. This is very simple and you can get going in 15 minutes.
We can use full features of the server without being restricted by the limitations of the libraries, if any.
Steps:
1) Download MySql ODBC Connector from MySql site. I advice 32 bit msi.
http://dev.mysql.com/downloads/connector/odbc/
2) Install it.
All this you can finish in less than 15 mins and you are ready to go, using FWH ADO functions.
a) Your server name. This can be ip address or url provided to you.
Franklin Demont wrote:nageswaragunupudi wrote:You have 3 options.
Hello ,
During a few days i am trying to use MySql :
1) Use TMySql.Lib // harbour contributions
I can't build this lib
2) Use dolphin.lib // great class from Mr Daniel
I can build the ewamples , they are working (made some corrections)
BUT : FWH:ERP2.prg Gives in module login : can't connect (Connect( cHost, cUser, cPassword ))
PLACING THIS COMMAND AT THE BEGINNING (BEFORE DEFINING WINDOW) : NO PROBLEM !!!!!!!!
3) Use ADO :
- downloaded and installed mysql-connector-odbc-5.3.6-win32.msi
- Register a Unicode driver (Windows example)
| shell> myodbc-installer -d -a -n "MySQL ODBC 5.3 Unicode Driver" \
| -t "DRIVER=myodbc5w.dll;SETUP=myodbc5S.dll"
Done , controled with shell> myodbc-installer -d -l , seems ok
- Trying to use ODBC Manager as described in the manuals , but can't add odbc-5.3.6
Only SQL Server appears. Must it be added ?
Trying the example gives , as expected an error DNS name not found
Frank
FW_SetUnicode( .t. )
oCn := FW_OpenAdoConnection( ... )
FW_SetUnicode( .f. ) // if not required
nageswaragunupudi wrote:May I know what is your FWH version?
if FW_SetUniCode( .t. ) then Fw_OpenAdoConnection(...) automatically uses Unicode driver, without changing the prg.
- Code: Select all Expand view RUN
FW_SetUnicode( .t. )
oCn := FW_OpenAdoConnection( ... )
FW_SetUnicode( .f. ) // if not required
devwin2010 wrote:Hi Richard
Can you send me Tmysql , source code , and make files to build mysql lib
my email is windev2@yahoo.com.ar
Thanks
Fabian
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot], Natter, Silvio.Falconi and 86 guests