Configurar ODBC automaticamente

Configurar ODBC automaticamente

Postby Carles » 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
Skype -> https://join.skype.com/cnzQg3Kr1dnk
User avatar
Carles
 
Posts: 1082
Joined: Fri Feb 10, 2006 2:34 pm
Location: Barcelona

Re: Configurar ODBC automaticamente

Postby carlos vargas » Thu Jun 15, 2017 6: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)
User avatar
carlos vargas
 
Posts: 1680
Joined: Tue Oct 11, 2005 5:01 pm
Location: Nicaragua

Re: Configurar ODBC automaticamente

Postby carlos vargas » Thu Jun 15, 2017 6: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: Select all  Expand view
#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)
User avatar
carlos vargas
 
Posts: 1680
Joined: Tue Oct 11, 2005 5:01 pm
Location: Nicaragua

Re: Configurar ODBC automaticamente

Postby carlos vargas » Thu Jun 15, 2017 6:22 pm

Salu2
Carlos Vargas
Desde Managua, Nicaragua (CA)
User avatar
carlos vargas
 
Posts: 1680
Joined: Tue Oct 11, 2005 5:01 pm
Location: Nicaragua

Re: Configurar ODBC automaticamente

Postby Carles » Thu Jun 15, 2017 6: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
Skype -> https://join.skype.com/cnzQg3Kr1dnk
User avatar
Carles
 
Posts: 1082
Joined: Fri Feb 10, 2006 2:34 pm
Location: Barcelona

Re: Configurar ODBC automaticamente

Postby Rick Lipkin » Thu Jun 15, 2017 7: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
User avatar
Rick Lipkin
 
Posts: 2606
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: Configurar ODBC automaticamente

Postby Compuin » Thu Jun 15, 2017 7: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 20.12
Hbmk2 32/64 Bits (Build 19.29.30133)
Microsoft Visual C 32 Bits
MySql 8.0.24 32/64 Bits
VS Code
Compuin
 
Posts: 1213
Joined: Tue Dec 28, 2010 1:29 pm
Location: Quebec, Canada

Re: Configurar ODBC automaticamente

Postby joseluisysturiz » Fri Jun 16, 2017 3: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... :shock:
Dios no está muerto...

Gracias a mi Dios ante todo!
User avatar
joseluisysturiz
 
Posts: 2064
Joined: Fri Jan 06, 2006 9:28 pm
Location: Guatire - Caracas - Venezuela

Re: Configurar ODBC automaticamente

Postby Carles » Fri Jun 16, 2017 5: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 :cry:

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
Skype -> https://join.skype.com/cnzQg3Kr1dnk
User avatar
Carles
 
Posts: 1082
Joined: Fri Feb 10, 2006 2:34 pm
Location: Barcelona

Re: Configurar ODBC automaticamente

Postby Compuin » 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 :cry:

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 20.12
Hbmk2 32/64 Bits (Build 19.29.30133)
Microsoft Visual C 32 Bits
MySql 8.0.24 32/64 Bits
VS Code
Compuin
 
Posts: 1213
Joined: Tue Dec 28, 2010 1:29 pm
Location: Quebec, Canada

Re: Configurar ODBC automaticamente

Postby carlos vargas » Fri Jun 16, 2017 6: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)
User avatar
carlos vargas
 
Posts: 1680
Joined: Tue Oct 11, 2005 5:01 pm
Location: Nicaragua


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 12 guests