Conexión a Base Datos

Conexión a Base Datos

Postby gdeteran » 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: Select all  Expand view
  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: Select all  Expand view
[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)
User avatar
gdeteran
 
Posts: 115
Joined: Fri Oct 14, 2005 7:10 pm
Location: Puerto Montt - CHILE

Re: Conexión a Base Datos

Postby nageswaragunupudi » 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: Select all  Expand view

   oCn   := FW_DemoDB()
 


Please change this as:
Code: Select all  Expand view

   oCn := maria_Connect( "localhost", "FacNit", "root", "348500" )
 


Save the file in the same \fwh\samples folder and build and run with
Code: Select all  Expand view

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
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Conexión a Base Datos

Postby gdeteran » Fri Nov 23, 2018 9: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)
User avatar
gdeteran
 
Posts: 115
Joined: Fri Oct 14, 2005 7:10 pm
Location: Puerto Montt - CHILE


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot], russimicro and 54 guests