Cours 4D creating and Modifying a Data Source, tutoriel & guide de travaux pratiques en pdf.
Creating and Modifying a Data Source
The ODBC architecture is based on applications that access one or several data sources. These data sources must be defined and qualified on the client in order to gain access to the right one. The Data Source Names (DSN) can be defined at three levels:
■ User DSN
■ File DSN
■ System DSN
Each level corresponds to a specific application and is used in a unique way. Be careful, because client software does not support all the configurations. For example, “MS Query” from Microsoft Office 97 only works with the File DSN.
Chapters 3 and 4 describe how to configure a data source using the Driver Manager with ODBC Administrator versions 2.5 or 3.x.
Refer to the documentation of your ODBC-compliant application to determine which version of the Driver Manager you should configure, and at which level.
ODBC Administrator Version 2.5
Creating a User DSN
❿ To create a User DSN:
1 Double-click the ODBC Administrator icon in the Windows Control Panel to start the ODBC Administrator.
The Data Sources dialog box appears:
2 To add a Data Source, click the Add button.
The Add Data Source dialog box appears, displaying a list of the ODBC drivers installed on your machine.
3 Select the ODBC Driver for 4D Server, then click OK.
The ODBC Driver for 4D Server Setup (32bit) dialog box appears:
4 In the Data Source Name text box, enter the name of the data source you want to access.
The data source name can be any name.
5 In the Description text box, enter the description of the driver.
By default, the description is “ODBC Driver for 4D Server (32bit)”, but it can be any string you want.
6 In the Network Path text box, enter the location and the protocol used to access your 4D Server data source. This should be typed according to the following rules:
The Network Path depends on the network protocol used on our network:
■ Appletalk protocol: Enter “Appletalk:DatabaseName@ZoneName”.
■ TCP protocol: Enter “TCP/IP:Address,{PortNumber}”.
■ IPX protocol: Enter “IPX:Address”.
You can also choose your 4D Server data source by using the Browse button. In this case, after you have selected the 4D Server data source, do not modify the Network Path as it appears in the Network Path text box.
For more information, please refer to the 4D Server Reference and Network Components for 4D Server documentation.
7 You can test the new data source by clicking on the button “Test data source…”.
If the connection failed, a message displays the number of the error and the description of the problem. Otherwise, a succesful message is displayed.
8 Click the OK button.
The User DSN will be added to the list.
Creating a System DSN
❿ To create a System DSN:
1 In the Data Sources dialog box, click the System DSN button.
The System Data Sources window appears:
2 Click the Add button to add a System Data Source, then follow steps 2 through 7 in the “Creating a User DSN” section.
ODBC Administrator Version 3.x
❿ To start the ODBC Administrator:
■ Double-click the ODBC Administrator icon in the Windows Control Panel.
The ODBC Data Source Administrator window appears:
Creating a User DSN
❿ To create a User DSN:
1 Click the Add button.
ODBC Driver for 4D Server 15
Chapter 3 Creating and Modifying a Data Source
The Create New Data Source dialog box appears, displaying a list of drivers:
2 Select the ODBC Driver for 4D Server (32 bits), then click Advanced.
The ODBC Driver for 4D Server Setup (32bit) dialog box appears.
3 In the Data Source Name text box, enter the name of the data source that you want to access.
The data source name can be any name you enter.
4 In the Description text box, enter the description of the driver.
By default, the description is “ODBC Driver for 4D Server (32 bit)”, but it can be any string that you choose.
16 ODBC Driver for 4D Server
5 In the Network Path text box, enter the location and the protocol used to access your 4D Server data source. This should be typed according to the following rules:
The Network Path depends on the network protocol used on your network:
■ Appletalk protocol: Enter “Appletalk:DatabaseName@ZoneName”.
■ TCP protocol: Enter “TCP/IP:Address,{PortNumber}”.
■ IPX protocol: Enter “IPX:Address”.
You can also choose your 4D Server data source by using the Browse button. In this case, after you have selected the 4D Server data source, do not modify the Network Path as it appears in the “ODBC Driver for 4D Server Setup (32bit) ” dialog box.
For more information, please refer to the 4D Server Reference and Network Components for 4D Server documentation.
6 You can test the new data source by clicking on the button “Test data source…”.
If the connection failed, a message displays the number of the error and the description of the problem. Otherwise, a succesful message is displayed.
7 Click the OK button.
The User DSN will be added to the list.
Creating a non-sharable File DSN
First, you should refer to the previous section, “Creating a User DSN”, since the non-sharable File DSN is a pointer for this definition.
❿ To create a non-sharable File DSN:
1 Click the File DSN tab in the ODBC Data Source Administrator window.
2 Click the Add button.
The Create New Data Source dialog box appears:
3 Select the ODBC Driver for 4D Server (32bit), then click Advanced.
The Advanced File DSN Creation Settings dialog box appears:
4 Deselect the “Verify this connection” check box, then click OK.
5 In the Create New Data Source dialog box, click Next.
Another dialog box appears, in which you can enter the name of the data source.
6 In the file name text box, enter the name of the data source (in our example, Video).
7 Click Next.
An information dialog box displays a summary of the definition of your File Data Source.
20 ODBC Driver for 4D Server
8 After checking all the information, click Finish.
The File DSN is added to the list:
9 Quit ODBC Administrator 3.x by clicking OK.
10 Open the video.dsn file using the Notepad text editor (Notepad.exe).
The video.dsn file is located in your system folder in the “System folder\ODBC\Data sources” path.
The file content appears as follows:
11 Replace the existing text “DRIVER= ODBC Driver for 4D Server (32 bits)” with “DSN=Name of the file data source”.
In our example, we enter: “DSN=Video”.
12 Save the File DSN and quit the Notepad application.
Chapter 1 General Architecture
ODBC Architecture
ODBC Driver
Chapter 2 Installation and Setup
Requirements
Client machine
Server machine
Installation
Chapter 3 Creating and Modifying a Data Source
ODBC Administrator Version 2.5
Creating a User DSN
Creating a System DSN
ODBC Administrator Version 3.x
Creating a User DSN
Creating a non- sharable File DSN
Creating a
System DSN
Chapter 4 Specifications
Allowing Access to 4D Server
Structural Limitations
SQL Statement Limitations
Null Values
Selecting null values
Updating null values
Comparison of Floats
Primary Key
ODBC Driver for 4D Server
Chapter 5 ODBC Conformance Levels
SQL Conformance Level
Support of minimum SQL grammar
Support of core SQL grammar
Support of extended SQL grammar
API Conformance Level
Scalar Functions
Chapter 6 Mapping Data Types
Conversion from 4D Server to ODBC SQL data types
Conversion from ODBC SQL to 4D Server data types
Appendix