Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Oracle: Automatically enable support TNSNames aliases if TNS_ADMIN is set #1806

cdavid15 opened this issue Oct 25, 2017 · 4 comments


Copy link

What version of Flyway are you using?


Which client are you using? (Command-line, Java API, Maven plugin, Gradle plugin, SBT plugin, ANT tasks)

Command Line

What database are you using (type & version)?

Oracle XE 11.2
Oracle Enterprise 12c

What operating system are you using?

Windows 10

What did you do?

(Please include the content causing the issue, any relevant configuration settings, and the command you ran)

Tried connecting to database using TNSNames within the database connection string url as follows:


Which is a valid connection string as per the Oracle documentation:

The command I ran was:

flyway info -configFile=conf/flyway-dev.conf

With the configuration file as follows:

flyway.installedBy=FlywayDB Migration
What did you expect to see?

Successful connection to the Database similar to the following:

Flyway 4.2.0 by Boxfuse

Database: jdbc:oracle:thin:@LOCAL_ORCL (Oracle 12.1)
What did you see instead?
Flyway 4.2.0 by Boxfuse

Unable to obtain Jdbc connection from DataSource (jdbc:oracle:thin:@LOCAL_ORCL) for user 'TEST': IO Error: Unknown host specified
SQL State  : 08006
Error Code : 17002
Message    : IO Error: Unknown host specified

I have a local fix and have successfully been using it against Oracle Enterprise 12c Database and will submit a pull request in the coming days once I have made the documentation changes.

Copy link

PeeZu commented Oct 25, 2017


According to Oracle documentation:

When using TNSNames with the JDBC Thin driver, you must set the property to the directory that contains your tnsnames.ora file.

Try with:

flyway info -configFile=conf/flyway-dev.conf

Copy link
Contributor Author

Yeah that's the change I have made although the flyway command line executable automatically picks up the path based on the TNS_ADMIN environmental variable and automatically passes the JVM property in.


@axelfontaine axelfontaine added this to the Flyway 5.0.0 milestone Nov 13, 2017
@axelfontaine axelfontaine changed the title Command Line unable to connect to Oracle Database using TNSNames Alias Oracle: Automatically enable support TNSNames aliases if TNS_ADMIN is set Nov 13, 2017
axelfontaine pushed a commit to flyway/ that referenced this issue Nov 13, 2017
Copy link

Thank you very much for the suggestion. I really liked the idea of making it automatic and ending up adding this TNS_ADMIN autodetection to the core to make it available to all clients.

Copy link
Contributor Author

Excellent - it's definitely better suited at the core library level. Not the biggest of changes but a very useful one to those using Oracle databases.

axelfontaine pushed a commit that referenced this issue Apr 10, 2018
dohrayme pushed a commit to dohrayme/flyway that referenced this issue Feb 3, 2020
dohrayme pushed a commit to dohrayme/flyway that referenced this issue Feb 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

Successfully merging a pull request may close this issue.

3 participants