FiveODBC Error Message

FiveODBC Error Message

Postby Compuin » Mon Dec 26, 2016 7:06 am

Saludos

Estoy tratando de conectar a una Base de Datos SQL Server 2008 R2 32 bits y tengo el siguiente error

FiveODBC Error Message
SQLDriverConnect error from TODbc:New() [#-1]

Mi version de windows es 64 bits
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: 1214
Joined: Tue Dec 28, 2010 1:29 pm
Location: Quebec, Canada

Re: FiveODBC Error Message

Postby Antonio Linares » Mon Dec 26, 2016 10:16 am

Por favor, muestra el código que usas para crear el objeto TOdbc
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42069
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: FiveODBC Error Message

Postby Compuin » Mon Dec 26, 2016 2:57 pm

FUNCTION CREATEDABASE()
LOCAL oOdbc
LOCAL cLogin:= "sa"
LOCAL cPass:= "123456"


oODbc:=TODBC():New("master", cLogin, cPass , .F. )

oOdbc:End()
oOdbc:=NIL

RETURN NIL
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: 1214
Joined: Tue Dec 28, 2010 1:29 pm
Location: Quebec, Canada

Re: FiveODBC Error Message

Postby Compuin » Mon Dec 26, 2016 4:50 pm

Con este ejemplo me da el mismo error

#include "FiveWin.ch"
#include "sql.ch"

//----------------------------------------------------------------//

function Main()

Local oDlg
Local aDsn
local cDsn, cName, cPass, cFile

SET _3DLOOK ON

aDsn := OdbcDsnEntries()
cName := ""
cPass := ""
cFile := ""

if len(aDsn) == 0
MsgAlert("You must create a ODBC DSN configuration from your control panel",;
"ODBC DSN selection")
return nil
endif

cDsn := aDsn[1]

DEFINE DIALOG oDlg RESOURCE "ODBCLOGIN"

REDEFINE COMBOBOX cDsn ID 101 ITEMS aDsn OF oDlg
REDEFINE GET cName ID 102 OF oDlg MEMO
REDEFINE GET cPass ID 103 OF oDlg MEMO
REDEFINE BUTTON ID IDOK OF oDlg ACTION OpenOdbc(cDsn, cName, cPass)
REDEFINE BUTTON ID IDCANCEL OF oDlg ACTION oDlg:End()

ACTIVATE DIALOG oDlg

return nil

STATIC FUNCTION OpenOdbc(cDsn, cName, cPass)

Local oOdbc, oDlg
local aFiles
local cTable
local lAsync

oOdbc := TOdbc():New(cDsn, cName, cPass)

If !oOdbc:lSuccess
oOdbc:ShowErrorList("ODBC session not successfully initialized, aborting...")
oOdbc:End()
return nil
Endif

CursorWait()
aFiles := oOdbc:GetTables("*", .F. )
CursorArrow()

if len(aFiles) == 0
MsgAlert("There are not tables on that database, aborting...",;
"ODBC Table selection")
oOdbc:End()
return nil
endif

cTable := aFiles[1]

DEFINE DIALOG oDlg RESOURCE "ODBCTABLE"

REDEFINE LISTBOX cTable ID 101 ITEMS aFiles OF oDlg ;
ON DBLCLICK OpenTable(cTable, oOdbc, oDlg, lAsync)

REDEFINE CHECKBOX lAsync ID 102 OF oDlg

REDEFINE BUTTON ID IDOK OF oDlg ;
ACTION OpenTable(cTable, oOdbc, oDlg, lAsync)

REDEFINE BUTTON ID IDCANCEL OF oDlg ;
ACTION oDlg:End()

oDlg:lhelpIcon := .f.

ACTIVATE DIALOG oDlg

oOdbc:End()

return nil

STATIC FUNCTION OpenTable(cTable, oOdbc, oDlg, lAsync)

local oDbf

oDbf := oOdbc:Query( "SELECT * FROM " + cTable )

oDbf:lDateAsStr := .t.

oDbf:Open()

if lAsync
oDbf:AutoFill(oDlg,,{|n| ChkCursor(n, oDbf, oDlg) } )
else
aSend(oDlg:aControls, "disable()")
oDlg:bValid := {|| .f. }
oDlg:BMMoved := {|| CursorWait()}
oDbf:Complete()
aSend(oDlg:aControls, "enable()")
oDlg:bValid := nil
oDlg:BMMoved := nil
oDbf:Gotop()
endif

Browse()

oDbf:End()

Return nil

STATIC FUNCTION ChkCursor(n, oDbf, oDlg)

local hWnd := GetActiveWindow()

if hWnd != oDlg:hWnd
if n == 0
SetWindowText(hWnd, "Rows completally retrieved: "+ Transform(oDbf:RecCount(), "999,999"))
else
SetWindowText(hWnd, "Rows retrieved so far: " + Transform(n, "999,999"))
endif
endif


return nil

procedure AppSys // Xbase++ requirement

return
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: 1214
Joined: Tue Dec 28, 2010 1:29 pm
Location: Quebec, Canada

Re: FiveODBC Error Message

Postby Compuin » Mon Dec 26, 2016 7:54 pm

Any advise?
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: 1214
Joined: Tue Dec 28, 2010 1:29 pm
Location: Quebec, Canada

Re: FiveODBC Error Message

Postby Antonio Linares » Mon Dec 26, 2016 9:50 pm

Por qué no usas ADO ?

Tienes que usar ODBC por alguna razón específica ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42069
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: FiveODBC Error Message

Postby Compuin » Mon Dec 26, 2016 9:56 pm

Si, ya tengo mucho codigo escrito en ODBC como para comenzar a cambiarlo por ADO
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: 1214
Joined: Tue Dec 28, 2010 1:29 pm
Location: Quebec, Canada

Re: FiveODBC Error Message

Postby Rick Lipkin » Mon Dec 26, 2016 10:06 pm

Forgive me if I am wrong .. ODBC and ADO use the same oRs code .. just the connection string is different ??

Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2663
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: FiveODBC Error Message

Postby Antonio Linares » Mon Dec 26, 2016 10:30 pm

Y a raiz de que cambios ha comenzado a fallar la conexión ?

Que has modificado ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42069
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: FiveODBC Error Message

Postby Compuin » Mon Dec 26, 2016 10:37 pm

La version....de fwh 2.7 a fwh13.12
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: 1214
Joined: Tue Dec 28, 2010 1:29 pm
Location: Quebec, Canada

Re: FiveODBC Error Message

Postby Compuin » Mon Dec 26, 2016 10:43 pm

La todbc cambia entre esas versiones?
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: 1214
Joined: Tue Dec 28, 2010 1:29 pm
Location: Quebec, Canada

Re: FiveODBC Error Message

Postby Antonio Linares » Tue Dec 27, 2016 9:57 am

Puedes comparar el código fuente del ODBC en ambas versiones y eso puede darte
la pista de que hay que modificar.

Si nos proporcionas un ejemplo pequeño, auto contenido, que podamos probar aquí, aún mejor.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42069
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: FiveODBC Error Message

Postby Compuin » Tue Dec 27, 2016 11:27 am

OK gracias, lo voy a preparar
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: 1214
Joined: Tue Dec 28, 2010 1:29 pm
Location: Quebec, Canada

Re: FiveODBC Error Message

Postby Baxajaun » Tue Dec 27, 2016 3:12 pm

Compuin,

puedes poner el fichero de recursos ? Estoy tratando de probar tu ejemplo con el driver ODBC de SQLite.

Muchas gracias.

Saludos
User avatar
Baxajaun
 
Posts: 968
Joined: Wed Oct 19, 2005 2:17 pm
Location: Gatika. Bizkaia

Re: FiveODBC Error Message

Postby Compuin » Tue Dec 27, 2016 3:30 pm

Hola

El ejemplo es de la carpeta c:\fwh\samples\testodbc.prg
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: 1214
Joined: Tue Dec 28, 2010 1:29 pm
Location: Quebec, Canada

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 79 guests