Toad World® Forums

Command line connection string


#1

Hi,

I am working on one brokering module where the requirement is to inject details like Username, Password, Hostname, Port and SID from the command line (or using any API if one exists) into Toad for Oracle, so that all these details are prefilled for the user and the user just needs to click on the connect button to establish a database connection. I am doing this to broker the database connection. I saw we can connect to Toad through Command "-c username/password@hostname" but how we can pass other details like port and Sid.

Any guidance on this will be a great help.

Thanks…


#2

Use direct connect string. Check out… asktom.oracle.com/…/f


#3

Hi Michael, Is it possible to prefilled these values into Toad for Oracle, instead of establishing the direct connection. The reason I am asking this, to allow user to define SID and not the password, as I brokered the connection and fetching the password from other system.


#4

Sort of. There is no way to seed certain values, -c expects to make the connection. If you pass an incorrect password (e.g. >toad.exe -c scott/wrong_pwd@ip:port/sid) you’ll get an invalid password dialog followed by another asking for the correct password. The db info is filled in and entering the correct password makes the connection. It’s not pretty, but it works.


#5

…and, the wrong password hack technically does not make the connection, but the user will need to immediately connect via the password dialog shown by Toad or cancel and cancelling will most likely lose the values you passed in.


#6

Another method would be to just pass Windows messages to Toad to activate controls of interest and set text. You can use a free tool like WinDowse by Greatis to explore Toad’s controls so you know which controls to look for. You’d need to locate the handle of each control and send mouse down, set text, etc. messages. It would be a bit of work.