FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Conexi贸n a Base Datos
Posts: 115
Joined: Fri Oct 14, 2005 07:10 PM
Conexi贸n a Base Datos
Posted: Fri Nov 23, 2018 12:08 AM
Ayuda por favor:

1) A traves de DBF2SQL transform茅 tablas DBF a SQL. Los datos creados los he podido ver con HeidiSQL, NaviCat, MySqlQueryBrowser sin ningun problema

2) Intento abrir alguna de las tablas de la siguente forma:

Code (fw): Select all Collapse
 聽 local cServer 聽 聽 := "localhost"
聽 聽local cDataBase 聽 := "FacNit"
聽 聽local cUser 聽 聽 聽 := "root"
聽 聽local cPassWord 聽 := "348500"

聽 聽? "Start"
聽 聽oCn 聽 := FW_OpenAdoConnection( { "MYSQL", cServer, cDataBase, cUser, cPassword }, .t. )
聽 聽if oCn == nil
聽 聽 聽 ? "Connection Fail"
聽 聽 聽 return nil
聽 聽else
聽 聽 聽 ? "Connected"
聽 聽endif



y me arroja este error:

Code (fw): Select all Collapse
[Microsoft][Administrador de controladores ODBC] No se
encuentra el nombre del origen de datos y no se especific贸
ningun controlador predeterminado
Source 聽 聽 聽 聽 : Microsoft OLE DB Provider for ODBC Drivers
NativeError 聽: 0
Error Source: Microsoft OLE DB Provider dor ODBC Drivers
Sql State 聽 聽 : IM002
------------------------------------------
FW_OPENADOCONNECTION( 128 )



De antemanos, gracias
Saludos,

Gonzalo

Puerto Montt - CHILE

FWH 22.12 - Harbour 3.2.0dev (r2008190002) - Borland/Embarcadero C++ 7.0(32-bit)
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Conexi贸n a Base Datos
Posted: Fri Nov 23, 2018 12:25 AM
For working with ADO, you need to download and install MySql ODBC connector. That is the reason for the error you are getting.

Because you are using FWH 18.01, it is a lot easier to connect to and work with MySql tables using the inbuilt functionality of FWH.

Please open \fwh\samples\maria01.prg
You will see this in line 14.
Code (fw): Select all Collapse
   oCn   := FW_DemoDB()


Please change this as:
Code (fw): Select all Collapse
   oCn := maria_Connect( "localhost", "FacNit", "root", "348500" )


Save the file in the same \fwh\samples folder and build and run with
Code (fw): Select all Collapse
buildh maria01
// or
buildx maria01


You will get a message if you are connected or not and if connected, you will see a list of all tables and then if you double-click on any table you will see a browse of that table.
This is a good start for working with MySQL database with FWH.
Regards



G. N. Rao.

Hyderabad, India
Posts: 115
Joined: Fri Oct 14, 2005 07:10 PM
Re: Conexi贸n a Base Datos
Posted: Fri Nov 23, 2018 09:45 PM

Thank you very much G. N. Rao, it worked perfect. I will start using the examples.

Saludos,

Gonzalo

Puerto Montt - CHILE

FWH 22.12 - Harbour 3.2.0dev (r2008190002) - Borland/Embarcadero C++ 7.0(32-bit)

Continue the discussion