obtain ODBC drivers installed

obtain ODBC drivers installed

Postby lucasdebeltran » Sat Jun 15, 2013 9:17 am

Hello,

Is it possible to obtain them, so I can check, for example, that MySQL ODBC is installed or not at ODBC system?.

Thank you very much.

Best regards
Muchas gracias. Many thanks.

Un saludo, Best regards,

Harbour 3.2.0dev, Borland C++ 5.82 y FWH 13.06 [producción]

Implementando MSVC 2010, FWH64 y ADO.

Abandonando uso xHarbour y SQLRDD.
User avatar
lucasdebeltran
 
Posts: 1303
Joined: Tue Jul 21, 2009 8:12 am

Re: obtain ODBC drivers installed

Postby anserkk » Sat Jun 15, 2013 10:34 am

Code: Select all  Expand view
if !CheckMySQL_ODBC_Status('MySQL ODBC 5.2a Driver')  // ODBC Driver installed or not
    MsgInfo("MySQL ODBC 5.2a Driver is not installed in this PC")
    Return NIL
Endif


*-----------------------------------*
Function CheckMySQL_ODBC_Status(cDriver)
*-----------------------------------*
    // cDriver can be either 'MySQL ODBC 3.51 Driver' OR 'MySQL ODBC 5.1 Driver'
    Local oReg,cStatus,lStatus:=.F.
   
    oReg  := TReg32():New( HKEY_LOCAL_MACHINE, "SOFTWARE\ODBC\ODBCINST.INI\ODBC Drivers" )
    cStatus:=""          
    cStatus:= oReg:Get( cDriver, cStatus ) // If installed cStatus would have a value "Installed" else empty
    oReg:Close()
    lStatus:=iif( cStatus == "Installed",.T.,.F.)

Return lStatus


Regards
Anser
User avatar
anserkk
 
Posts: 1331
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: obtain ODBC drivers installed

Postby Marc Vanzegbroeck » Sat Jun 15, 2013 3:30 pm

anserkk wrote:
Code: Select all  Expand view
if !CheckMySQL_ODBC_Status('MySQL ODBC 5.2a Driver')  // ODBC Driver installed or not
    MsgInfo("MySQL ODBC 5.2a Driver is not installed in this PC")
    Return NIL
Endif


*-----------------------------------*
Function CheckMySQL_ODBC_Status(cDriver)
*-----------------------------------*
    // cDriver can be either 'MySQL ODBC 3.51 Driver' OR 'MySQL ODBC 5.1 Driver'
    Local oReg,cStatus,lStatus:=.F.
   
    oReg  := TReg32():New( HKEY_LOCAL_MACHINE, "SOFTWARE\ODBC\ODBCINST.INI\ODBC Drivers" )
    cStatus:=""          
    cStatus:= oReg:Get( cDriver, cStatus ) // If installed cStatus would have a value "Installed" else empty
    oReg:Close()
    lStatus:=iif( cStatus == "Installed",.T.,.F.)

Return lStatus


Regards
Anser


Thanks Anser,

I notice than on a 64bit PC you need use this key.
Code: Select all  Expand view
oReg  := TReg32():New( HKEY_LOCAL_MACHINE, "SOFTWARE\Wow6432Node\ODBC\ODBCINST.INI\ODBC Drivers" )
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Marc Vanzegbroeck
 
Posts: 1157
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: obtain ODBC drivers installed

Postby nageswaragunupudi » Mon Jun 17, 2013 1:44 am

When we make a generic application/library can we assume every user can access registry? It is common that many net work administrators severely restrict rights of network users.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10308
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: obtain ODBC drivers installed

Postby James Bott » Mon Jun 17, 2013 2:22 am

Rao,

When we make a generic application/library can we assume every user can access registry? It is common that many net work administrators severely restrict rights of network users.


But can't all programs read the registry? It seems that most programs need to be able to do this. It would be a problem if only the programs administrators were using could.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: obtain ODBC drivers installed

Postby nageswaragunupudi » Mon Jun 17, 2013 3:09 am

But can't all programs read the registry? It seems that most programs need to be able to do this. It would be a problem if only the programs administrators were using could.

Not administrators only. Normally all users can read, unless access is restricted. I know of many corporate networks where the network administrators are so conservative to restrict access severely. Personally I disagree with such undue and unnecessary over-cautious approach, but our scope is limited to providing something which works even in such environments.

Well we always have this TRY/CATCH approach even to deal with such situations. :D So we can first try accessing registry, which will succeed in a great majority of the cases and if not we always have fall back options.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10308
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: obtain ODBC drivers installed

Postby lucasdebeltran » Mon Jun 17, 2013 7:40 am

Hi,

Thank you for your great advice.

Best regards
Muchas gracias. Many thanks.

Un saludo, Best regards,

Harbour 3.2.0dev, Borland C++ 5.82 y FWH 13.06 [producción]

Implementando MSVC 2010, FWH64 y ADO.

Abandonando uso xHarbour y SQLRDD.
User avatar
lucasdebeltran
 
Posts: 1303
Joined: Tue Jul 21, 2009 8:12 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Natter and 33 guests