Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Get list of Tables and Views from Intersystems.Cache

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Your data is at risk. Probably more today that at any other time in history. There are simply more people with more access to the Web with bad intentions.
In this blog post, we’ll look at how using thread_statistics can cause high memory usage.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
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 …

730 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