473,385 Members | 1,769 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Access linked tables to ODBC in C++/ADO application

I recently started a co-op/internship at a company and they are
looking to migrate a large legacy supported application from OLEDB to
SQL Server. I'm doing prelim work in experimenting with the options
available. The application is huge (1+ million lines of C++ code), so
it'd be quite a bit of man hours to adapt all the database code for
SQL Server. I stumbled upon linked tables in an OLEDB file to an ODBC
source (such as SQL Server) and it appears promising as an initial
transition as it requires no code change (ideally, anyway).

I've got the table data moved to a locally running SQL Server and
linked the tables in the Access database. All the queries and table
data are working properly in Access. I launched our application with
this modified database file and the application immediately crashes
with a 0xC0000005 memory access violation. I traced the debug
information down to an assert in low-level Microsoft Foundation
Classes (MFC) code. We're using ADO (/not/ .net) in C++ as our DB
layer.

Is what I'm attempting to do possible? I've seen examples online of VB
handling linked tables in an Access database just fine, so I'm not
sure why I'm getting errors instantly. Any help would be more than
appreciated, thanks!
Sep 4 '08 #1
3 5107
Bret Kuhns wrote:
I recently started a co-op/internship at a company and they are
looking to migrate a large legacy supported application from OLEDB to
SQL Server. I'm doing prelim work in experimenting with the options
available. The application is huge (1+ million lines of C++ code), so
it'd be quite a bit of man hours to adapt all the database code for
SQL Server. I stumbled upon linked tables in an OLEDB file to an ODBC
source (such as SQL Server) and it appears promising as an initial
transition as it requires no code change (ideally, anyway).

I've got the table data moved to a locally running SQL Server and
linked the tables in the Access database. All the queries and table
data are working properly in Access. I launched our application with
this modified database file and the application immediately crashes
with a 0xC0000005 memory access violation. I traced the debug
information down to an assert in low-level Microsoft Foundation
Classes (MFC) code. We're using ADO (/not/ .net) in C++ as our DB
layer.

Is what I'm attempting to do possible? I've seen examples online of VB
handling linked tables in an Access database just fine, so I'm not
sure why I'm getting errors instantly. Any help would be more than
appreciated, thanks!
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

OLEDB is just a protocol to run DBs (like ODBC). IOW, OLEDB could be
used to link to SQL Server (so I don't understand your problem). The
OLEDB server provider name for SQL Server is SQLOLEDB.

If you want you can link Access (really JET db engine) tables directly
to SQL Server using the SQL Server's Linked Servers (under the Security
menu in the SQL Enterprise Manager). Then treat the Jet tables like SQL
Server tables. The reference to the tables is:

linked_server_name.catalog.schema.object_name

Ex:

AccessDB...table_name

Where "AccessDB" is a name I applied when I linked the access DB to SQL
Server; and the table_name should be whatever the real table name is.

Since Access doesn't have a named catalog, nor schema name, just use the
periods (dots) without the names.

I'm suprised that they original designers of the C++ code didn't make a
class for connecting to the data source. That way all you'd have to do
is replace that class with a class that connects to SQL Server. I
believe I saw something like this on Microsoft's web site - it was
pretty cool how they compacted everything into a few classes. I believe
there is some code that you can download for these classes. Try the MSN
network.

Good luck
--
MGFoster:::mgf00 <atearthlink <decimal-pointnet
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBSMBn3oechKqOuFEgEQL14wCgg9D11Th6Odmi626A0+R/4oeRwp4AoL8O
XhEp/r8C4CtIqlUYQT34v8Eg
=PCOo
-----END PGP SIGNATURE-----
Sep 4 '08 #2
Thanks for the advice. For now, I would like to see how viable it is
to stay inside an actual Access OLEDB file. The reason is that the
application uses around 200 stored queries (some parametrized) in the
database for a lot of operations instead of writing SQL statements in
the code itself. I suppose this probably looked like a good idea when
they initially designed it, but now it's difficult to migrate to SQL
Server as the migration tools I've used can't convert about 150 of the
queries to SQL Server stored procedures and/or views. So the idea
behind staying with a .MDB file is that the queries remain in
the .MDB, but are run against linked tables to the SQL Server ODBC
source. I know that OLEDB is just the standard protocol, and that SQL
Server supports an OLEDB layer that should be easy to transition to.
However, with the query issue I mentioned, it's not going to be easy
to move to SQL Server without rewriting a lot of code and if it's
avoidable, the company would love to take an alternative route.

I suppose my question is focused mainly on how to programmatically
access linked tables in a .MDB OLEDB file. Is it identical to
accessing local tables in the file itself, or would code need to be
changed? If it still requires a change, we might as well just do a
full transition to SQL Server and ignore the linked table idea.

Thanks again for your help!
On Sep 4, 6:57*pm, MGFoster <m...@privacy.comwrote:
>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

OLEDB is just a protocol to run DBs (like ODBC). *IOW, OLEDB could be
used to link to SQL Server (so I don't understand your problem). *The
OLEDB server provider name for SQL Server is SQLOLEDB.

If you want you can link Access (really JET db engine) tables directly
to SQL Server using the SQL Server's Linked Servers (under the Security
menu in the SQL Enterprise Manager). *Then treat the Jet tables like SQL
Server tables. *The reference to the tables is:

* *linked_server_name.catalog.schema.object_name

Ex:

* *AccessDB...table_name

Where "AccessDB" is a name I applied when I linked the access DB to SQL
Server; and the table_name should be whatever the real table name is.

Since Access doesn't have a named catalog, nor schema name, just use the
periods (dots) without the names.

I'm suprised that they original designers of the C++ code didn't make a
class for connecting to the data source. *That way all you'd have to do
is replace that class with a class that connects to SQL Server. *I
believe I saw something like this on Microsoft's web site - it was
pretty cool how they compacted everything into a few classes. *I believe
there is some code that you can download for these classes. *Try the MSN
network.

Good luck
--
MGFoster:::mgf00 <atearthlink <decimal-pointnet
Oakland, CA (USA)
** Respond only to this newsgroup. *I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBSMBn3oechKqOuFEgEQL14wCgg9D11Th6Odmi626A0+R/4oeRwp4AoL8O
XhEp/r8C4CtIqlUYQT34v8Eg
=PCOo
-----END PGP SIGNATURE-----
Sep 5 '08 #3
Bret Kuhns wrote:
Thanks for the advice. For now, I would like to see how viable it is
to stay inside an actual Access OLEDB file. The reason is that the
application uses around 200 stored queries (some parametrized) in the
database for a lot of operations instead of writing SQL statements in
the code itself. I suppose this probably looked like a good idea when
they initially designed it, but now it's difficult to migrate to SQL
Server as the migration tools I've used can't convert about 150 of the
queries to SQL Server stored procedures and/or views. So the idea
behind staying with a .MDB file is that the queries remain in
the .MDB, but are run against linked tables to the SQL Server ODBC
source. I know that OLEDB is just the standard protocol, and that SQL
Server supports an OLEDB layer that should be easy to transition to.
However, with the query issue I mentioned, it's not going to be easy
to move to SQL Server without rewriting a lot of code and if it's
avoidable, the company would love to take an alternative route.

I suppose my question is focused mainly on how to programmatically
access linked tables in a .MDB OLEDB file. Is it identical to
accessing local tables in the file itself, or would code need to be
changed? If it still requires a change, we might as well just do a
full transition to SQL Server and ignore the linked table idea.

Thanks again for your help!
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Let me see if I got this correct: You have all your data in an Access
..mdb file and your going to put that data into an SQL Server DB. Then
you're going to run the C++ application using the queries in the current
Access DB. You are using ADO's OLEDB provider to connect from the C++
program to the Access DB. Is this correct?

If correct: You can link SQL Server tables to an Access .mdb file using
ODBC and run Access queries against those tables. If your current C++
code runs the Access queries I don't believe you'll have to change
anything.

If you decide to convert the Access queries to SQL Server stored
procedures/views you'll have to change the C++ code. The SQL Server OLE
DB provider name is spelled SQLOLEDB. You'll also have to change the
whole ADO set up for the SQL Server db.

--
MGFoster:::mgf00 <atearthlink <decimal-pointnet
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBSMGmGoechKqOuFEgEQJ2iQCfZSbf3UfTnzc5Q0wPHo5KwB 8MBeUAmwXv
3WI2deaMAcfwrFw+R8m6gdcn
=rK21
-----END PGP SIGNATURE-----
Sep 5 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: James Bird | last post by:
Hello In order to perform a hetrogeneous join (I think that's what they're called) between MySQL and another database, I've created an Access database containing linked tables from each...
3
by: Jon Ole Hedne | last post by:
My Access 2002-application need to work with tables from both Oracle and Access. To solve this, I want to run some querys on three views in Oracle and import the results into temporary...
13
by: Zlatko Matić | last post by:
Is it possible to use Access as front-end for POstgreSQL and how ? What about Access Projects (.adp) and PostgreSQL ?
0
by: Cunfshon | last post by:
I wrote about this one a while ago, and got a few responces, but nothing resolved the issue. Figured I'd give everyone one more crack at it. I have an established MS Access database using linked...
2
by: egoldthwait | last post by:
I need to convert a 17mb access 2000 db to Oracle and house it in a Citrix farm. The issue: we have never converted an Access Db to Oracle but can probably use Oracle's Workbench to assist with...
4
by: Vanessa | last post by:
Hi there I am an Access developer, and I have written applications for a 30 telephone call center, using the standard multiuser jet engine, it all works fine, but I want to move our systems onto...
8
by: Greg Strong | last post by:
Hello All, The short questions are 1 Do you know how to make DSN connection close in Access to Oracle 10g Express Edition? &/or 2 Do you know how to make a DSN-less pass-through query...
6
by: onnodb | last post by:
Hi all, While working on an Access UI to a MySQL database (which should be a reasonable, low-cost, flexible interface to the DB, better than web-based, much less costly than a full-fledged .NET...
21
by: lesperancer | last post by:
I've got an access97 reporting mdb that pulls data (77,000 rows) from a sql server table into a local table to run reports if the local table is part of the reporting MDB, the insert statement...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.