embulk / embulk-output-jdbc

MySQL, PostgreSQL, Redshift and generic JDBC output plugins for Embulk
Other
88 stars 89 forks source link

Support Oracle database service name #95

Open hito4t opened 8 years ago

hito4t commented 8 years ago

Now database means SID. For using database service name, must set full JDBC URL, but it is inconvenient.

dafeiroc commented 7 years ago

For using database service name, use url instead of host/database

in:
    type: oracle
    driver_path:.......ojdbc6.jar
    url: jdbc:oracle:thin:@x.x.x.x:1524/<service_name>
out:
    type: stdout

But what happened if there are multiple port or host in tnsname.ora file?

(ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = x.x.x.x)(PORT = 1524))
      (ADDRESS = (PROTOCOL = TCP)(HOST = x.x.x.x)(PORT = 1525))
      (LOAD_BALANCE = ON)
      (FAILOVER = ON)
    )
hito4t commented 7 years ago

Oracle JDBC Thin Driver doesn't use tnsname.ora by default. So embulk-output-oracle will connect to x.x.x.x:1524 as written in url.

FYI http://przemyslawkruglej.com/archive/2013/11/connecting-to-oracle-database-using-tnsnames-ora-in-java/

dafeiroc commented 7 years ago

Thanks @hito4t !

I create a PR for this issue.