Toad World® Forums

Toad.exe -c option not working

Hi,
I use Toad for Oracle Xpert Version 12.10.0.30

I want to launch toad and connect to a database via command line and just open a empty editor for me to type queries into.

I tried Toad.exe -c username/password@host:port/service

This launches toad - but doesn't make the connection to the database. Is there any log or anything that I can see to understand what is going wrong?

Just curious, why do you want to connect via command line if you are going to be manually typing into the Editor? Why not just use the login window to enter database info? Normally command line connections are only used if you are using Toad in an automated fashion (that is, Toad would perform some work without you having to do anything, then close itself)

To answer your question, you may need to add double-quotes with the full ezconnect syntax, so

Toad.exe -c "username/password@host:port/service"

I'm going to host toad on a RDS server and type in the connection information for the user automatically. This is so that the user doesn't see the password of the account used to connect to the database.

Thank you. Quotes worked like a charm

1 Like

question. In this syntax - do I need a TNS setup? It should be able to connect without a TNSNAMES.ORA file right?

Right, it should work without TNSNames.ora that way. If you want to use TNSNames.ora, you could just specify the tns alias instead of host:port/service

strangely it doesn't seem to be doing that. I get this error.

ORA-12514: TNS:listener does not currently know of service requested in connect descriptor

A connect descriptor for (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=host)(PORT=port))(CONNECT_DATA=(SERVICE_NAME=servicename))) could not be located in the tnsnames.ora file

Is there a different format I need to specify?

That error dialog that you are seeing is just a list of things to check when a connection can't be made. I don't think that particular message is relevant in this case.

Can you connect using the login window with the same information?
Can you connect using SQL*Plus with same connect string?

I can connect this way with Toad 12.10 with no tnsnames.ora at all.

It does work fine when I connect manually. if I look at the error closely - it doesn't say no connect descriptior for "service name". It says no connect descriptor for the entire TNS entry. Is that normal?

The string works perfectly in sqlplus as well

It looks like there is a character limit on the connection string. if I reduce the hostname and replace with IP address - it works

I tested with a very long host name. is there some unusual character in yours?

It says no connect descriptor for the entire TNS entry. Is that normal?

Yes. That error isn't specific to connecting by the full tns entry. It assumes that a TNSNames.ora is in use, and you are trying to use it. You can disregard that message on the dialog when you are connecting by EZConnect. Behind the scenes, Toad transforms your EZConnect string to the long TNSNames syntax that you see there, and we use that to connect.

There's a hypen and periods. in the error message - the service name gets truncated in the TNS entry.....that's why I tried shortening the connect string.

Mine had periods too. I suspect the hyphen