Developer on Alibaba Coud: Build your first app with APIs, SDKs, and tutorials on the Alibaba Cloud. Read more ＞
The question of the proposed
How to realize the sharing of DB2 database information
We set up MIS system, mainly for information sharing, in order to improve the efficiency of office, then how to achieve DB2 database information sharing? With the development of Web technology, B/S mode has been widely adopted, but the one-way static Web pages can not realize the interactive function, enterprises need to dynamically publish information to the Internet. This requires us to connect the database with the Web for users to query, the main job of the enterprise is to modify the contents of the database maintenance. The characteristics of B/s mode are:
1. Do not need to install the client program, as long as there is a general-purpose browser can be, because its functions are implemented on the Web server, but also greatly reduce the maintenance work;
2. User operation is quite easy, will use a general browser can;
3. The use of TCP/IP protocol based on the Internet and Intranet makes it easy to publish information online.
The author talks about the realization of the DB2 database in detail.
Analysis of the problem
The realization method of B/S mode
b/S mode of implementation has many kinds, such as CGI, JDBC, IDC, ASP, and so on, here we use ASP. ASP is an open scripting development environment based on Microsoft NT 4.0 and iis3.0/4.0 or personal web Server on Win 9x, a new generation of Dynamic Web database application development program, which can be used to implement complex web applications and develop dynamic and efficient , interactive Web server-side applications. It has the following characteristics:
1. Full integration with HTML, and greatly increased flexibility;
3.ASP production tools can be used in Ultraedit32 and other text editors;
4.ASP is a text file, the extension is ASP, including text, HTML tags;
5. Support Object oriented;
6. Using ASP to develop the script program running on the server side, improve the security;
7. Support multiple users, multithreading;
8.ASP uses an ADO component to connect to the database through an ODBC driver.
ASP application process: IE and other browsers to submit applications to the Web server, request access to an ASP file, Web server invoke ASP file execution, use ADO components through ODBC access to the database, the results passed to the user's browser. As shown in Figure 1.
ASP is a very promising Dynamic Web database application technology, has been adopted by many websites. ASP provides five built-in objects: request, response, server, session, and application, which are equivalent to packaged classes, providing customers with access to a variety of resources.
Implementation of the scheme
Using FrontPage2000 to create interactive Web pages to share DB2 database information
Step One: System DSN settings: Use ASP technology to access the database, the key is the ODBC driver, only the server installed the appropriate ODBC driver, your home page can access a variety of databases, such as: Access, Excel, Foxpro, VFP, Paradox, Oracle, SQL Server, and so on. ODBC parameters can be specified directly in a script program, or you can set ODBC parameters in a System DSN and start the database in a script with a DSN. The advantage of using DSN to access a database through ODBC is that when we change the database, we just need to reset the DSN on the system without modifying the ODBC parameters in the program. Note that only the System DSN is visible to all users, and that the User DSN and file DSN are visible only to the current user and to the user who installed the same driver, and don't make a mistake.
1. By "control Panel" → "ODBC data source (32 bit) →" System DSN "tab, click the" Add ... "button, the" Create New Data Source "dialog box appears;
2. Select the IBM DB2 ODBC driver entry from the list box (if not, install DB2 first) and click Finish.
3. In the pop-up dialog box in the Drop-down menu to select the database you need, if there is no can use the "Add Database ..." button to increase the DB2 database you want.
Step two: Create an ASP page with FrontPage 2000.
1. Start FrontPage 2000, select Menu bar "file" → "open Site", the Site Settings item in the menu bar tool is activated, click it, a dialog box appears, select the database → Click the "Add ..." button, and in the dialog box "New Database Connection", select the second item--" System data source on the site server, as shown in Figure 2:
Press the "Browse ..." button to enter the username and password to access the DB2 database in the Advanced Connection Properties dialog box, and then confirm. Press the Verify button to verify the connection.
2.FrontPage 2000 menu, select "Insert" → "database" → "results", Pop-up Database Results Wizard dialog box, the use of the existing database connection, select the database connection name you defined, click Next; the second step is to select a table or view from the record source list. You can also create a custom query using Structured Query Language (SQL), and the third step is to set which field outputs in the output table, and then query the maximum number of records returned and no record return prompts; the fourth step selects the output format for the query return record, and finally the page is *. ASP can save.
3. The output interface completes, also needs to establish a search form, first constructs a blank page, inserts the form, establishes your query condition, confirms the button item form attribute (as Figure 3).
In the pop-up dialog box, the radio is sent to the other object column, and then click the option button, in the pop-up dialog box "action" in the column entered in 2 of the completed file name . ASP, the method bar is post.
A simple example
Real-time query system for electricity electricity users
The database uses DB2 to establish, dsn=o-yd, according to the user name and the user number inquires the user's electricity usage situation, the user name uses the fuzzy inquiry obtains the user number, then according to the user number inquiry, here introduces uses the user number inquiry.
1. Query page (Figure 4): yhh-dfcx.asp
2. Results Display page (Figure 5): yhh-dfcx1.asp
Operation: Open yhh-dfcx.asp in IE, fill in the user number, select the query years, you can appear query results.
I hope this article will enable you to have a preliminary understanding of Web database applications.
This article is an English version of an article which is originally in the Chinese language on aliyun.com and is provided for information purposes only. This website makes no representation or warranty of any kind, either expressed or implied, as to the accuracy, completeness ownership or
reliability of the article or any translations thereof. If you have any concerns or complaints relating to the article, please send an email, providing a detailed description of the concern or
complaint, to email@example.com. A staff member will contact you within 5 working days. Once verified, infringing content will be removed immediately.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
and provide relevant evidence. A staff member will contact you within 5 working days.