Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- rem Autor: Gladiston (hamacker) Santana sirhamacker em gmail.com
- rem Arquivo: fb_test_conn.cmd
- rem Objetivo: Testar conectividade com servidores firebird
- rem Se o resultdo da execucao do script nao exibir informacoes da conexao, entao
- rem o script falhou.
- rem PS: O formato deste arquivo deve ser ANSI Windows (CR/LF) caso contrario nao funcionará
- rem no ambiente de terminal do Windows.
- set fb3_connect="localhost:c:\caminho\para\o\database.fdb"
- set ISC_USER=SYSDBA
- set ISC_PASSWORD=masterkey
- set fb3_script=%temp%\temp_script_isql.$$$
- set fb3_isql="isql.exe"
- if exist "%ProgramFiles%\Firebird\Firebird_3_0\isql.exe" set fb3_isql=%ProgramFiles%\Firebird\Firebird_3_0\isql.exe
- if exist "%ProgramFiles(x86)%\Firebird\Firebird_3_0\isql.exe" set fb3_isql=%ProgramFiles(x86)%\Firebird\Firebird_3_0\isql.exe
- if not exist "%fb3_isql%" goto notfound
- rem ===
- rem === Nao altere mais nada daqui para baixo
- rem ===
- rem === criando o script ====
- echo -- %fb3_script% ; >"%fb3_script%"
- echo CONNECT %fb3_connect%;>>"%fb3_script%"
- echo set list on; >>"%fb3_script%"
- echo select * from mon$attachments where mon$attachment_id = current_connection; >>"%fb3_script%"
- echo show database; >>"%fb3_script%"
- echo quit; >>"%fb3_script%"
- rem === executando o script ====
- cls
- echo TESTE DE CONEXAO COM BASE DE DADOS
- echo ISQL: %fb3_isql%
- echo Temporary script: %fb3_script%
- echo Connect: %fb3_connect%
- echo UserName: %ISC_USER%
- echo Password: *****
- echo Cmd: "%fb3_isql%" -z -q -i "%fb3_script%"
- "%fb3_isql%" -z -q -i "%fb3_script%"
- set os_result=%ERRORLEVEL%
- set os_info=Successful execution
- if %os_result% LSS 0 set os_info=statement did not execute
- if %os_result% GTR 1 set os_info=System warning or information message
- if %os_result% GEQ 100 set os_info=No qualifying rows found, or end of current active set of rows reached
- echo ISQL Result: %os_info% (%os_result%)
- goto fim
- :notfound
- echo ajuste neste .cmd a variavel *fb3_isql* para que seja possivel encontrar o utilitario isql.exe do firebird.
- goto fim
- :fim
- if exist "%fb3_script%" del /q /f "%fb3_script%"
- pause
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement