Jump to content

Recommended Posts

Posted

I use the UDF from Prog@ndy and have no issues  https://www.autoitscript.com/forum/index.php?showtopic=85617
 

; (put libmysql.dll and mysql.au3 into the sktipt directory)
#include ".\mysql.au3"

Func _connectDB()
    Local $DB_HOST = "xxxxx"
    Local $DB_PORT = "12345"
    Local $DB_DATABASE = "dddddd"
    Local $DB_USER = "uuuuuu"
    Local $DB_PASS = "pppppp"

    _MySQL_InitLibrary()
    If @error Then Return SetError(1, 0, 0)

    Local $connection = _MySQL_Init()
    If $connection = 0 Then Return SetError(2, 0, 0)

    Local $connected = _MySQL_Real_Connect($connection, $DB_HOST, $DB_USER, $DB_PASS, $DB_DATABASE, $DB_PORT)
    If $connected = 0 Then Return SetError(3, 0, 0)

    Return SetError(0, 0, $connection)
EndFunc

Func _disconnectDB($connection)
    _MySQL_Close($connection)
    _MySQL_EndLibrary()
EndFunc   ;==>_CloseDatabase


 

Rule #1: Always do a backup         Rule #2: Always do a backup (backup of rule #1)

Posted (edited)

I cannot find the link to the udf, the german link that is suppose to work does bring me to the udf


image.thumb.png.8df6e218e4a8725def34c77e82fe17f7.png


 and the original link also doesn't work

Edited by 20Ice18

❤️

Posted
  On 6/15/2023 at 8:28 AM, 20Ice18 said:

this in console 

 

==> The requested action with this object has failed.:
$oConnection.Open($sConnectionString)
$oConnection^ ERROR

 

Expand  

It is quite strange.
I think problem occurs in _ADO_Connection_Create()

try this modified code:

;includes...
;variables...

_ADO_ComErrorHandler_UserFunction(_ADO_COMErrorHandler)
_Example2()

Func _Example2()
    Local $oConnection = _ADO_Connection_Create()
    If @error Then ConsoleWrite("! ---> @error=" & @error & "  @extended=" & @extended & _
            " : _ADO_Connection_Create()" & @CRLF)
    ConsoleWrite('VarGetType=' & VarGetType($oConnection) & @CRLF)
    ConsoleWrite('ObjName=' & ObjName($oConnection) & @CRLF)
    
    Local $sConnectionString = "Server=" & $sServer  & "; Database=" & $sDatabase & "; Uid=" & $sUsername & "; Pwd=" & $sPassword & ";"
    _ADO_Connection_OpenConString($oConnection, $sConnectionString)
    If @error Then 
        Return SetError(@error, @extended, $ADO_RET_FAILURE)
    Else 
        MsgBox(1,  ":D",  "working")
    EndIf

    ; CleanUp
    _ADO_Connection_Close($oConnection)
    $oConnection = Null

    _ADO_REcordset_Display($aRecordset, $sTableName & '  - Recordset content')

EndFunc    ;==>_Example2

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted
  On 6/15/2023 at 10:02 AM, mLipok said:

try this modified code

Expand  

this was in console this time:

Starting file temprun.au3...

VarGetType=Object
ObjName=_Connection
"ADO.au3" (731) : ==> The requested action with this object has failed.:
$oConnection.Open($sConnectionString)
$oConnection^ ERROR

temprun.au3 -> Exit Code: 1 (Runtime: 2.81 sec)

 

❤️

Posted (edited)

please try also:

    ConsoleWrite('VarGetType=' & VarGetType($oConnection) & @CRLF)
    ConsoleWrite('IsObj=' & IsObj($oConnection) & @CRLF)
    ConsoleWrite('ObjName=' & ObjName($oConnection, $OBJ_NAME) & @CRLF)
    ConsoleWrite('ObjName=' & ObjName($oConnection, $OBJ_STRING) & @CRLF)
    ConsoleWrite('ObjName=' & ObjName($oConnection, $OBJ_PROGID) & @CRLF)

 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted
#includes...
#variables...

_ADO_ComErrorHandler_UserFunction(_ADO_COMErrorHandler)
_Example2()

