Comments (3)
@schuemie ,
I was about to fix this myself, but saw some oddness that I am not sure was intentional or not:
In my own local tests with Oracle, using the following format of JDBC url for thin is:
jdbc:oracle:thin@//{host}:{port}/{service name}
In my env, I have oracle XE installed, it installed with a default service name of XE and I connect to it as follows:
jdbc:oracle:thin:@//127.0.1:1521/xe
I noticed in your code that you have a JDBC url configuration that looks like you'd use when connecting to a SID:
(see http://razorsql.com/docs/help_oracle.html for reference)
jdbc:oracle:thin:@{host}:{port}:{SID}
It looks like in your code you are trying it one way or the other way, but the 'other' way in the code does not look like it is using any recognizable format:
# Try using TNSName instead:
if (result == "try-error")
result <- class(try(connection <- RJDBC::dbConnect(driver,
paste("jdbc:oracle:thin:@",
server,
sep = ""),
user,
password), silent = TRUE))[1]
I believe the 2 formats that we should try is:
jdbc:oracle:thin:@//localhost:1521/XE
jdbc:oracle:thin:@neptune.acme.com:1521:T10A
(note your current first try uses the second format, and the second try doesn't use any of the above)
I believe the second try should perform the following code:
result <- class(try(connection <- RJDBC::dbConnect(driver, paste("jdbc:oracle:thin:@//",
host,
":",
port,
"/",
sid,
sep = ""), user, password), silent = TRUE))[1]
I notied that when the function is called with a server of X/Y, you split the value into 2 parts:
sid <- server
if (grepl("/", server)) {
parts <- unlist(strsplit(server, "/"))
host <- parts[1]
sid <- parts[2]
I'm not sure what specific use case this is. But it seems the only 2 formats that are available are with the @//host:port/ServiceName and @host:port:sid.
I'd make the above change myself, but i'm not sure if there was another use case for how you designed the above.
-Chris
from databaseconnector.
@schuemie , Doing more reading on this, and it seems that SIDs are not longer the preferred way to connect to an oracle server. We could decare that for oracle connections, that the oracle host must register the service name (which seems to default to the SID in single instance cases, but becomes sid1, sid2, sid3 in clustered environments under a service_name). Since service_name should work in both the single and clustered case, it seems that connecting to the service as a service_name should be the preferred default.
from databaseconnector.
Hi, @schuemie ,
Last comment for the night, I swear :)
I found this article:
http://razorsql.com/articles/oracle_jdbc_connect.html
Gives a third option that I think you are using:
jdbc:oracle:thin@<TNSNAME>
So I see what your second option was trying to accomplish: connecting via TNSNAME.
So, seems that oracle thin driver has 3 options that we might want to support:
SID:
jdbc:oracle:thin:@<host>:<port>:<sid>
Service Name (note the //):
jdbc:oracle:thin://@<host>:<port>/<service name>
TNSName: (no //, no host/port etc)
jdbc:oracle:thin:@<TNSName>
On the oci driver format side (I think that's a native driver mode)
jdbc:oracle:oci:@<database_name>
I have absolutely no idea what database name would refer to in this context.
Finally, I found this article on orafaq.com:
http://www.orafaq.com/wiki/JDBC
Seems like the jdbc:oracle:thin:@//{host}{:port}/SERVICE will accept either a SID or Service name. If that's the case, then that's the only JDBC format we need to support.
-Chris
from databaseconnector.
Related Issues (20)
- question on interactive behavior for redshift drivers HOT 2
- dbIsValid does not work as expected
- Option to use executeLargeUpdate HOT 7
- Refactor testing code so it iterates over the platforms in a loop HOT 1
- Not dropping default argument to lag() on Redshift
- Optional method of using Ibis backend connectors HOT 2
- DuckDB connection doesn't work without specifying pathToDriver
- Github Actions not recognizing Snowflake secrets HOT 1
- Running out of memory when pushing Andromeda tables to external databases using bulk import HOT 1
- Rethink a bit DatabaseConnector dplyr sql generation HOT 13
- subsetting the database HOT 9
- Call to Andromeda causing unit tests to fail HOT 1
- Use exported odbc classes HOT 1
- DBI::dbIsValid does not seem to work with postgres
- Multiple valid methods for signature: target signature ‘DatabaseConnectorJdbcConnection#Id’.
- DBI::dbCreateTable does not work as expected
- Add Java version to SQL error report
- How to add connection scripts in connectionDetails object? HOT 2
- Implement a `withConnection` context function for ensuring connections close in scripts
- java.sql.SQLFeatureNotSupportedException HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from databaseconnector.