Using JDBC to connect to Cache Database URL

I'm referring to the document Using Cache with JDBC. Using this example, it sets the URL of the object ds of class CacheDataSource.

ds.setURL("jdbc:Cache://127.0.0.1:1972/SAMPLES");

My question is would you just copy and paste the URL from the login page to the string? I tried doing that and it returns an error saying "Invalid log file xyz"

 

Any help will be greatly appreciated! Thank you

  • 0
  • 0
  • 621
  • 2
  • 2

Answers

Not clear what you mean with "login page".
for the MgmtPoatal you connect to a HTTP port (default=57772) with a CSP PAGE and and and ...

With JDBC you connect to the object service port (default = 1972)  + namespace  

The IP address is of course the same. Here 127.0.0.1  or localhost 

Cache JDBC schema is:

jdbc:Cache://<host>:<superserver_port>/<namespace>

Documentation.

What should the argument of is? Is it the directory of where the local database is located at? Let's say my database is under /cache/db/cache.dat and the port is 12345, should the URL be "jdbc:Cache://localhost:12345/cache/db/cache.dat" for the jdbc scheme? Thank you in advance

You are missing the point.

12345 is the port used by the cache DB server   (default=1972) of your instance.
internally there is a mapping between the logical NAMESPACE and the physical disk directory and that NAMESPACE is used in connection string.
if your namespace is called DB then  you have to use 

jdbc:Cache://localhost:12345/DB

But if you just have the directory .../cache/db/cache.dat  you can't say what NAMESPACE this is
You have to know your Caché configuration.

Some reading on Caché configuration may give you background information
http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=...