Configure ODBC data sources in Windows. Setting the ODBC data source setting ODBC drivers on Windows 7

Essence: You need to connect to the database created in the MS Access DBMS through ODBC in its own appendix to Delphi 7.

For a start, go to the section "Control Panel - Administration - Data Sources (ODBC)". Add a new data source.

Fig. 1. ODBC data sources administrator

Touch DRIVER DO Microsoft Access.


Fig. 2. Creating a new data source

Then, in the "Installing the ODBC driver ..." window, we specify the name, description and select the path to the database, for example, "bus station. mDB.».

Fig. 3. Installing the ODBC driver for MS Access

After that, go to the source window "Administrator of data sources ..." and see that the "bus station" was added to the source.

Fig. 4. Initial data source administrator ... »

Then launch the Delphi 7 application, place the components on the form: Adoconnection., Adotable, DataSource., Dbgrid.. Configure components for connecting via ODBC.

First, click on the component " Adoconnection.1 "and configure the connection string, select" Microsoft Ole DB Provider for ODBC ". Click the "Next" button and go to the "Connection" tab.

Fig. 5. Setting the connection string in Delphi 7

On the Connection tab, select the "bus station" data source and check the connection by clicking on the "Check Connection" button.

Component

Setup, value

Adoconnection1

LoginPrompt. \u003d False

Adotable1.

Connection \u003d adoconnection1

Tablename. \u003d Move Days

DataSource1.

DataSet. \u003d Adotable1

Dbgrid1

DataSource. \u003d Datasource1

Now, if you set the property "Active \u003d True" from the component " Adotable1 ", then the table installed in the property" Tablename.»Displayed on the component" Dbgrid.one".

Fig. 7. Table "Days of Movement" in our application

Thus, we connected to the database "Bus station" through "ODBC", which means "Open Data B Ase Connectivity".

The other day I ran into such a problem, on Windows 7, especially in the Starter and Home version, there are no ODBC data sources.

ODBC (Open Database Connectivity) - Program Interface (API) Access to databases, developed by Microsoft, in collaboration with SIMBA Technologies based on Call Level Interface (CLI) specifications, which was developed by SQL Access Group, X / Open and Microsoft. Subsequently, the CLI was standardized ISO ISO / IEC 9075-3: 2003. (eng.) The CLI standard is designed to unify program interaction with the DBMS, make it independent of the supplier of the DBMS and software and hardware platform.



In early 1990, there were several database providers, each of which had its own interface. If the application it was necessary to communicate with several data sources, it was necessary to write its code to interact with each of the databases. To solve the problem of Microsoft and a number of other companies created standard interface To receive and send data sources different types. This interface was named Open Database Connectivity, or an open interaction mechanism with databases.
With ODBC, application programmers could develop applications to use one data access interface without worrying about the intricacies of interaction with multiple sources.

That is, the ODBC tab itself is, here is a screen:

And even opens, but when the "system DSN" doves

There is no database choices, such as on Windows XP, there is only one type of databases, it is SQL, it's not good. Because for example, many bank clients require ODBC data source from Microsoft (MDB). And if you do not choose it, so how to install the bank client on Windows 7 Starter or Home? Downstairs two screenshots, one Windows 7 Starter, other Windows XP.

I will say that there is a way out of this position. Windows 7 Starter or Home is designed for the house, so there is no frills in it, which are needed for professional programs. Here and the price difference, if the home or Starter version varies within 2100 - 3000 rubles, then the Pro version costs at least twice as expensive. But you can still put the bank client and in Windows 7 Starter and Home. Just install the client's bank, he will create the ODBC data source from Microsoft, although it is not visible in the field. I.e simple words The field will be empty, and the MDB database will be created.

Installation Bank Client.

After installing the Bank of the Client, he walked perfectly, and worked.

Thus, the Windows company is a bit of chittitis, that is, hinting to you that it is necessary to buy a more expensive version to install the ODBC data source, although everything works in Starter or Home, it just does not have a field.

And it even opens, but only - when the "system DSN" doves:

No database selection, such as on Windows XP.. It comes out only one of the types of bases - SQL, and this is not good. Because for example, many bank clients require oDBC Data Source It is from Microsoft (MDB) !!! And if you do not choose it, so how to install the bank client on Windows 7. Starter.or Windows 7 Home.?



For comparison, look at the two screenshot, one - Windows 7 Starter.other - Windows XP..

1) Windows 7 Starter:

2) Windows XP Professional:

Nevertheless, there is a way out of this provision! Version Windows 7 Starter. or HOME, designed for the house, so there are no those frills that are needed for professional programs. Here is the difference in price, for comparison: if the cost HOME or Starter. Versions of Windows varies within 2100 - 3000 rubles, then Pro.-Thele costs at least twice as expensive.



But you can still put a bank client and in Windows 7 Starter. and Windows 7 Home.. Just install the client bank, he will create oDBC Data Source From Microsoft, although it will not be visible in the field. That is, simple words the field will be empty, and the MDB database will be created.

Installation bank client:

After installing the client's bank, he walked perfectly, and worked.

Thus, Windows is a bit of chittrim, as if hinting you, for installation source of data ODBC. You need to buy a more expensive version, although in Starter or home versions everything works, just there is no field.

The book describes the Windows Script Host (WSH) version 5.6 scenario server, which is one of the standard windows components Xp, and can also be installed in more early versions Windows. Scripts in VBScript and JScript languages \u200b\u200billustrating the use of standard WSH 5.6 objects, including the creation of child processes and launch scenarios on remote computers. As more complex examples, scenarios working with databases that manage applications are considered. Microsoft Office.Organizing graphic user interfaceUsing ADSI and WMI (Windows Management Instrumentation) and WMI (Windows Management Instrumentation) to solve administrative tasks. Illuminated questions practical work With XML files and creating SOM-Objects. Particular attention is paid to security issues when working with scenarios, specific examples of security policy settings are given. The book is attached disk with the source texts of most examples.

Book:

To gain access to the created DBF table from the WSH script, we will use the ODBC technology (Open Database Connectivity). ODBC is standard microsoft For work S. relational bases data of various formats and manufacturers capable of processing database requests in SQL (Structured Query Language, structured query language).

Comment

For initial familiarization with SQL language, you can recommend a book.

First we will need to start the ODBC record in the system to communicate with our base, i.e. Create a new DSN (Data Source Name, data source name). In Windows XP, this is done as follows.

Upload Control Panel (Control Panel) Windows (Menu Start (Start)) and switch to classical form (Fig. 9.6).


Fig. 9.6. Classic panel view windows management Xp

Consistently choose paragraphs Administration (Administrative Tools) and Data Sources (ODBC) (Data Sources (ODBC)). In the dialog box that appears, select the tab System DSN. (System DSN), which will create a DSN accessible to all computer users (Fig. 9.7).


Fig. 9.7. ODBC data sources administrator in Windows XP

Press the button Add (Add) and in the window that appears, choose microsoft Driver DBASE DRIVER (* .DBF) (Fig. 9.8).

Open Database Connectivity (ODBC) is a protocol used to connect the Microsoft Access database to an external data source, for example Microsoft SQL. Server. This article contains general about ODBC data sources, methods for creating and connecting to them with using Microsoft. Access. The actions that need to be performed depend on the databases used and the ODBC drivers.

In this article

ODBC data sources information

The data source is a source that contains data and information about the connection required to access these data. The data source may be sQL Server Server, relational DBMS Oracle, spreadsheet or text file. Connection information may include server location, database name, login ID, password and various ODBC driver settings describing how to connect to a data source. This information can be obtained from the database administrator to which you want to connect.

In the ODBC architecture, applications (such as Access) are connected to the ODBC driver dispatcher, which, in turn, uses a specific ODBC driver (for example, Microsoft SQL ODBC) to connect to a data source. In Access, ODBC data sources are used to connect to external data sources that do not have built-in drivers.