Func _Example2()
    Local $oConnection = _ADO_Connection_Create()
    If @error Then ConsoleWrite("! ---> @error=" & @error & "  @extended=" & @extended & _
            " : _ADO_Connection_Create()" & @CRLF)
    ConsoleWrite('VarGetType=' & VarGetType($oConnection) & @CRLF)
    ConsoleWrite('ObjName=' & ObjName($oConnection) & @CRLF)
    ConsoleWrite('VarGetType=' & VarGetType($oConnection) & @CRLF)
    ConsoleWrite('ObjName=' & ObjName($oConnection, $OBJ_NAME) & @CRLF)
    ConsoleWrite('ObjName=' & ObjName($oConnection, $OBJ_STRING) & @CRLF)
    ConsoleWrite('ObjName=' & ObjName($oConnection, $OBJ_PROGID) & @CRLF)
    
    Local $sConnectionString = "Server=" & $sServer  & "; Database=" & $sDatabase & "; Uid=" & $sUsername & "; Pwd=" & $sPassword & ";"
    _ADO_Connection_OpenConString($oConnection, $sConnectionString)
    If @error Then 
        Return SetError(@error, @extended, $ADO_RET_FAILURE)
    Else 
        MsgBox(1,  ":D",  "working")
    EndIf

    ; CleanUp
    _ADO_Connection_Close($oConnection)
    $oConnection = Null

    _ADO_REcordset_Display($aRecordset, $sTableName & '  - Recordset content')

EndFunc    ;==>_Example2



got this in console :
 

VarGetType=Object
ObjName=_Connection
VarGetType=Object
ObjName=_Connection
ObjName=
ObjName=ADODB.Connection.6.0
"ADO.au3" (731) : ==> The requested action with this object has failed.:
$oConnection.Open($sConnectionString)
$oConnection^ ERROR

 

❤️

Posted

I usually work with the native SQL Server driver. Check if it's installed (the result of Get_ODBC_Drivers() function) and then try this code and let me know the result:

#include <Array.au3>

$oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc")

$Username = 'sa'
$Password = '<password>'

_ArrayDisplay(Get_ODBC_Drivers())

Local $oADODB = ObjCreate('ADODB.Connection')
;~ $oADODB.Open('Provider=SQLNCLI11;Server=localhost;Database=master;Integrated Security=SSPI;')    ; Windows authentication
$oADODB.Open('Provider=SQLNCLI11;Server=localhost;Database=master;', $Username, $Password)      ; SQL Server authentication
$oRowset = $oADODB.Execute('SELECT TOP 5 * FROM sys.all_columns')
$aData = $oRowset.GetRows()

_ArrayDisplay($aData)

Func _ErrFunc($oError)
    ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _
            @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _
            @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _
            @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _
            @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _
            @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _
            @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _
            @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _
            @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _
            @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF)
EndFunc

Func Get_ODBC_Drivers($x64 = False)
    Local $sDrivers, $sDriver, $iInstance = 1
    Do
        $sDriver = RegEnumVal('HKLM' & ($x64 ? '64' : '') & '\SOFTWARE\ODBC\ODBCINST.INI\ODBC Drivers', $iInstance)
        If $sDriver Then $sDrivers &= $sDriver & Chr(1)
        $iInstance += 1
    Until Not $sDriver
    Return StringSplit(StringTrimRight($sDrivers, 1), Chr(1))
EndFunc

 

Posted (edited)
  On 6/15/2023 at 12:50 PM, Andreik said:
Provider=SQLNCLI11
Expand  

its unknown provider:

temprun.au3 (14) : ==> COM Error intercepted !
    err.number is:      0x80020009
    err.windescription: Exception occurred.

    err.description is:     Provider cannot be found. It may not be properly installed.
    err.source is:      ADODB.Connection
    err.helpfile is:    C:\Windows\HELP\ADO270.CHM
    err.helpcontext is:     1240655
    err.lastdllerror is:    0
    err.scriptline is:  14
    err.retcode is:     0x800A0E7A

temprun.au3 (15) : ==> COM Error intercepted !
    err.number is:      0x80020009
    err.windescription: Exception occurred.

    err.description is:     Operation is not allowed when the object is closed.
    err.source is:      ADODB.Connection
    err.helpfile is:    C:\Windows\HELP\ADO270.CHM
    err.helpcontext is:     1240653
    err.lastdllerror is:    0
    err.scriptline is:  15
    err.retcode is:     0x800A0E78

temprun.au3 (16) : ==> COM Error intercepted !
    err.number is:      0x000000A9
    err.windescription: Variable must be of type 'Object'.
    err.description is:     
    err.source is:      
    err.helpfile is:    
    err.helpcontext is:     
    err.lastdllerror is:    0
    err.scriptline is:  16
    err.retcode is:     0x00000000


 

Edited by 20Ice18

❤️

  • Solution
Posted (edited)

