Solved

Error trying to connect to advantage database server using ADS dataprovider

Posted on 2008-10-17
6
5,761 Views
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;
connection.Open();
                   
string sql = " SELECT top 1 * from call";
 
cmd.CommandText = sql;
cmd.Connection = connection;
adapter.SelectCommand = cmd;
adapter.Fill(dset);
if (dset.Tables[0].Rows.Count > 0)
{
     success = true;
 
}

Open in new window

0
Comment
Question by:MCLR
[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
  • 3
6 Comments
 
LVL 9

Expert Comment

by:Lacutah
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)
0
 
LVL 1

Author Comment

by:MCLR
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 ?
Thanks
0
 
LVL 9

Expert Comment

by:Lacutah
ID: 22741555
Does the AdsConnection expose a Dispose method that you should be calling after Close?
0
Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

 
LVL 1

Author Comment

by:MCLR
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
0
 
LVL 9

Expert Comment

by:Lacutah
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.
0
 
LVL 1

Accepted Solution

by:
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

0

Featured Post

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

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

Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
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…

691 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