FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Configurar ODBC automaticamente
Posts: 1283
Joined: Fri Feb 10, 2006 02:34 PM
Configurar ODBC automaticamente
Posted: Thu Jun 15, 2017 11:50 AM

Hola,

¿ Alguien sabe como poder configurar automaticamente un ODBC (p.e. una conexion a Acces) desde dentro la aplicación ? (O sea, que lo que haces manualmente desde la pantalla de configuracion de ODBC's hacerlo con alguna funcion interna)

Gracias !!! :-)

Salutacions, saludos, regards

"...programar es fácil, hacer programas es difícil..."

UT Page -> https://carles9000.github.io/
Forum UT -> https://discord.gg/bq8a9yGMWh
HIX -> https://github.com/carles9000/hix
Posts: 1789
Joined: Tue Oct 11, 2005 05:01 PM
Re: Configurar ODBC automaticamente
Posted: Thu Jun 15, 2017 06:10 PM

Carles, creo recordar que existe una funcion que permitia la cracion de una entrada en el odbc.
incluso debe estar en un post viejisimo, se usaba el comando dll para crear la funcion wraper.

estoy buscandola....

Salu2

Carlos Vargas

Desde Managua, Nicaragua (CA)
Posts: 1789
Joined: Tue Oct 11, 2005 05:01 PM
Re: Configurar ODBC automaticamente
Posted: Thu Jun 15, 2017 06:17 PM
https://support.microsoft.com/es-es/help/287668/how-to-use-sqlconfigdatasource-to-create-an-access-system-dsn

no es la que recuerdo, pero es una implementacion diferente.
http://forums.fivetechsupport.com/viewtopic.php?f=6&t=5185&start=0
Code (fw): Select all Collapse
#include "Fivewin.ch"
FUNCTION CfgOdbc()
   LOCAL nRet,cDriver,cAttribute
   cDriver   :="Client Access ODBC Driver (32-bit)"
   cAttribute:="DSN=BIEL"+Chr(0)+"DESCRIPTION=descipcion"+Chr(0)+"SERVER=192.168.101.1"
   nRet:=CrtDtaSrc(0,1,cDriver, cAttribute )
   //nRet->0 no se ha creado, 1 creado ok
RETURN NIL

DLL32 FUNCTION CrtDtaSrc(hWnd AS LONG, nRequest AS LONG, @cDriver as STRING  , @cAttributes as STRING) ;
   AS _INT PASCAL FROM "SQLConfigDataSource" LIB "ODBCCP32"
Salu2

Carlos Vargas

Desde Managua, Nicaragua (CA)
Posts: 1789
Joined: Tue Oct 11, 2005 05:01 PM
Re: Configurar ODBC automaticamente
Posted: Thu Jun 15, 2017 06:22 PM
Salu2

Carlos Vargas

Desde Managua, Nicaragua (CA)
Posts: 1283
Joined: Fri Feb 10, 2006 02:34 PM
Re: Configurar ODBC automaticamente
Posted: Thu Jun 15, 2017 06:37 PM

Carlos gracias :D

Le hecho un vistazo.

Saludos.

C.

Salutacions, saludos, regards

"...programar es fácil, hacer programas es difícil..."

UT Page -> https://carles9000.github.io/
Forum UT -> https://discord.gg/bq8a9yGMWh
HIX -> https://github.com/carles9000/hix
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: Configurar ODBC automaticamente
Posted: Thu Jun 15, 2017 07:02 PM

Carles

Dumb question ... why use ODBC and not ADO ? .. With ODBC you have to configure every workstation your app runs on... ADO uses the built in Ole providers for Sql Server, Ms Access .. for all others, you have to download the Ole Provider for your RDMS.

Rick Lipkin

Posts: 1276
Joined: Tue Dec 28, 2010 01:29 PM
Re: Configurar ODBC automaticamente
Posted: Thu Jun 15, 2017 07:21 PM
The question is clear. He need a function to create automatically the ODBC on the computer (or computers). ODBC has a new version, like this:

Microsoft ODBC Driver 11 for SQL Server is a single dynamic-link library (DLL) containing run-time support for applications using native-code APIs to connect to Microsoft SQL Server 2005, 2008, 2008 R2, SQL Server 2012, SQL Server 2014 and Windows Azure SQL Database. Microsoft ODBC Driver 11 for SQL Server should be used to create new applications or enhance existing applications that need to take advantage of new SQL Server 2012 features. This redistributable installer for Microsoft ODBC Driver 11 for SQL Server installs the client components needed during run time to take advantage of new SQL Server 2012 features, and optionally installs the header files needed to develop an application that uses the ODBC API.

