Enabling SQL Developer with Sybase Jar (jtdc.jar) for PSM Connections to all users

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements

Welcome Idira to LIVEcommunity!

Our community just got stronger! Explore new identity security resources, connect with experts, and discover more ways to learn and collaborate.

Meet Idira

Enabling SQL Developer with Sybase Jar (jtdc.jar) for PSM Connections to all users

L4 Transporter

I have SQL developer used by the Oracle team via PSM with no issues. I am on-boarding Sybase team as well and they also want to use SQL Developer. There's jtdc.jar file which I have add in the SQL Developer Preferences to enable the sybase tab for connections to Sybase databases. But after adding the jar file, the Sybase tab is only visible to me. No other user including PSM Shadow users are able to see that tab.

Has anyone faced this issue before?

15 REPLIES 15

L2 Linker

Here is the script that I use, which most people here use:

 

#AutoIt3Wrapper_UseX64=n

Opt("MustDeclareVars", 1)

AutoItSetOption("WinTitleMatchMode", 1) ; Match prefix

;============================================================

;     PSM AutoIt SQL Developer Dispatcher

;============================================================

#include "PSMGenericClientWrapper.au3"

;=======================================

; Consts & Globals

;=======================================

Global Const $DISPATCHER_NAME  = "SQL Developer"

Global Const $CLIENT_EXECUTABLE  = "D:\sqldeveloper\sqldeveloper.exe"

Global Const $ERROR_MESSAGE_TITLE  = "PSM " & $DISPATCHER_NAME & " Dispatcher error message"

Global Const $LOG_MESSAGE_PREFIX = $DISPATCHER_NAME & " Dispatcher - "

Global $TargetUsername

Global $TargetPassword

Global $TargetAddress

Global $TargetPort

Global $TargetDatabase

Global $ConnectionClientPID = 0

;=======================================

; Code

;=======================================

Exit Main()

;=======================================

; Main

;=======================================

Func Main()

; Init PSM Dispatcher utils wrapper

ToolTip ("Initializing...")

LogWrite("successfully initialized tooltip")

if (PSMGenericClient_Init() <> $PSM_ERROR_SUCCESS) Then

Error(PSMGenericClient_PSMGetLastErrorString())

EndIf

LogWrite("successfully initialized Dispatcher Utils Wrapper")

; Get the dispatcher parameters

FetchSessionProperties()

LogWrite("mapping local drives")

if (PSMGenericClient_MapTSDrives() <> $PSM_ERROR_SUCCESS) Then

Error(PSMGenericClient_PSMGetLastErrorString())

EndIf

LogWrite("starting client application")

ToolTip ("Starting " & $DISPATCHER_NAME & "...")

$ConnectionClientPID = Run($CLIENT_EXECUTABLE)

if ($ConnectionClientPID == 0) Then

Error(StringFormat("Failed to execute process [%s]", $CLIENT_EXECUTABLE, @error))

EndIf

; Send PID to PSM as early as possible so recording/monitoring can begin

LogWrite("sending PID to PSM")

if (PSMGenericClient_SendPID($ConnectionClientPID) <> $PSM_ERROR_SUCCESS) Then

Error(PSMGenericClient_PSMGetLastErrorString())

EndIf

; ------------------

;Block all input for the remainder of the SQL Developer application interaction

 LogWrite("Starting Customized Plugin Code...")

Local $hWnd

$hWnd = WinWaitActive("[REGEXPTITLE:(Oracle SQL Developer.*|Confirm Import Preferences|Oracle Usage Tracking)]", "", 10)

 ; Check if the "Confirm Import Preferences" dialog is displayed

 If (WinGetTitle($hWnd) == "Confirm Import Preferences") Then

 ; Get rid of it

 Send("!n")

 ; Wait for the main window again

 $hWnd = WinWaitActive("[REGEXPTITLE:(Oracle SQL Developer.*|Oracle Usage Tracking)]", "", 10)

EndIf

 ; The "Oracle Usage Tracking" dialog may appear after the main window becomes active - we need to wait a bit and check again.

 Sleep(400)

$hWnd = WinWaitActive("[REGEXPTITLE:(Oracle SQL Developer.*|Oracle Usage Tracking)]", "", 10)

 ; Check if the "Oracle Usage Tracking" dialog is displayed

If (WinGetTitle($hWnd) == "Oracle Usage Tracking") Then

; Get rid of it

Send("{SPACE}")

Sleep(400)

Send("{ENTER}")

; Wait for the main window again

$hWnd = WinWaitActive("Oracle SQL Developer", "", 10)

EndIf

;if ($hWnd == 0) Then

;Error("SQL Developer initialization timed out")

;EndIf

;Sleep(1000)

;Send("!w")

;Send("!f")

;Send("{ENTER}")

;Sleep(3000)

;$hWnd = WinWaitActive("Oracle SQL Developer", "", 10)

