Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Get list of Tables and Views from Intersystems.Cache

Posted on 2014-03-28
5
Medium Priority
?
2,145 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
  • 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 2000 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Lotus Notes has been used since a very long time as an e-mail client and is very popular because of it's unmatched security. In this article we are going to learn about  RRV Bucket corruption and understand various methods to Fix "RRV Bucket Corrupt…
An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

916 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