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

Update connection string and sort tables for Oracle databases #361

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 1 addition & 12 deletions rabbit-core/src/main/java/org/ohdsi/databases/DBConnector.java
Original file line number Diff line number Diff line change
Expand Up @@ -200,20 +200,9 @@ public static Connection connectToOracle(String server, String domain, String us
// If fails, try THIN driver:
if (error != null)
try {
String host = "127.0.0.1";
String sid = server;
String port = "1521";
if (server.contains("/")) {
host = server.split("/")[0];
if (host.contains(":")) {
port = host.split(":")[1];
host = host.split(":")[0];
}
sid = server.split("/")[1];
}
OracleDataSource ods;
ods = new OracleDataSource();
ods.setURL("jdbc:oracle:thin:@" + host + ":" + port + ":" + sid);
ods.setURL("jdbc:oracle:thin:@" + server);
ods.setUser(user);
ods.setPassword(password);
return ods.getConnection();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public List<String> getTableNames(String database) {
} else if (dbType == DbType.ORACLE) {
query = "SELECT table_name FROM " +
"(SELECT table_name, owner FROM all_tables UNION ALL SELECT view_name, owner FROM all_views) tables_views " +
"WHERE owner='" + database.toUpperCase() + "'";
"WHERE owner='" + database.toUpperCase() + "' ORDER BY table_name";
} else if (dbType == DbType.POSTGRESQL || dbType == DbType.REDSHIFT) {
query = "SELECT table_name FROM information_schema.tables WHERE table_schema = '" + database.toLowerCase() + "' ORDER BY table_name";
} else if (dbType == DbType.MSACCESS) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ private JPanel createLocationsPanel() {
addAllButton.setEnabled(sourceIsDatabase);

if (sourceIsDatabase && selectedSourceType.equals("Oracle")) {
sourceServerField.setToolTipText("For Oracle servers this field contains the SID, servicename, and optionally the port: '<host>/<sid>', '<host>:<port>/<sid>', '<host>/<service name>', or '<host>:<port>/<service name>'");
sourceServerField.setToolTipText("For Oracle servers this field contains the connection string for the OCI/THIN driver. eg. 'jdbc:oracle:oci:@<server>', 'jdbc:oracle:thin:@<server>'");
sourceUserField.setToolTipText("For Oracle servers this field contains the name of the user used to log in");
sourcePasswordField.setToolTipText("For Oracle servers this field contains the password corresponding to the user");
sourceDatabaseField.setToolTipText("For Oracle servers this field contains the schema (i.e. 'user' in Oracle terms) containing the source tables");
Expand Down Expand Up @@ -585,7 +585,7 @@ public void actionPerformed(ActionEvent e) {

switch (event.getItem().toString()) {
case "Oracle":
targetServerField.setToolTipText("For Oracle servers this field contains the SID, servicename, and optionally the port: '<host>/<sid>', '<host>:<port>/<sid>', '<host>/<service name>', or '<host>:<port>/<service name>'");
targetServerField.setToolTipText("For Oracle servers this field contains the connection string for the OCI/THIN driver. eg. 'jdbc:oracle:oci:@<server>', 'jdbc:oracle:thin:@<server>'");
targetDatabaseField.setToolTipText("For Oracle servers this field contains the schema (i.e. 'user' in Oracle terms) containing the source tables");
break;
case "PostgreSQL":
Expand Down