How do I connect to a database using JDBC filter
hi all,
I am looking to make a JDBC connection to my Intersystems Cache using the JDBC driver 2.0.0.
I see the connection format is as "
jdbc:Cache://<host>:<port>/<namespace>
"
What I really want to do is filter additionally by a certain database, i.e. connect my consuming application to a database under the namespace.
how can I do that? what will be the format
Comments
First start off by looking at the following documentation...
- https://docs.intersystems.com/irisforhealth20201/csp/docbook/DocBook.UI.Page.cls?KEY=PAGE_java_jdbc
- https://docs.intersystems.com/irisforhealth20201/csp/docbook/Doc.View.cls?KEY=BJAVA_connecting
What you use for your connection string all depends on the driver you are using. In the past I have used Microsoft, Oracle, and jTDS JDBC drivers. Currently I am using jTDS because it allows me to use integrated Authentication. so my strings are a little long...
jdbc:jtds:sqlserver://(server name):(port)/(database);instance=xx;domain=xxxx;useNTLMv2=true;cacheMetaData=true;prepareSQL=2;
is just an example.
Scott
Hi Scott,
thanks for your response. I have looked at the given documentation. What I am missing is in the connection string, where do I specify the database/Schema as a filter? This format only connects to a namespace , can I pass an additional parameter of the schema-name or database name ?
jdbc:Cache://<host>:<port>/<namespace>
I would believe the only way to put a schema filter in would be within your query and not in the connection string.
I advice solving your problem by tightening security.
Your app user should have access only to the tables needed for the application to run.
If the user doesn't have any additional/admin roles, he won't see any other tables.