https://dev.mysql.com/downloads/file/?id=517870     32-bit driver for 32bit autoit

or direct link https://dev.mysql.com/get/Downloads/Connector-ODBC/8.0/mysql-connector-odbc-8.0.33-win32.msi

 

#include "ADO.au3"
#include <Array.au3>
#include <MsgBoxConstants.au3>
#include <AutoItConstants.au3>

_Example_ListProperties()

Func _Example_ListProperties()
    Local $sConnectionString = _ADO_ConnectionString_MySQL('root', '', 'test', 'MySQL ODBC 8.0 ANSI Driver', 'localhost', '3306')
    Local $oConnection = _ADO_Connection_Create()
    _ADO_Connection_OpenConString($oConnection, $sConnectionString)
    If @error Then MsgBox(0,@error,@extended)
    Local $aRecordset = _ADO_Execute($oConnection, "SELECT * FROM testtable", True)
    If @error Then MsgBox(0,@error,@extended)
    _ADO_Connection_Close($oConnection)
    $oConnection = Null
    _ADO_Recordset_Display($aRecordset, 'Recordset content')
    If @error Then MsgBox(0,@error,@extended)
EndFunc   ;==>_Example_2_RecordsetDisplay

image.thumb.png.04d9ee141b04dc3cbb4df71bc3c1dd95.png

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)

  Reveal hidden contents


460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Posted (edited)

next snippet to test:

#include <Array.au3>
#include "ADO.au3"

#variables...

$oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc")
_ArrayDisplay(Get_ODBC_Drivers())

Local $sConnectionString = "Server=" & $sServer  & "; Database=" & $sDatabase & "; Uid=" & $sUsername & "; Pwd=" & $sPassword & ";"
Local $oConnection = ObjCreate('ADODB.Connection')
$oConnection.Open($sConnectionString)      ; SQL Server authentication
Local $s_QUERY = 
$oRowset = $oConnection.Execute($s_QUERY)
$aData = $oRowset.GetRows()

_ArrayDisplay($aData, 'TEST 1')

$aData = _ADO_Execute($oConnection, '$s_QUERY', True,True)
_ArrayDisplay($aData, 'TEST 2')

Func _ErrFunc($oError)
    ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _
            @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _
            @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _
            @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _
            @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _
            @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _
            @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _
            @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _
            @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _
            @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF)
EndFunc

Func Get_ODBC_Drivers($x64 = False)
    Local $sDrivers, $sDriver, $iInstance = 1
    Do
        $sDriver = RegEnumVal('HKLM' & ($x64 ? '64' : '') & '\SOFTWARE\ODBC\ODBCINST.INI\ODBC Drivers', $iInstance)
        If $sDriver Then $sDrivers &= $sDriver & Chr(1)
        $iInstance += 1
    Until Not $sDriver
    Return StringSplit(StringTrimRight($sDrivers, 1), Chr(1))
EndFunc

EDIT:
here I use modfied @Andreik example.

As you can see we are using the same $oConnection but in different ways we get data.

Local $sConnectionString = "Server=" & $sServer  & "; Database=" & $sDatabase & "; Uid=" & $sUsername & "; Pwd=" & $sPassword & ";"
Local $oConnection = ObjCreate('ADODB.Connection')
$oConnection.Open($sConnectionString)      ; SQL Server authentication
Local $s_QUERY = 
$oRowset = $oConnection.Execute($s_QUERY)
$aData = $oRowset.GetRows()

_ArrayDisplay($aData, 'TEST 1')

$aData = _ADO_Execute($oConnection, '$s_QUERY', True,True)
_ArrayDisplay($aData, 'TEST 2')

 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted
  On 6/15/2023 at 1:21 PM, mLipok said:

next snippet to test:

Expand  

output:
 

