Last morning I needed to know programmatically which were my DNS(s) for the current connection, and I searched for an API which fitted my needs... I just tried dnsqueryconfig, which shows the DNS(s) used, if you have manually selected them in the past.
The API is little tricky (or maybe I'm little rusty), so I decided to write a small UDF function to avoid a waste of time in the future... here you are.
; #FUNCTION# ==================================================================================================================== ; Name...........: _WinAPI_DnsQueryConfig ; Description ...: Retrieves the currently used DNS servers, if they were selected by user ; Syntax.........: _WinAPI_DnsQueryConfig() ; Return values .: On success it returns an array with the list of currently used DNS servers ; ; On failure it returns 0 and sets @error to non zero (these values are useful only for debugging reasons): ; |1 - DllCall error ; |2 - Generic error, DNS could be generated automatically ; Author ........: j0kky ; Modified ......: 1.0.0 14/11/2018 ; Link ..........: https://docs.microsoft.com/en-us/windows/desktop/api/windns/nf-windns-dnsqueryconfig ; =============================================================================================================================== Func _WinAPI_DnsQueryConfig() Local Const $DnsConfigDnsServerList = 6 Local $aRet = DllCall("Dnsapi.dll", "LONG", "DnsQueryConfig", "int", $DnsConfigDnsServerList, "dword", 0, "ptr", Null, "ptr", 0, "ptr", Null, "dword*", 0) If @error Then Return SetError(1, 0, 0) if $aRet <= 4 Then Return SetError(2, 0, 0) Local $tagBuffer = "" For $i = 1 To ($aRet / 4) $tagBuffer &= "dword;" Next Local $tBuffer = DllStructCreate($tagBuffer) $aRet = DllCall("Dnsapi.dll", "LONG", "DnsQueryConfig", "int", $DnsConfigDnsServerList, "dword", 0, "ptr", Null, "ptr", 0, "ptr", DllStructGetPtr($tBuffer), "dword*", $aRet) Local $aDNS[($aRet / 4) - 1] For $i = 2 to (UBound($aDNS) + 1) $aRet = DllCall("Ws2_32.dll", "str", "inet_ntoa", "dword", DllStructGetData($tBuffer, $i)) if @error Then Return SetError(1, 0, 0) $aDNS[$i - 2] = $aRet Next Return SetError(0, 0, $aDNS) EndFunc
I hope you can help me with this. I need to connect to a Database using Cloudera ODBC Driver for Impala. I installed the driver, created a User DSN (drona2) and tested it successfully (got the message: Successfully connected to data source!) but when I try to connect to the database using a Conneciton String, it simply didn't work.
I tried connecting to the database using the User DSN, I previously created, that has all parameters needed but got the following error:
$ProviderDatasource = 'DSN=drona2;'
$conn_Database = ObjCreate ("ADODB.Connection")
$conn_Database.ConnectionString = $ProviderDatasource
==> The requested action with this object has failed.:
Also I tried adding all parameters to my connection string as follows but also got the same error:
$ProviderDatasource = 'Driver=Cloudera ODBC Driver for Impala;Host=MyHost.domain.com;PORT=21050;AuthMech=3;UID=MyUserId@domain.com;PWD=MyPasswordc;Schema=default;SSL=1;AllowSelfSignedCerts=1;AllowHostNameCNMismatch=1;CheckCertRevocation=1;KrbFQDN=_HOTS;KrbServiceName=impala;ServicePrincipalCanonicalization=1'
I hope someone has used this driver successfully before and can shed some light here.
If you need additional information, let me know.
Im about to start making an autoit script that will read the current ODBC settings, have a drop down to select a different one which would then update the ODBC in windows to use the new settings.
Can anyone point me in the direction of how to read the ODBC 32 bit settings? are they in the registry?
Hi. I just released this software, we need it to override the DHCP server at work. Our DHCP server does not allow per-mac-address configuration, so I coded this utility to allow our developers to use our area's custom DNS server, regardless of what DHCP provides, and let them have the possibiity to quickly shift to automatic configuration when they take their laptops home.
An afternoon's worth of coding, and another half day for polish and release. Pretty old-school simplicity; it was a good excercise to finally code some UI using AutoIt.
Hope it's useful to someone.
I would love to have some help or guidance
I am able to Query from my database but I am not able to Update or insert etc because I lack the knowledge for it
this is my code for to retrieve some data from and works perfect
Dim $ueberschriften = "" Dim $anzahl = 0 Dim $dsncount = 1 Global $DSN = "MTXXV5" Global $Query = "Select * from VIEWS" Func SSSQL($SSQuery) ;SuperSonicSQL ConsoleWrite($SSQuery & @LF) $cmboVal = "" $adoCon = ObjCreate("ADODB.Connection") $adoCon.Open($DSN) $adoRs = ObjCreate("ADODB.Recordset") $adoSQL = $SSQuery $adoRs.CursorType = 2 $adoRs.LockType = 3 $adoRs.Open($adoSQL, $adoCon) With $adoRs Global $QueryAnswer = .GetRows EndWith Return $QueryAnswer EndFunc ;==>SSSQL and this is my failed attempt, The Query is correct but I want to able to use it in autoit instead of have to manual update or insert into flamerobin
$SS_SQL_Insert_or_Update = "INSERT INTO DETECTION (DNAME,DTYPE,WINNAME,AREA,COLOR,MOUSE) VALUES ('PopUpTradeInviteYes s ','SEARCH','XXX','175,240,550,240,65,228,82,234','5062478','0') " Func SSSQLIU($SS_SQL_Insert_or_Update) ;SuperSonicSQL :P $cmboVal = "" $adoCon = ObjCreate("ADODB.Connection") $adoCon.Open($DSN) $adoRs = ObjCreate("ADODB.Record") $adoSQL =$SS_SQL_Insert_or_Update ;~ $adoRs.CursorType = 2 $adoRs.LockType = 4 $adoRs.Open($adoSQL, $adoCon) ;~ With $adoRs ;~ Global $QueryAnswer = .GetRows ;~ EndWith ;~ Return $QueryAnswer EndFunc ;==>SSSQL I am at a total loss and I am just trying this at random but I am also going to sleep now
I would love to have some minor examples
"C:\_CC_V10_DetectionTAB.au3" (174) : ==> The requested action with this object has failed.: