473,753 Members | 8,053 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 5127
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_n ame.catalog.sch ema.object_name

Ex:

AccessDB...tabl e_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:::mgf0 0 <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/AwUBSMBn3oechKq OuFEgEQL14wCgg9 D11Th6Odmi626A0 +R/4oeRwp4AoL8O
XhEp/r8C4CtIqlUYQT34 v8Eg
=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 programmaticall y
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.c omwrote:
>
-----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.sc hema.object_nam e

Ex:

* *AccessDB...tab le_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:::mgf0 0 <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/AwUBSMBn3oechKq OuFEgEQL14wCgg9 D11Th6Odmi626A0 +R/4oeRwp4AoL8O
XhEp/r8C4CtIqlUYQT34 v8Eg
=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 programmaticall y
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:::mgf0 0 <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/AwUBSMGmGoechKq OuFEgEQJ2iQCfZS bf3UfTnzc5Q0wPH o5KwB8MBeUAmwXv
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
2565
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 datasource. I create the linked tables without any problems, clicking on "save password" before selecting the desired tables. I can then access both tables fine from within the Access GUI.
3
23457
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 Access-tables. I have tried this: conn.Provider = "Microsoft.Jet.OLEDB.4.0" conn.ConnectionString = "data source=" & datafil & ";Jet OLEDB:Database Password=" conn.Open datafil
13
7291
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
2128
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 tables to an external MS-SQL datasource, through ODBC. I can establish the ODBC link, I can link the tables in a new MS Access database (File -> Get External Data -> Link Tables...), I can view the structure of the linked table(s), I can querie...
2
4239
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 this. Also - the citrix folks do not want us to keep the FE in Access as the queries and other activities consume a lot of power. The users will be in 3 different offices across the globe all accessing the 1 Oracle DB in Citrix. Does anyone have...
4
2907
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 MySQL, as we get the odd #DELETED# (that old chestnut) so that it is more stable, I have installed mysql and myodbc and configured it in data sources (ODBC) and it works fine (done the TEST). But when I try to export a table from the mdb
8
9637
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 work from
6
6266
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 app or so.... is it?), I tried measuring the bandwith consumed by the Access/MyODBC/MySQL link, which came out to be, er, quite high. I fancied it would be interesting to look at the queries Access throws at MySQL through the ODBC link, so I...
21
4693
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 (16 fields) takes less than 30secs, but because of db-bloat, I moved the local table to a 2nd MDB and per postings, this 2nd MDB is copied into a folder and linked as a 'temp' MDB every time I run my reporting mdb
0
9072
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9451
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8328
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6869
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6151
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4771
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3395
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2872
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2284
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.