Jump to content

mssql secure connection


Recommended Posts

hello, this is my code

#include <_sql.au3>
#include <Array.au3>


$Handle= _SQL_Startup()

If $Handle= $SQL_ERROR Then
    ConsoleWrite(@CRLF & "Start Connect DesignMachine 3 Error" & @CRLF)
EndIf

$Host = "somehost.somehostsoftware.com,1117\somehost2\testplace"

If _sql_Connect($Handle, $Host, "Reports", "username", "pass") = $SQL_ERROR Then
    ConsoleWrite(@CRLF & "Start Connect DesignMachine 4 Error" & @CRLF)
    _SQL_Close()
EndIf

$Query = "SELECT COUNT (*) FROM [Reports].[dbo].[Pref]"

Local $hQuery, $Query_Rows
$hQuery = _SQL_Execute(-1 = -1, $Query)
$iRecords = _SQL_FetchData($hQuery, $Query_Rows)

ConsoleWrite("_SQL_GetTable2D - Error: " & @error)

If $iRecords = $SQL_OK Then

    ConsoleWrite(@CRLF & "successful. rows = " & $Query_Rows[0] & @CRLF)
Else
    ConsoleWrite(@CRLF & "Failed" & @CRLF)
EndIf

I get this error,

C:\Program Files\AutoIt3\Include\_sql.au3 (217) : ==> The requested action with this object has failed.:
$ADODBHandle.Open("DRIVER={SQL Server};SERVER=" & $server & ";DATABASE=" & $db & ";uid=" & $username & ";pwd=" & $password & ";")
$ADODBHandle.Open("DRIVER={SQL Server};SERVER=" & $server & ";DATABASE=" & $db & ";uid=" & $username & ";pwd=" & $password & ";")^ ERROR
Edited by TheCurrent
Link to comment
Share on other sites

Oh sorry maybe not then...I misunderstood the question.

If you start a VPN connection to the network your SQL server is on, then use the server's network name or internal IP, that should work (if it's an option) right? Who owns the SQL server?

Link to comment
Share on other sites

i need to confirm 3 things

1. is this in the correct format for external host?

$Host = "somehost.somehostsoftware.com,1117\somehost2\testplace"

2. Can autoit really do client side secure connection?

3. do i need need to use openssl to do this connection?

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...