On IT, sometimes is not just click to install an app, it could involve more work than just a installation step.

Regards

FWH 25.12

Harbour/Hbmk2

Microsoft Visual C++

MySql 8.0

Antigravity

Posts: 2064
Joined: Fri Jan 06, 2006 09:28 PM
Re: Configurar ODBC automaticamente
Posted: Fri Jun 16, 2017 03:13 AM
Rick Lipkin wrote:Carles

Dumb question ... why use ODBC and not ADO ? .. With ODBC you have to configure every workstation your app runs on... ADO uses the built in Ole providers for Sql Server, Ms Access .. for all others, you have to download the Ole Provider for your RDMS.

Rick Lipkin


Algun sample.? por favor, necesito usar ADO con ODBC para leer unos archivos .DAT de delphi, gracias, saludos... :-)
Dios no está muerto...



Gracias a mi Dios ante todo!
Posts: 1283
Joined: Fri Feb 10, 2006 02:34 PM
Re: Configurar ODBC automaticamente
Posted: Fri Jun 16, 2017 05:47 AM
Hi,

Rick Lipkin wrote:Carles

Dumb question ... why use ODBC and not ADO ? .. With ODBC you have to configure every workstation your app runs on... ADO uses the built in Ole providers for Sql Server, Ms Access .. for all others, you have to download the Ole Provider for your RDMS.n


I know and I agree with you, but my problem is another, believe me :-)

Compuin wrote:...
On IT, sometimes is not just click to install an app, it could involve more work than just a installation step.


Cierto, y el problema esta en una mierda de aplicación de una empresa externa que usa todo el mundo desde hace años y que necesita conectarse via ODBC y es necesario configurar el dns. Claro que si solo hay una maquina se configura y listos, pero en mi caso son unas 180 máquinas y cada vez que se instalan en nuevas ocurre lo mismo.

Es por eso que quiero hacer un pequeño programa en FWH y que chequee si existe en la entrada del dns y en caso contrario generar la parametrizacion del dns. Esto lo aplicaria en una politica de arranque del sistema que se ejecute en 2 plano al iniciar el sistema y listos...
Salutacions, saludos, regards

"...programar es fácil, hacer programas es difícil..."

UT Page -> https://carles9000.github.io/
Forum UT -> https://discord.gg/bq8a9yGMWh
HIX -> https://github.com/carles9000/hix
Posts: 1276
Joined: Tue Dec 28, 2010 01:29 PM
Re: Configurar ODBC automaticamente
Posted: Fri Jun 16, 2017 12:32 PM
Carles wrote:Hi,

Rick Lipkin wrote:Carles

Dumb question ... why use ODBC and not ADO ? .. With ODBC you have to configure every workstation your app runs on... ADO uses the built in Ole providers for Sql Server, Ms Access .. for all others, you have to download the Ole Provider for your RDMS.n


I know and I agree with you, but my problem is another, believe me :-)

Compuin wrote:...
On IT, sometimes is not just click to install an app, it could involve more work than just a installation step.


Cierto, y el problema esta en una mierda de aplicación de una empresa externa que usa todo el mundo desde hace años y que necesita conectarse via ODBC y es necesario configurar el dns. Claro que si solo hay una maquina se configura y listos, pero en mi caso son unas 180 máquinas y cada vez que se instalan en nuevas ocurre lo mismo.

Es por eso que quiero hacer un pequeño programa en FWH y que chequee si existe en la entrada del dns y en caso contrario generar la parametrizacion del dns. Esto lo aplicaria en una politica de arranque del sistema que se ejecute en 2 plano al iniciar el sistema y listos...


Asi es amigo, muchas veces venimos por soluciones y nos ofrecen cambiar pero cuando no se puede hay que buscar resolver. Luego veras si cambias de ODBC a ADO.

La idea de una funcion que realice la creacion de los ODBC en forma automatica, para esa cantidad de equipos, te ahorrara tiempo.

FWH 25.12

Harbour/Hbmk2

Microsoft Visual C++

MySql 8.0

Antigravity

Posts: 1789
Joined: Tue Oct 11, 2005 05:01 PM
Re: Configurar ODBC automaticamente
Posted: Fri Jun 16, 2017 06:07 PM
Carles, para ese caso creo seria mejor la alternativa de crear en el registro la entrada del odbc
https://kencenerelli.wordpress.com/2012/07/26/export-an-odbc-data-source-from-the-registry/
asi solo usas un archivo reg.

bueno solo una idea.
Salu2

Carlos Vargas

Desde Managua, Nicaragua (CA)

Continue the discussion