Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Metabase
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Engineering Digital Service
Metabase
Commits
b18585a9
Commit
b18585a9
authored
7 years ago
by
Cam Saül
Browse files
Options
Downloads
Patches
Plain Diff
Make Oracle SID connection param optional
parent
2a53cf7b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/metabase/driver/oracle.clj
+4
-5
4 additions, 5 deletions
src/metabase/driver/oracle.clj
test/metabase/driver/oracle_test.clj
+15
-2
15 additions, 2 deletions
test/metabase/driver/oracle_test.clj
with
19 additions
and
7 deletions
src/metabase/driver/oracle.clj
+
4
−
5
View file @
b18585a9
...
...
@@ -48,8 +48,9 @@
:or
{
host
"localhost"
,
port
1521
}
:as
details
}]
(
->
(
merge
{
:subprotocol
"oracle:thin"
:subname
(
str
"@"
host
":"
port
":"
sid
)}
(
dissoc
details
:host
:port
))
:subname
(
str
"@"
host
":"
port
(
when
sid
(
str
":"
sid
)))}
(
dissoc
details
:host
:port
:sid
))
sql/handle-additional-options
))
(
defn-
can-connect?
[
details
]
...
...
@@ -207,7 +208,7 @@
:default
1521
}
{
:name
"sid"
:display-name
"Oracle System ID"
:
default
"ORCL"
}
:
placeholder
"ORCL"
}
{
:name
"user"
:display-name
"Database username"
:placeholder
"What username do you use to login to the database?"
...
...
@@ -270,10 +271,8 @@
;; only register the Oracle driver if the JDBC driver is available
(
when
(
u/ignore-exceptions
(
Class/forName
"oracle.jdbc.OracleDriver"
))
;; By default the Oracle JDBC driver isn't compliant with JDBC standards -- instead of returning types like java.sql.Timestamp
;; it returns wacky types like oracle.sql.TIMESTAMPT. By setting this System property the JDBC driver will return the appropriate types.
;; See this page for more details: http://docs.oracle.com/database/121/JJDBC/datacc.htm#sthref437
(
.setProperty
(
System/getProperties
)
"oracle.jdbc.J2EE13Compliant"
"TRUE"
)
(
driver/register-driver!
:oracle
(
OracleDriver.
)))
This diff is collapsed.
Click to expand it.
test/metabase/driver/oracle_test.clj
+
15
−
2
View file @
b18585a9
...
...
@@ -9,9 +9,22 @@
;; make sure we can set additional connection string options
(
expect
{
:subprotocol
"oracle:thin"
:subname
"@localhost:1521:ORCL?serviceName=myservicename"
:sid
"ORCL"
}
:subname
"@localhost:1521:ORCL?serviceName=myservicename"
}
(
sql/connection-details->spec
(
OracleDriver.
)
{
:host
"localhost"
:port
1521
:sid
"ORCL"
:additional-options
"serviceName=myservicename"
}))
;; make sure we can connect with or without an SID
(
expect
{
:subprotocol
"oracle:thin"
:subname
"@localhost:1521:ORCL"
}
(
sql/connection-details->spec
(
OracleDriver.
)
{
:host
"localhost"
:port
1521
:sid
"ORCL"
}))
(
expect
{
:subprotocol
"oracle:thin"
:subname
"@localhost:1521"
}
(
sql/connection-details->spec
(
OracleDriver.
)
{
:host
"localhost"
:port
1521
}))
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment