Error trying to connect to advantage database server using ADS dataprovider

Posted on 2008-10-17
Medium Priority
Last Modified: 2013-11-23
I am trying to integrate alongside an existing application that uses ADS as its database.
When i connect my integration app using the code below it connects fine until i try and run the original application at the same time. It seems to only allow one connection, my application seems to hold the connection and block all others. Yet i can have multiple instances of the original application running conncurrently with no issue. Which leads me to believe that its the way in which i am trying to correct from my c# app. The error im getting when the original app is open and i then try to connect with my integration app is "The Advantage Data Dictionary cannot be opened.  axServerConnect" .

Also i have tried changing the connection string to point to the folder instead of the actual dictionary so instead of c:\Cash4W\data\CashForWindows.Add i was trying to connect to c:\Cash4W\data but then i got the error
Error on connection 1 Error 7200:  AQE Error:  State = HY000;   NativeError = 5159;  [iAnywhere Solutions][Advantage SQL][ASA] Error 5159:  Error encountered when trying to open a database table.  The table is a database table. It cannot be opened as a free table. Table name: call  AdsCommand query execution failed.

Anyone any suggestions ??
AdsConnection connection = new AdsConnection();
AdsCommand cmd = new AdsCommand();
AdsDataAdapter adapter = new AdsDataAdapter();
DataSet dset = new DataSet();
Connectionstring = "Data Source=c:\Cash4W\data\CashForWindows.Add;user ID="Adssys";ServerType=ADS_LOCAL_SERVER;TrimTrailingSpaces=True;        
connection.ConnectionString = Connectionstring;
string sql = " SELECT top 1 * from call";
cmd.CommandText = sql;
cmd.Connection = connection;
adapter.SelectCommand = cmd;
if (dset.Tables[0].Rows.Count > 0)
     success = true;

Open in new window

Question by:MCLR
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
  • 3

Expert Comment

ID: 22741136
Two possible solutions - both addressing the problem that your code doesn't close the connection:
1.  The default .net data adapters will automatically open and close the connection for you - do not manually open the connection, and it will be open / closed automatically by the adapter.

2.  Call connection.Close() after you call adapter.Fill(dset)

Author Comment

ID: 22741199
sorry i forgot to put that line in i had  connection.Close(); in the finally part of a try statement

I tried removing the manual connection open though as in your suggestion 1 but the same issue was happening , any other ideas ?

Expert Comment

ID: 22741555
Does the AdsConnection expose a Dispose method that you should be calling after Close?
Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.


Author Comment

ID: 22741628
It does have a dispose method but Its not opening the connection for me in the first place when i have the original app open. so while i can open multiple instances of the original app i cant open my new app unless i close the original app and vice versa.

So i guess i need to be connecting to the database a different way ??
I tried changing around the additional connection string settings SecurityMode=ADS_IGNORERIGHTS;LockMode=ADS_COMPATIBLE_LOCKING but this made no difference either

Expert Comment

ID: 22741784
I'm sorry, I was misunderstanding - "my application seems to hold the connection and block all others"

Looks like you may need to follow up with iAnywhere Solutions - I'm out of my realm now.

Accepted Solution

MCLR earned 0 total points
ID: 22776579

It turns out that i needed to change the servertype to remote instead of local and then i had the incorrect version of the advantage data provider so i had to download version 8.1 instead of 9.

Then the issue was resolved

Connectionstring = "Data Source=c:\test.Add;user ID="Adssys";ServerType=remote;TrimTrailingSpaces=True;        

Open in new window


Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

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

When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
Backups and Disaster RecoveryIn this post, we’ll look at strategies for backups and disaster recovery.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
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…
Suggested Courses

777 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