ODBC Questions

rookie1010

Senior member
Mar 7, 2004
984
0
0
Hello

I had a bunch of ODBC questions, i would appreciate if you guys/gals could mystify ODBC.

If i create a *.mdb file using MS Access, am i creating an ODBC driver, or do i actually create the ODBC driver though the ODBC Data Source Administrator?

what does the ODBC driver contain, what langage is it written in? what is its extension?
 

kamper

Diamond Member
Mar 18, 2003
5,513
0
0
A driver is software, so you don't create it yourself. It exists on your machine already.

If you create an mdb file, you create a file that holds data, simple as that. If you register it in the the Data Source Administrator, you create a data source.

I suppose an ODBC driver could be written in just about anything but I'd wager the windows one for access databases is c++. The whole point is that odbc is just a protocol so you should be able to use any language to implement it.
 

Jaxidian

Platinum Member
Oct 22, 2001
2,230
0
71
twitter.com
Yeah, as Kamper has eluded to, I think you're ignorant enough about this to not know the right questions to ask (no offense intended).

There is a set of database drivers that you can install in Windows that gives you a good general coverage of many common things in a package called MDAC. It contains Microsoft-written drivers for a lot of things, including Oracle. If you think you're missing a driver, this is a good thing to investigate to see if it will help you with your problem.

As Kamper said, an MDB file has nothing to do with an ODBC driver. All an MDB file is is just a Microsoft Access file, just like an XLS file is nothing more than an Excel file and a DOC file is nothing more than a Microsoft Word (and others) file.

If you're working with something at a low-level where you're writing the code to connect to a database, you more-than-likely have a connectionstring that you're working with. If this is the case, you can specify in the connectionstring what driver you wish to work with (it's not always required that you specify it depending on what your particular scenario is). If you're wanting to use a DSN then you pretty much must use ODBC. Other options (if you don't need a DSN) are OLE, SQL Connections, and many other things.

If you're working with something at a higher-level, you probably don't quite have to specify the driver to use though it may still be possible. Again, if you're using a DSN then that means you're probably using ODBC.

Regardless of any of this, pretty much any language can use pretty much any driver (well, as long as there are assemblies or whatever for your particular language to interface with such a driver). You will likely never "create" a driver yourself, you'll most likely just use pre-existing drivers. I write code that work with various databases all day and have done so for years yet I have never written a database driver.

Read a bit of this and come back with some more appropriate questions and we'll keep educating you. :)

-Jax
 

rookie1010

Senior member
Mar 7, 2004
984
0
0
thanks for the replies guys

i was wdonering if the a copy of the driver is instantiated from some sort of template?

when you create a file, dont you create a source too, i mean the *.mdb is a source of data, correct?

jaxidian, what do you mean by working at low level and working at high level.

i look forward to being told off :) and learning from you guys.

 

EagleKeeper

Discussion Club Moderator<br>Elite Member
Staff member
Oct 30, 2000
42,589
5
0
For a MDB file the drivers exists within the Window's OS.

When you create a data file, that is exactly what it is.

You can then use the driver interface (ODBC) to interact with the datafile.

A low level database driver would be used to replace MS driver. It takes the commands (API) and determines how to manipulate the data within the targeted datafile (add/delete/modify data) and how to keep track of what is going on all all times.

The high level driver (from your perspective) is the MS ODBC driver and related APIs. You would call certain functions to manipulate the data. You do not need to know in detail how the data is stored and how to change the data within the file. that is the responsbility of the ODBC driver; you just need to follow the rules that are layed out for use of the driver and/or the APIs that interface with the driver.
 

kamper

Diamond Member
Mar 18, 2003
5,513
0
0
Originally posted by: Jaxidian
Yeah, as Kamper has eluded to, I think you're ignorant enough about this to not know the right questions to ask (no offense intended).
Tact is not one of your strong-suits is it? ;)
 

KLin

Lifer
Feb 29, 2000
30,446
752
126
Originally posted by: rookie1010
thanks for the replies guys

i was wdonering if the a copy of the driver is instantiated from some sort of template?

when you create a file, dont you create a source too, i mean the *.mdb is a source of data, correct?

jaxidian, what do you mean by working at low level and working at high level.

i look forward to being told off :) and learning from you guys.

An mdb file is just an access database file. You can interface with the data inside that file through ODBC from different programs(ASP.net webpage, a SQL server, Another Access database file). the ODBC drivers for microsoft's database products (Access, SQL Server) come with a software installation called Microsoft Data Access Components (MDAC for short). You can download this from Microsoft's website.
 

Jaxidian

Platinum Member
Oct 22, 2001
2,230
0
71
twitter.com
Originally posted by: kamper
Originally posted by: Jaxidian
Yeah, as Kamper has eluded to, I think you're ignorant enough about this to not know the right questions to ask (no offense intended).
Tact is not one of your strong-suits is it? ;)