;if ($hWnd == 0) Then

;Error("SQL Developer initialization timed out")

;EndIf

Send("{ENTER}")

WinWaitActive("Oracle SQL Developer : Start Page")

WinSetState("Oracle SQL Developer", "", @SW_MAXIMIZE)

Send("{ENTER}")

Sleep(100)

MouseClick("left", 15, 117)

$hWnd = WinWaitActive("New / Select Database Connection", "", 5) ; Should not take more than a second to appear

if ($hWnd == 0) Then

Error("Failed to click on connection button")

EndIf

Send("PSM UC [" & $TargetUsername & "@" & $TargetAddress & "]")

Sleep(100)

Send("{TAB}")

Sleep(100)

Send($TargetUsername)

Sleep(100)

Send("{TAB}")

Sleep(1000)

Send($TargetPassword, 1)

Sleep(100)

Send("{TAB}")

Sleep(100)

Send("{TAB}")

Sleep(100)

Send("{TAB}")

Sleep(100)

Send("{TAB}")

Sleep(100)

Send("{TAB}")

Sleep(100)

Send($TargetAddress)

Sleep(100)

Send("{TAB}")

Sleep(100)

Send($TargetPort)

Sleep(100)

Send("{TAB}")

Sleep(100)

Send("{TAB}")

Sleep(100)

Send("{TAB}")

Sleep(100)

Send("{SPACE}")

Sleep(100)

Send("{TAB}")

Sleep(100)

Send($TargetDatabase)

Send("!o")

;-- if we get the overwrite dialog, send 'Yes'

Sleep(500)

If WinActive("Connection Name in use") Then

Send("!y")

EndIf

; ------------------

; Terminate PSM Dispatcher utils wrapper

LogWrite("Terminating Dispatcher Utils Wrapper")

PSMGenericClient_Term()

Return $PSM_ERROR_SUCCESS

EndFunc

;==================================

; Functions

;==================================

; #FUNCTION# =============================================================================

Func Error($ErrorMessage, $Code = -1)

; If the dispatcher utils DLL was already initialized, write an error log message and terminate the wrapper

if (PSMGenericClient_IsInitialized()) Then

LogWrite($ErrorMessage, True)

PSMGenericClient_Term()

EndIf

Local $MessageFlags = BitOr(0, 16, 262144) ; 0=OK button, 16=Stop-sign icon, 262144=MsgBox has top-most attribute set

MsgBox($MessageFlags, $ERROR_MESSAGE_TITLE, $ErrorMessage)

; If the connection component was already invoked, terminate it

if ($ConnectionClientPID <> 0) Then

ProcessClose($ConnectionClientPID)

$ConnectionClientPID = 0

EndIf

Exit $Code

EndFunc

; #FUNCTION# ====================================================================================================================

; Name...........: LogWrite

; Description ...: Write a PSMWinSCPDispatcher log message to standard PSM log file

; Parameters ....: $sMessage - [IN] The message to write

;       $LogLevel - [Optional] [IN] Defined if the message should be handled as an error message or as a trace messge

; Return values .: $PSM_ERROR_SUCCESS - Success, otherwise error - Use PSMGenericClient_PSMGetLastErrorString for details.

; ===============================================================================================================================

Func LogWrite($sMessage, $LogLevel = $LOG_LEVEL_TRACE)

Return PSMGenericClient_LogWrite($LOG_MESSAGE_PREFIX & $sMessage, $LogLevel)

EndFunc

; #FUNCTION# =============================================================================

; Name...........: PSMGenericClient_GetSessionProperty

; Description ...: Fetches properties required for the session

;================

Func FetchSessionProperties()

if (PSMGenericClient_GetSessionProperty("Username", $TargetUsername) <> $PSM_ERROR_SUCCESS) Then

Error(PSMGenericClient_PSMGetLastErrorString())

EndIf

if (PSMGenericClient_GetSessionProperty("Password", $TargetPassword) <> $PSM_ERROR_SUCCESS) Then

Error(PSMGenericClient_PSMGetLastErrorString())

EndIf

if (PSMGenericClient_GetSessionProperty("Address", $TargetAddress) <> $PSM_ERROR_SUCCESS) Then

Error(PSMGenericClient_PSMGetLastErrorString())

EndIf

if (PSMGenericClient_GetSessionProperty("Port", $TargetPort) <> $PSM_ERROR_SUCCESS) Then

$TargetPort =

EndIf

if (PSMGenericClient_GetSessionProperty("Database", $TargetDatabase) <> $PSM_ERROR_SUCCESS) Then

Error(PSMGenericClient_PSMGetLastErrorString())

EndIf

EndFunc

;Func _Quit()

;MsgBox("","Quitting","Something's wrong")

; Exit

;EndFunc

  • 753 Views
  • 15 replies
  • 0 Likes
Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!

The LIVEcommunity thanks you for your participation!