To connect to such a data source, follow the steps below.

    Install the appropriate ODBC driver on a computer with a data source.

    Determine the data source name (DSN) using the program ODBC data source administratorto save information about connecting in the registry Microsoft Windows. or DSN file or using a connection line in code Visual Basic.To transfer information about connecting directly by the ODBC driver dispatcher.

Machine data sources

Machine data sources store information about connecting to windows registry on the certain computer. Such data sources can only be used on the computer on which they are defined. There are two types of machine data sources: Custom and System. Custom data sources are available and displayed only for the current user. System data sources can use all computer users. They are displayed for all these users and system services. Machine data sources are especially useful when you need to provide additional protection, since the data source can only be viewed in the system users. In addition, this source cannot be remotely copied to another computer.

File data sources

File data sources (also called DSN files) Store information about connecting to text filesAnd not in the Windows registry, and, as a rule, more flexible to use than machine data sources. For example, the data source can be copied to any computer with a suitable ODBC driver to ensure the accuracy and consistency of connection information to all computers used. In addition, you can put a file source of data on a separate server, to make it common to multiple computers on the network and easy to manage centralized connections.

Some file sources cannot be made by common. Such sources are located on a separate computer and indicate a machine source of data. They can be used to access existing data sources from file sources.

Connection strings

In the module, you can define a formatted string with connection information. The connection string transmits the connection information directly to the ODBC driver dispatcher. It helps to simplify the application, eliminating the need to create a DSN by an administrator or user before using a database.

For more information about the ODBC interface, see the MSDN programmer directory by ODBC.

Adding ODBC data source

Before continuing, install the appropriate ODBC driver for the data source to which you want to connect.

Note: To add or configure the ODBC data source, you must enter the local computer administrators group.

For more information about individual parameters, click reference In the ODBC dialog box.

Creating an application using database

Annotation to subsection

Meaning subsection - ensuring implementation laboratory work to create an application database·

Alias \u200b\u200bare often used to work with databases (Alias). The name of the database is the name of a certain database that is prescribed in tinctures in such a way that it is enough to specify Alias \u200b\u200bto appeal to the tables of this database. This convenience allows you to easily change the type of database without changing the text of the programs.

Consider the principle of determining the alias of the Microsoft Access database stored in the file on the gesture disk. Suppose we want the pseudonym Borey to match the database in the Borey.mdb file. Software We can do this using the SQLConfigdatasource ODBC API function.

In order to set a pseudonym in manual mode You need to start the ODBC data source administrator (Start \\ Setup \\ Control Panel \\ Administration \\ Data Sources (ODBC)). The admin window is shown in Figure 6.

Figure 6 - ODBC data sources administrator

Next, on the "Custom DSN" or "System DSN" tab (depending on whether the data source is created for the current user or for all users of the system, respectively) click the Add button. ·

Display List installed drivers And their description (Figure 7).

Figure 7 - ODBC data sources administrator. Dialog for creating a new data source

· After clicking on the "Finish" button in the window that opens (Figure 8), you must specify the name of the source "DB" and the path to the file.

Figure 8 - ODBC data sources administrator. Dialog for creating a new data source

· By pressing the "OK" button in the system, the "Borey" alias will appear to the database, which can be used when accessing the Borey.mdb file (Figure 9). It should be noted that you can specify the alias to other DBMS in the same way.

Figure 9 - ODBC data sources administrator. Dialog for creating a new data source

2.2 Basic information about C ++ language (Wikipedia)

· C ++ - Compiled Statically Typped Communication Language Programming.

Supports the following programming paradigms:

Procedural programming,

Object-oriented programming,

Generalized programming.

Provides:

Modularity,

Separate compilation

Processing exceptions

Abstraction of data

Announcement of types of objects (classes) of objects,

Embedded functions

Virtual functions. ·

The standard library includes, including common containers and algorithms. C ++ combines the properties of both high-level and low-level languages. In comparison with its predecessor - the C language, the most attention is paid to supporting object-oriented and generalized programming. C ++ syntax is inherited from C.



The last standard of C ++ language, which was called "C ++ 11" adopted in 2011, significant additions to the kernel of the language and the expansion of the standard library were included in it. ·