I had no need to be tactful here. I get nothing out of posting support here. If the OP chooses to be upset with me because of my bluntness, then so be it. If the OP hears my bluntness and it helps him/her realize that they have a bit more to learn than they thought, then it helped.

---

Anyways...

To help you realize the difference between the MDB and a driver, let's take a look at an Excel file (I'm assuming you can relate to that a little more). If you have an Excel file, you can type data into rows and columns (let's ignore the more advanced stuff and just think of it as simple spreadsheets) and save the file as an XLS file. When you're done, all you have is an XLS file with data in it. There is no driver here, it's just a file with data in it. Let's call this FileA.XLS.

Now let's go and create a new Excel file (FileB.XLS is what we'll call this one). Now, one of the options is to go and import data from an external source. One of our options is to import from another XLS file - let's choose FileA.XLS. Now remember, FileA.XLS is nothing more than a file with data in it. So in order to do any kind of import action, we do need something that we can think of as a driver. This particular driver knows how to talk to XLS files. So FileB.XLS will invoke a driver to import data from FileA.XLS. Sure, FileB.XLS had to call that driver but the driver wasn't a part of FileB.XLS, it was part of Windows.

MDB files are very similar. They are just files that contain data. If you want them to be a source for your data, whatever is pulling the data (hell, could be an XLS file) needs to invoke a specific driver that knows how to talk to MDB files.

Hopefully this helps you understand the difference between these data files and drivers.

-Jax
 

Jaxidian

Platinum Member
Oct 22, 2001
2,230
0
71
twitter.com
Originally posted by: rookie1010
thanks for the replies guys

i was wdonering if the a copy of the driver is instantiated from some sort of template?

when you create a file, dont you create a source too, i mean the *.mdb is a source of data, correct?

jaxidian, what do you mean by working at low level and working at high level.

i look forward to being told off :) and learning from you guys.

What I meant between low-level and high-level is whether you're writing code to call the drivers (low-level) versus using a program's UI (such as Excel) to call them (high-level).
 

rookie1010

Senior member
Mar 7, 2004
984
0
0
thanks for the replies Kamper, EagleKeeper, Jaxidian & KLin

ok, if i created a .mdb file, i have created a data source, correct? and then just need to link the ODBC driver to the .mdb file, correct?

What I meant between low-level and high-level is whether you're writing code to call the drivers (low-level) versus using a program's UI (such as Excel) to call them (high-level).

so you mean that the low-level and high-lvel driver are functionally the same, probably i could call the low-level driver a user doen driver and the high-level driver a microsoft driver, correct?

ok when i create the .mdb file, why am i not creating a data source, why do i need to do the data source creation in the ODBC Data Source Administrator.

I was actually trying to leanr java using this link.
http://www.developer.com/design/article.php/3571661
according to this link, i need to use File DSN, but the program seems to only work with User DSN, do you know why is this happening?
 

EagleKeeper

Discussion Club Moderator<br>Elite Member
Staff member
Oct 30, 2000
42,589
5
0
If i created a .mdb file, i have created a data source, correct? and then just need to link the ODBC driver to the .mdb file, correct?
Yes

so you mean that the low-level and high-level driver are functionally the same, probably i could call the low-level driver a user doen driver and the high-level driver a microsoft driver,
The high level driver is used from a coding standpoint. It hides the complexity's of the source file and maintains standardization. The low-level driver is dependent on each type of source file.

A low level driver for an SQL DB file system will not work on a MDB file system
The high level makes it transparent to the user.

when i create the .mdb file, why am i not creating a data source, why do i need to do the data source creation in the ODBC Data Source Administrator.
when you create the data source; you are then linking the high level interface drivers (APIs) with the low level drivers.
 

kamper

Diamond Member
Mar 18, 2003
5,513
0
0
Originally posted by: EagleKeeper
If i created a .mdb file, i have created a data source, correct? and then just need to link the ODBC driver to the .mdb file, correct?
Yes
Merely creating the mdb file doesn't create the data source, you have to register it with the admin tool, no?
 

EagleKeeper

Discussion Club Moderator<br>Elite Member
Staff member
Oct 30, 2000
42,589
5
0
Originally posted by: kamper
Originally posted by: EagleKeeper
If i created a .mdb file, i have created a data source, correct? and then just need to link the ODBC driver to the .mdb file, correct?
Yes
Merely creating the mdb file doesn't create the data source, you have to register it with the admin tool, no?

That is correct - That is what the linking the ODBC driver is doing.
Creating a named connection using the admin tool.

You can actually using some APIs to bypass the source but it is messy and locks the source code into one configurations, removing the flexability of changing datasources (file types or actual files themselves).

 

rookie1010

Senior member
Mar 7, 2004
984
0
0
ah that is what the .dsn file is, a registration, but should nto the registration have been some entry in registry?

so is the odbc driver a two layered driver, with the lower driver being file type dependent, and the top level being a genric layer?

i thought when you create the data source, you are linking the low level drivers with the .mdb?