temprun.au3 (13) : ==> COM Error intercepted !
    err.number is:      0x80020009
    err.windescription: Exception occurred.

    err.description is:     [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
    err.source is:      Microsoft OLE DB Provider for ODBC Drivers
    err.helpfile is:    
    err.helpcontext is:     0
    err.lastdllerror is:    0
    err.scriptline is:  13
    err.retcode is:     0x80004005

temprun.au3 (15) : ==> COM Error intercepted !
    err.number is:      0x80020009
    err.windescription: Exception occurred.

    err.description is:     Operation is not allowed when the object is closed.
    err.source is:      ADODB.Connection
    err.helpfile is:    C:\Windows\HELP\ADO270.CHM
    err.helpcontext is:     1240653
    err.lastdllerror is:    0
    err.scriptline is:  15
    err.retcode is:     0x800A0E78

temprun.au3 (16) : ==> COM Error intercepted !
    err.number is:      0x000000A9
    err.windescription: Variable must be of type 'Object'.
    err.description is:     
    err.source is:      
    err.helpfile is:    
    err.helpcontext is:     
    err.lastdllerror is:    0
    err.scriptline is:  16
    err.retcode is:     0x00000000

temprun.au3 (886) : ==> COM Error intercepted !
    err.number is:      0x80020009
    err.windescription: Exception occurred.

    err.description is:     Operation is not allowed when the object is closed.
    err.source is:      ADODB.Connection
    err.helpfile is:    C:\Windows\HELP\ADO270.CHM
    err.helpcontext is:     1240653
    err.lastdllerror is:    0
    err.scriptline is:  886
    err.retcode is:     0x800A0E78

 

❤️

Posted
  On 6/15/2023 at 1:26 PM, 20Ice18 said:
	err.description is: 	[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
	err.source is: 		Microsoft OLE DB Provider for ODBC Drivers
	err.helpfile is: 	
Expand  

so we have to use:

Driver={MySQL ODBC 5.2 ANSI Driver};Server=myServerAddress;Port=3306;Database=myDataBase;User=myUsername;Password=myPassword;Option=3;

instead:

https://www.connectionstrings.com/mysql/

Specifying TCP port

Server=myServerAddress;Port=1234;Database=myDataBase;Uid=myUsername;Pwd=myPassword;

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)
  On 6/15/2023 at 1:20 PM, bogQ said:

https://dev.mysql.com/downloads/file/?id=517870     32-bit driver for 32bit autoit

 

Expand  

so we had to check this snippet:

#include <Array.au3>
#include "ADO.au3"

#variables...

Local $s_QUERY = '' ; your query

$oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc")
_ArrayDisplay(Get_ODBC_Drivers())

Local $sDriver = "MySQL ODBC 8.0 ANSI Driver" ;https://dev.mysql.com/downloads/file/?id=517870     32-bit driver for 32bit autoit
Local $sConnectionString = "Driver=" & $sDriver & ";" &"Server=" & $sServer  & "; Database=" & $sDatabase & "; Uid=" & $sUsername & "; Pwd=" & $sPassword & ";"
Local $oConnection = ObjCreate('ADODB.Connection')
$oConnection.Open($sConnectionString)      ; SQL Server authentication
$oRowset = $oConnection.Execute($s_QUERY)
$aData = $oRowset.GetRows()

_ArrayDisplay($aData, 'TEST 1')

$aData = _ADO_Execute($oConnection, '$s_QUERY', True,True)
_ArrayDisplay($aData, 'TEST 2')

Func _ErrFunc($oError)
    ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _
            @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _
            @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _
            @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _
            @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _
            @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _
            @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _
            @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _
            @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _
            @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF)
EndFunc

Func Get_ODBC_Drivers($x64 = False)
    Local $sDrivers, $sDriver, $iInstance = 1
    Do
        $sDriver = RegEnumVal('HKLM' & ($x64 ? '64' : '') & '\SOFTWARE\ODBC\ODBCINST.INI\ODBC Drivers', $iInstance)
        If $sDriver Then $sDrivers &= $sDriver & Chr(1)
        $iInstance += 1
    Until Not $sDriver
    Return StringSplit(StringTrimRight($sDrivers, 1), Chr(1))
EndFunc

 

REMARK: without testing ... I have no access to MySQL even not saving this file and not testing with TIDY/AU3check

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted
  On 6/15/2023 at 12:59 PM, 20Ice18 said:

its unknown provider:

temprun.au3 (14) : ==> COM Error intercepted !
    err.number is:      0x80020009
    err.windescription: Exception occurred.

    err.description is:     Provider cannot be found. It may not be properly installed.
    err.source is:      ADODB.Connection
    err.helpfile is:    C:\Windows\HELP\ADO270.CHM
    err.helpcontext is:     1240655
    err.lastdllerror is:    0
    err.scriptline is:  14
    err.retcode is:     0x800A0E7A

temprun.au3 (15) : ==> COM Error intercepted !
    err.number is:      0x80020009
    err.windescription: Exception occurred.

    err.description is:     Operation is not allowed when the object is closed.
    err.source is:      ADODB.Connection
    err.helpfile is:    C:\Windows\HELP\ADO270.CHM
    err.helpcontext is:     1240653
    err.lastdllerror is:    0
    err.scriptline is:  15
    err.retcode is:     0x800A0E78

