Search the Community
Showing results for tags 'ado.udf'.
-
Hello, I am facing difficulties connecting to SQL Server using AutoIt and would greatly appreciate some help. I have already tried using the MySQL UDF (User Defined Function) and the latest ODBC connect driver from the provided link here However, I have been unable to establish a successful connection. I have come across posts about this topic, but most of them are over 10 years old, and I suspect they might be outdated. I even attempted to change the driver name in the https://www.autoitscript.com/forum/applications/core/interface/file/attachment.php?id=15889 UDF from "MySQL ODBC 3.51 Driver" to the latest driver I obtained, but I still haven't been able to connect. If anyone has any guidance, suggestions, or updated information on connecting to SQL Server using AutoIt, I would be grateful for your assistance. Thank you in advance for your help! Best regards, Here is a code im trying to connect with... Func _MySQLEnd($oConnectionObj) If IsObj($oConnectionObj) Then $oConnectionObj.close Return 1 Else SetError(1) Return 0 EndIf EndFunc ;==>_MySQLEnd Func _MySQLConnect($sUsername, $sPassword, $sDatabase, $sServer, $sDriver = "{MySQL ODBC 3.51 Driver}", $iPort=3306) Local $v = StringMid($sDriver, 2, StringLen($sDriver) - 2) Local $key = "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\ODBC Drivers", $val = RegRead($key, $v) If @error or $val = "" Then SetError(2) Return 0 EndIf $ObjConn = ObjCreate("ADODB.Connection") $Objconn.open ("DRIVER=" & $sDriver & ";SERVER=" & $sServer & ";DATABASE=" & $sDatabase & ";UID=" & $sUsername & ";PWD=" & $sPassword & ";PORT="&$iPort) If @error Then SetError(1) Return 0 Else Return $ObjConn EndIf EndFunc ;==>_MySQLConnect ; Example usage Local $host = "host" Local $user = "user" Local $password = "password" Local $database = "database" Local $conn = _MySQLConnect($host, $user, $password, $database) If $conn Then MsgBox(64, "Success", "Connected to MySQL database successfully!") ; Disconnect from the MySQL server _MySQLEnd($conn) else MsgBox(64, "error ", "connection failed") EndIf
-
Hello Guys, I am running the Ado example script, if I run this line, it runs without errors : Local $sConnectionString = 'DRIVER={' & $sDriver & '};SERVER=' & $sServer & ';DATABASE=' & $sDatabase & ';UID=' & $sUser & ';PWD=' & $sPassword & ';' But when I try the windows auth one , it failed everytime : Func _Example_MSSQL_WindowsAuthorization() Local $sDatabase = 'AdventureWorks2016' Local $sServer = 'SQLSRV' _Example_5_MSSQL_WinAuth($sServer, $sDatabase, "Select * from Person.Address") EndFunc here is the error : ADO.au3 v.2.1.16 BETA (1204) : ==> COM Error intercepted ! $oADO_Error.description is: Provider cannot be found. It may not be properly installed. $oADO_Error.windescription: Exception occurred. $oADO_Error.number is: 80020009 $oADO_Error.lastdllerror is: 0 $oADO_Error.scriptline is: 1204 $oADO_Error.source is: ADODB.Connection $oADO_Error.helpfile is: C:\Windows\HELP\ADO270.CHM $oADO_Error.helpcontext is: 1240655 By the way, I have 64x windows server 2016 with SQL Server , I already installed the odbc my sql connector, any thought on this will be greatly appreciate it.
-
This thread splits off from this part of the conversation: I do not think that this related to the actual ADO.UDF, which does connect successfully to the default RDB$DATABASE. Question is on the actual DDL to use to (a) create database and (b) create table. I cannot create database with ADO.UDF, that may require ADOX and is receiving attention. I have tested SQL queries on PostgreSQL and SQLite which worked, but on the Firebird it just does nothing. Permissions perhaps? Although I use the same connection string... ; My AutoIt sConnectionString = DSN=Firebird;DATABASE=C:\AutoIt\ado_db\firebird\showDB_ado.fdb;SERVER=localhost;PORT=3050;UID=sysdba;PWD=masterkey; Local $new_fdb="CREATE TABLE drinks ( ID INTEGER PRIMARY KEY,NAME VARCHAR(100) NOT NULL ) ; " Local $qResult = _ADO_Execute($sConnectionString, $new_fdb) ConsoleWrite("$qResult " & $qResult & " * "& $new_fdb & " * Line: "& @ScriptLineNumber &@CRLF) ;============== ;Scite output $qResult -1 * CREATE TABLE drinks ( ID INTEGER PRIMARY KEY,NAME VARCHAR(100) NOT NULL ) ; * Line: 64 $qResult -1 Line: 76 I have tried "REcreate table..." as some sources indicate that it is the way to go. No success.
- 1 reply
-
- firebird sql
- ado.udf
-
(and 1 more)
Tagged with: