none
parallel access to paradox via BDE and ODBC RRS feed

  • Question

  • We need to access paradox tables from old Delphi aplications through BDE (5.0.2). But concurrently we need to access them from .Net (C#) via ODBC like this:
      
     DataTable tbl = new DataTable();
     using (OdbcConnection conn = new OdbcConnection(ConfigurationManager.ConnectionStrings["ParadoxConnection"].ConnectionString)) {
        conn.Open();
        using (OdbcCommand cmd = new OdbcCommand("SELECT * FROM table")) {
           cmd.Connection = conn;
           OdbcDataReader reader = cmd.ExecuteReader();
           tbl.Load(reader);
        }
     conn.Close();

    Executing of cmd.ExecuteReader() causes exception: "ERROR [HY000] [Microsoft][ODBC Paradox Driver] External table is not in the
    expected format" whenever BDE is already used (Delphi app runs or even only BDE Administrator is opened). With old apps closed all runs OK.

    Thanks a lot
    Thursday, June 11, 2009 11:58 AM

Answers

  • Well, we have resolved it... When you use .net framework 2.0, all work fine. Problems begin if you use .net 3.5 (concretely System.Core and System.Data.DatasetExtensions). So we had to manage our code to not use them.  And it works! Wow.

    Thanks for your help.

    Petr
    • Marked as answer by PetSe Tuesday, June 16, 2009 6:11 AM
    Tuesday, June 16, 2009 6:11 AM

All replies

  • What version of Paradox are you using?
    Paul ~~~~ Microsoft MVP (Visual Basic)
    Thursday, June 11, 2009 12:04 PM
  • Thanks for your reply. Loaded table is the Paradox 5.0 for Windows table.

    Petr
    Thursday, June 11, 2009 1:56 PM
  • Is the behavior any different if you use the Jet OLEDB Provider and the Paradox ISAM?

    http://www.connectionstrings.com/paradox


    Paul ~~~~ Microsoft MVP (Visual Basic)
    Thursday, June 11, 2009 2:11 PM
  • Well, it's different, bud I don't know if better.. The error message is "ERROR [IM002][Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified" now.

    Petr
    Thursday, June 11, 2009 3:37 PM
  • Could you post your code? I'm primarily interested in the connection logic.
    Paul ~~~~ Microsoft MVP (Visual Basic)
    Thursday, June 11, 2009 3:46 PM
  • OK, fine, I'll try to prepare some example with the same behavior. Where I ought to send it?

    Thanks

    Petr
    Thursday, June 11, 2009 3:55 PM
  • You can just post the code here like you did before. Just reveal the connection string value so I can see how you are trying to connection. I can't tell from the above code what the value of the connection string is.
    Paul ~~~~ Microsoft MVP (Visual Basic)
    Thursday, June 11, 2009 4:09 PM
  • The ConnectionString is: "Driver={Microsoft Paradox Driver (*.db )}; DriverID=538; Fil=Paradox 5.X; DefaultDir=D:\MY DATA\DATA; Dbq=D:\MY DATA\DATA; CollatingSequence=ASCII;"

    Petr
    Thursday, June 11, 2009 4:34 PM
  • OK, that looks like an ODBC connection string. Did you try Jet OLEDB to see if it makes any difference?

    "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\MY DATA\DATA;Extended Properties=Paradox 5.x;"




    Paul ~~~~ Microsoft MVP (Visual Basic)
    Thursday, June 11, 2009 7:03 PM
  • Yes, with Jet it returns "ERROR [IM002][Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified" on conn.Open(); instead of "ERROR [HY000] [Microsoft][ODBC Paradox Driver] External table is not in the expected format" on OdbcDataReader reader = cmd.ExecuteReader(); with ODBC

    Petr
    Thursday, June 11, 2009 8:27 PM
  • When you use the Jet OLEDB connection you have to use the .NET OleDb library instead of the .NET Odbc library.


    Paul ~~~~ Microsoft MVP (Visual Basic)
    Thursday, June 11, 2009 8:50 PM
  • Absolutely, after all these attempts I was a little bit off the trail yesterday, but regardless of that, with OleDb it returns "External table is not in the expected format" too (only without ERROR [HY000] [Microsoft][ODBC Paradox Driver] of course) on "OleDbDataReader reader = cmd.ExecuteReader();" command. I suppose that the connection string is ok, because if all BDE using applications are closed, it works fine. I still only don't know, how to force Odbc or OleDb command to go through "locked" BDE.

    Petr
    Friday, June 12, 2009 7:41 AM
  • It could be that concurrent connections are not supported. One way to test this is to try using Jet OLEDB or ODBC from two different computers in order to see if both can open the database at the same time. If this works then BDE is placing an exclusive lock on the file. I'm not familiar with BDE so I don't know what sort of parameters would be available (if any) to prevent this.
    Paul ~~~~ Microsoft MVP (Visual Basic)
    Monday, June 15, 2009 2:51 PM
  • Well, we have resolved it... When you use .net framework 2.0, all work fine. Problems begin if you use .net 3.5 (concretely System.Core and System.Data.DatasetExtensions). So we had to manage our code to not use them.  And it works! Wow.

    Thanks for your help.

    Petr
    • Marked as answer by PetSe Tuesday, June 16, 2009 6:11 AM
    Tuesday, June 16, 2009 6:11 AM
  • Hi,

    I'm working on an app in Visual C# that needs to read Paradox 7 tables from an old Delphi App. I've tried with OleDB and ODBC, but I keep getting similar errors to the ones you had (ERROR [HY000] [Microsoft][ODBC Paradox Driver]). I see your solution is managing your code to use .Net 2.0 instead of .Net 3.5. How do you do that?

    Thanks,

    MAO

    Thursday, September 8, 2011 3:13 PM