temprun.au3 (16) : ==> COM Error intercepted !
    err.number is:      0x000000A9
    err.windescription: Variable must be of type 'Object'.
    err.description is:     
    err.source is:      
    err.helpfile is:    
    err.helpcontext is:     
    err.lastdllerror is:    0
    err.scriptline is:  16
    err.retcode is:     0x00000000


 

Expand  

Install it :rolleyes: or let us know what drivers you already have.

Posted (edited)

@mLipok about this line dono if itl work with no {}

so from

$sDriver = "MySQL ODBC 8.0 ANSI Driver"

to

$sDriver = "{MySQL ODBC 8.0 ANSI Driver}"

coz of clean in string usage?

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)

  Reveal hidden contents


460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Posted
  On 6/15/2023 at 1:35 PM, mLipok said:

so we had to check this snippet:

#include <Array.au3>
#include "ADO.au3"

#variables...

$oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc")
_ArrayDisplay(Get_ODBC_Drivers())

Local $sDriver = "MySQL ODBC 8.0 ANSI Driver" ;https://dev.mysql.com/downloads/file/?id=517870     32-bit driver for 32bit autoit
Local $sConnectionString = "Driver=" & $sDriver & ";" &"Server=" & $sServer  & "; Database=" & $sDatabase & "; Uid=" & $sUsername & "; Pwd=" & $sPassword & ";"
Local $oConnection = ObjCreate('ADODB.Connection')
$oConnection.Open($sConnectionString)      ; SQL Server authentication
Local $s_QUERY = 
$oRowset = $oConnection.Execute($s_QUERY)
$aData = $oRowset.GetRows()

_ArrayDisplay($aData, 'TEST 1')

$aData = _ADO_Execute($oConnection, '$s_QUERY', True,True)
_ArrayDisplay($aData, 'TEST 2')

Func _ErrFunc($oError)
    ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _
            @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _
            @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _
            @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _
            @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _
            @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _
            @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _
            @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _
            @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _
            @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF)
EndFunc

Func Get_ODBC_Drivers($x64 = False)
    Local $sDrivers, $sDriver, $iInstance = 1
    Do
        $sDriver = RegEnumVal('HKLM' & ($x64 ? '64' : '') & '\SOFTWARE\ODBC\ODBCINST.INI\ODBC Drivers', $iInstance)
        If $sDriver Then $sDrivers &= $sDriver & Chr(1)
        $iInstance += 1
    Until Not $sDriver
    Return StringSplit(StringTrimRight($sDrivers, 1), Chr(1))
EndFunc

 

Expand  

I still don't get this confusion. It's SQL Server or MySQL? They are not the same.

Posted
  On 6/15/2023 at 1:38 PM, Andreik said:

Install it :rolleyes: or let us know what drivers you already have.

Expand  

I have 32 bit ODBC Driver 17 for SQL Server and SQL Server and 64 bit MySQL ODBC 8.0 ANSI Driver, MySQL ODBC 8.0 Unicode Driver, ODBC Driver 17 for SQL Server and SQL Server

I'm afraid that I  was using MySQL ODBC 8.0 ANSI Driver 64 bit on 32 bit Autoit. 

❤️

Posted (edited)

I'm up to install 32 bit driver instead and I will update then 
just have to fix this issue first: 
image.png.adff8fbcc52df01937df3e201873420c.png

Edited by 20Ice18

❤️

Posted (edited)

For MySQL I use MySQL ODBC 8.0 Unicode Driver and connection string:

  Quote

Driver={MySQL ODBC 8.0 Unicode Driver};Server=<server>;Database=<database>;User=<username>;Password=<password>;Port=3306;Option=10;

Expand  

But again, you must have the driver that you use installed. Use this code to list the installed drivers and show us the result.

$aDriver = Get_ODBC_Drivers()

For $Index = 1 To $aDriver[0]
    ConsoleWrite($aDriver[$Index] & @CRLF)
Next

Func Get_ODBC_Drivers($x64 = False)
    Local $sDrivers, $sDriver, $iInstance = 1
    Do
        $sDriver = RegEnumVal('HKLM' & ($x64 ? '64' : '') & '\SOFTWARE\ODBC\ODBCINST.INI\ODBC Drivers', $iInstance)
        If $sDriver Then $sDrivers &= $sDriver & Chr(1)
        $iInstance += 1
    Until Not $sDriver
    Return StringSplit(StringTrimRight($sDrivers, 1), Chr(1))
EndFunc

 

Edited by Andreik

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...