"Autoit oracle connect"의 두 판 사이의 차이
DB CAFE
(→Oracle OLEDB for Autoit) |
|||
(같은 사용자의 중간 판 9개는 보이지 않습니다) | |||
3번째 줄: | 3번째 줄: | ||
https://www.autoitscript.com/forum/files/file/389-adoau3-udf/ | https://www.autoitscript.com/forum/files/file/389-adoau3-udf/ | ||
+ | |||
+ | https://www.autoitscript.com/forum/topic/37381-connect-oracle/#comment-277710 | ||
=== Oracle OLEDB for Autoit === | === Oracle OLEDB for Autoit === | ||
+ | {{틀:알림 | ||
+ | |내용= 2가지를 명심 할것 | ||
+ | # windows 가 64비트여도 odbc는 32비트용을 깔아라(64비트 깔면 개고생) | ||
+ | # Provider ~ 쓰지말고 DSN ~ 으로 써야 된다 | ||
+ | * 안됨 (삽질의 시작) Provider | ||
+ | *:<source lang=sql> .ConnectionString =("Provider='OraOLEDB.Oracle';Data Source='TNS NAME HERE';User Id='XXXX';Password='XXXXX';") </source> | ||
+ | * 해결 (삽질 2일차 해결) DSN | ||
+ | *:<source lang=sql> .ConnectionString = ("DSN=orcl;DB=orcl;UID=dbcafe;PWD=xxxx;") </source> | ||
+ | }} | ||
+ | |||
<source lang=autoit> | <source lang=autoit> | ||
#include <GUIConstants.au3> | #include <GUIConstants.au3> | ||
21번째 줄: | 33번째 줄: | ||
; if Driver is used = "Driver={Microsoft ODBC for Oracle};Server=TNSnames_ora;Uid=demo;Pwd=demo;" then this is a DSN Less connector | ; if Driver is used = "Driver={Microsoft ODBC for Oracle};Server=TNSnames_ora;Uid=demo;Pwd=demo;" then this is a DSN Less connector | ||
; More Info for Oracle MS KB Q193332 | ; More Info for Oracle MS KB Q193332 | ||
− | .ConnectionString =("Provider='OraOLEDB.Oracle';Data Source='TNS NAME HERE';User Id='XXXX';Password='XXXXX';") | + | .ConnectionString = ("DSN=orcl;DB=orcl;UID=dbcafe;PWD=xxxx;") |
+ | ;~ .ConnectionString =("Provider='OraOLEDB.Oracle';Data Source='TNS NAME HERE';User Id='XXXX';Password='XXXXX';") | ||
.Open | .Open | ||
EndWith | EndWith |
2024년 6월 22일 (토) 11:11 기준 최신판
thumb_up 추천메뉴 바로가기
- DBA { Oracle DBA 명령어 > DBA 초급 과정 > DBA 고급 과정 }
- 튜닝 { 오라클 튜닝 목록 }
- 모델링 { 데이터 모델링 가이드 }
1 참고 사이트[편집]
https://www.autoitscript.com/forum/topic/51952-_sqlau3-adodbconnection/
https://www.autoitscript.com/forum/files/file/389-adoau3-udf/
https://www.autoitscript.com/forum/topic/37381-connect-oracle/#comment-277710
2 Oracle OLEDB for Autoit[편집]
assignment 2가지를 명심 할것
- windows 가 64비트여도 odbc는 32비트용을 깔아라(64비트 깔면 개고생)
- Provider ~ 쓰지말고 DSN ~ 으로 써야 된다
- 안됨 (삽질의 시작) Provider
.ConnectionString =("Provider='OraOLEDB.Oracle';Data Source='TNS NAME HERE';User Id='XXXX';Password='XXXXX';")
- 해결 (삽질 2일차 해결) DSN
.ConnectionString = ("DSN=orcl;DB=orcl;UID=dbcafe;PWD=xxxx;")
#include <GUIConstants.au3>
Dim $oMyError
; Initializes COM handler
$oMyError = ObjEvent("AutoIt.Error","MyErrFunc")
$ado = ObjCreate( "ADODB.Connection" ) ; Create a COM ADODB Object with the Beta version
With $ado
; 'Set data source - for OLEDB this is a tns alias, for ODBC it can be 'either a tns alias or a DSN.
; If "provider" is used this means that the ODBC connections is used via DSN.
; if Driver is used = "Driver={Microsoft ODBC for Oracle};Server=TNSnames_ora;Uid=demo;Pwd=demo;" then this is a DSN Less connector
; More Info for Oracle MS KB Q193332
.ConnectionString = ("DSN=orcl;DB=orcl;UID=dbcafe;PWD=xxxx;")
;~ .ConnectionString =("Provider='OraOLEDB.Oracle';Data Source='TNS NAME HERE';User Id='XXXX';Password='XXXXX';")
.Open
EndWith
$adors = ObjCreate( "ADODB.RecordSet" ) ; Create a Record Set to handles SQL Records
With $adors
.ActiveConnection = $ado
;.CursorLocation = "adUseClient"
;.LockType = "adLockReadOnly" ; Set ODBC connection read only
.Source = "select * from TABLE NAME HERE"
.Open
EndWith
While not $adors.EOF
For $i = 0 To $adors.Fields.Count - 1
ConsoleWrite( $adors.Fields( $i ).Value & @TAB ) ; Columns in the AutoIt console use Column Name or Index
Next
ConsoleWrite(@CR)
$adors.MoveNext ; Go to the next record
WEnd
; This COM error Handler
Func MyErrFunc()
$HexNumber=hex($oMyError.number,8)
Msgbox(0,"AutoItCOM Test","We intercepted a COM Error !" & @CRLF & @CRLF & _
"err.description is: " & @TAB & $oMyError.description & @CRLF & _
"err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _
"err.number is: " & @TAB & $HexNumber & @CRLF & _
"err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _
"err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _
"err.source is: " & @TAB & $oMyError.source & @CRLF & _
"err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _
"err.helpcontext is: " & @TAB & $oMyError.helpcontext _
)
SetError(1) ; to check for after this function returns
Endfunc