2 Replies - 1635 Views - Last Post: 30 June 2011 - 06:52 AM Rate Topic: -----

#1 satis  Icon User is offline

  • D.I.C Head

Reputation: 82
  • View blog
  • Posts: 231
  • Joined: 26-May 11

Issues with 32 bit OleDB Drivers in x64 Environment

Posted 30 June 2011 - 05:59 AM

The problem I'm having is attempting to use a 3rd party 32-bit oledb driver under a 64 bit environment. I'm using the oledb driver to connect to an old database that runs on a different server. This is some old legacy stuff that I have to still support, but it's basically code-frozen... no upgrades to anything that'll work natively under 64 bit, unfortunately.

I can register the dll fine using the 32 bit regsvr32, and when I build my app with x86 as the target CPU, the app does see the driver fine. However, if I attempt to open the connection, it blows up. Here's example code I threw into a winform for testing purposes:

namespace PolyOleTestWinform
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                OleDbConnection conn = new OleDbConnection("Provider=PatOleDB.PatOleDB.1;Password=password;User ID=username;Data Source=localhost:31001;");
                conn.Open();
                conn.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString() + "\n" + ex.StackTrace.ToString(), "Exception thrown");
            }
        }
    }
}



The exception Message is "Attempted to read or write protected memory. This is often an indication that other memory is corrupt." If I place the same executable on a 32 bit system with the oledb dll registered, it works fine. In the test app's case, it either throws a timeout error if there's no db running on that box, or does nothing at all since it successfully opens and closes the connection.

I'm attaching a mildly redacted screenshot of the exception window that gets generated, in case the stack trace is helpful to anybody with a deeper understanding of this than I have.

So, ultimately, am I just screwed, or is there a way to get this to actually work on x64? If it helps, I can provide a copy of the app and a copy of the oledb dll, but I can't provide a working database installation, sorry. Actually have a functional db isn't really necessary... when it blows up under x64, it blows up immediately, regardless of whether or not there's a db on the other end.

Attached image(s)

  • Attached Image

This post has been edited by satis: 30 June 2011 - 06:00 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Issues with 32 bit OleDB Drivers in x64 Environment

#2 Curtis Rutland  Icon User is online

  • (╯□)╯︵ (~ .o.)~
  • member icon


Reputation: 4468
  • View blog
  • Posts: 7,780
  • Joined: 08-June 10

Re: Issues with 32 bit OleDB Drivers in x64 Environment

Posted 30 June 2011 - 06:39 AM

I had an issue like this at my last company. The solution for us was to simply not run the application on a x64 environment. We created a x32 VM and ran it in that. I don't think there is an actual solution short of finding a 64 bit driver.
Was This Post Helpful? 1
  • +
  • -

#3 satis  Icon User is offline

  • D.I.C Head

Reputation: 82
  • View blog
  • Posts: 231
  • Joined: 26-May 11

Re: Issues with 32 bit OleDB Drivers in x64 Environment

Posted 30 June 2011 - 06:52 AM

Crud. Yea, that's pretty much what I was afraid of. I appreciate the response.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1