Solved

Get list of Tables and Views from Intersystems.Cache

Posted on 2014-03-28
5
1,878 Views
Last Modified: 2014-05-16
Hi,

We have some 3rd party software that uses an older version of Intersystems Cache to store it's data.  We have access to query it through the Intersystems.Data.CacheClient.dll (custom ODBC driver that comes with it)

I can query a database table fine, but I am trying to get a listing of the tables and/or views that exist in a database and I can't figure out how to do that.   I am working in VB.NET.  

I also notices there is a Intersystems.Data.CacheTypes class that might be helpful, but I am not sure.

Lastly, the Views don't seem to be query-able directly.  Is that normal or am I doing something wrong?

Any help with any of the above would be welcome.  Thanks in advance...
0
Comment
Question by:MRS
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 39961674
Querying direct you could try:
select top 100 SqlTableName, classtype
   from %dictionary.compiledclass
   where classtype in ( 'persistent', 'view' )

Open in new window

0
 

Author Comment

by:MRS
ID: 39961717
Thanks for the reply Carl.

I tried that and also something similar that I found online.  I get back the following error through.

Error: [SQLCODE: <-30>:<Table or View not found>]
[Cache Error: <<SYNTAX>errdone+1^%qaqqt>]
[Details: <FLoop - func = DQ>]
[%msg: < SQL ERROR #30: Table '%DICTIONARY.COMPILEDCLASS' not found>]

Any ideas how I might get around that?
0
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 39961783
How are you attempting to talk to the database?

I used the following to make a basic ODBC call:
Dim cn As New OdbcConnection("DSN=ENSEMBLE2013 Samples")
Dim adap As New OdbcDataAdapter("SELECT SqlTableName, classtype FROM %Dictionary.CompiledClass", cn)

Dim dt As New DataTable
adap.Fill(dt)

For Each row As DataRow In dt.Rows
    Console.WriteLine(row(0).ToString())
Next

Open in new window

0
 

Author Comment

by:MRS
ID: 39961882
Basically the same thing you show above, but instead of the ODBC objects, I am using a Cache data Objects.  I keeps throwing the error about not knowing what the @Dictionary.CompiledClass is.  

Could it be the ODBC object that is allowing it?  Can I connect to Cache with an ODBC object without creating an DSN on the machine?

Using Connection1 As New CacheClient.CacheConnection(IP, Port, nSpace, User, Pass)
    Connection1.Open()
    Using Adapter1 As New CacheClient.CacheDataAdapter("SELECT SqlTableName, classtype FROM %Dictionary.CompiledClass", Connection1)
        Using tbl As New DataTable
            Adapter1.Fill(tbl)
            For Each dr As DataRow In tbl.Rows
                Console.WriteLine(dr(0).ToString)
            Next
        End Using
    End Using
    Connection1.Close()
End Using

Open in new window

0
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 500 total points
ID: 39961926
You should be able to. A DSN-less connection string would be along the lines of:
Dim cn As New OdbcConnection("Driver={Intersystems ODBC35};Server=localhost;Port=1972;Database=Samples;UID=*****;PWD=*****;")

Open in new window

0

Featured Post

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Azure Functions is a solution for easily running small pieces of code, or "functions," in the cloud. This article shows how to create one of these functions to write directly to Azure Table Storage.
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question