Solved

Error trying to connect to advantage database server using ADS dataprovider

Posted on 2008-10-17
6
5,573 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
  • 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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

CCModeler offers a way to enter basic information like entities, attributes and relationships and export them as yEd or erviz diagram. It also can import existing Access or SQL Server tables with relationships.
Never store passwords in plain text or just their hash: it seems a no-brainier, but there are still plenty of people doing that. I present the why and how on this subject, offering my own real life solution that you can implement right away, bringin…
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…

747 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now