# Command line connection string

**URL:** <https://forums.toadworld.com/t/command-line-connection-string/34601>\
**Category:** Toad for Oracle & DevOps Toolkit\
**Created:** [December 1, 2015, 7:50am UTC](https://forums.toadworld.com/t/command-line-connection-string/34601 "2015-12-01T07:50:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mr003](https://avatars.discourse-cdn.com/v4/letter/m/8e8cbc/32.png) [@mr003](https://forums.toadworld.com/u/mr003)\
**Post date:** [December 1, 2015, 7:50am UTC](https://forums.toadworld.com/t/command-line-connection-string/34601/1 "2015-12-01T07:50:47Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![mstaszew](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/mstaszew/32/23_2.png) [@mstaszew](https://forums.toadworld.com/u/mstaszew)\
**Post date:** [December 1, 2015, 7:54am UTC](https://forums.toadworld.com/t/command-line-connection-string/34601/2 "2015-12-01T07:54:58Z")

</div>

Use direct connect string. Check out… [asktom.oracle.com/…/f](https://asktom.oracle.com/pls/asktom/f?p=100:11:0::NO::P11_QUESTION_ID:45033135081903)

---

<div class="post-metadata">

**Author:** ![mr003](https://avatars.discourse-cdn.com/v4/letter/m/8e8cbc/32.png) [@mr003](https://forums.toadworld.com/u/mr003)\
**Post date:** [December 1, 2015, 8:55am UTC](https://forums.toadworld.com/t/command-line-connection-string/34601/3 "2015-12-01T08:55:29Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mstaszew](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/mstaszew/32/23_2.png) [@mstaszew](https://forums.toadworld.com/u/mstaszew)\
**Post date:** [December 1, 2015, 9:09am UTC](https://forums.toadworld.com/t/command-line-connection-string/34601/4 "2015-12-01T09:09:54Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mstaszew](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/mstaszew/32/23_2.png) [@mstaszew](https://forums.toadworld.com/u/mstaszew)\
**Post date:** [December 1, 2015, 9:12am UTC](https://forums.toadworld.com/t/command-line-connection-string/34601/5 "2015-12-01T09:12:14Z")

</div>

…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.

---

<div class="post-metadata">

**Author:** ![mstaszew](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/mstaszew/32/23_2.png) [@mstaszew](https://forums.toadworld.com/u/mstaszew)\
**Post date:** [December 1, 2015, 9:18am UTC](https://forums.toadworld.com/t/command-line-connection-string/34601/6 "2015-12-01T09:18:03Z")

</div>

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.
