Академический Документы
Профессиональный Документы
Культура Документы
Table of Contents
EMPLOYEE INFORMATION SYSTEM USING EMBEDDED SQL ....................................................... 3 1. 2. 3. 4. 5. SOFTWARE REQUIREMENTS ...................................................................................... 3 FILES USED .......................................................................................................... 3 BACKGROUND ....................................................................................................... 4 STEPS TO PRE-COMPILE PROC (.PC) FILES ORACLE 9X ................................................... 5 STEPS TO PRE-COMPILE PROC (.PC) FILES ORACLE 10G/11G ........................................... 9
10. STEPS TO EXECUTE THE PROJECT (VISUAL STUDIO 2008 & ORACLE 9I/10G/11G) .................. 9 11. STEPS TO CONNECT TO ORACLE SERVER FROM CLIENT M/CS ......................................... 19
This document describes the step by step deployment process of Employee Information system.
1.
Software Requirements
C Oracle 9i or Higher versions. Microsoft Visual Studio 6.0 or VS 2005 or VS 2008 or any other IDE. Pro *C/C++ .
2.
Files used
Main folder : Integrated Project artifacts Folder/File Location Employee Information System - Embedded SQL using C Oracle \Employee Information System_Project_ Files
Description Contains the project executable along with the linker file and debug database. Contains the Debug folder and source code file. Intellisense Database. MS Visual studios solution file. Database Design Project Specification Employee Info System : Folder This folders contains: Location build log and all object modules. Employee Information System - Embedded Pro C source files with embedded SQL. SQL using C Oracle \Employee C Source code after pre-compilation and header files. Information System_Project_ Files Project file. \Employee Info System Pro C : Folder Department.pc Location Emp.pc Employee Information System - Embedded Login.pc SQL using C Oracle \Employee MainFuncion.pc Information System_Project_ Files \Employee Info System \Pro C files
3
3.
Background
Embedded SQL is a method of combining the computing power of a high-level language like C/C++ and the database manipulation capabilities of SQL. It allows you to execute any SQL statement from an application program. Oracle's embedded SQL environment is called Pro*C. A Pro*C program is compiled in two steps. First, the Pro*C precompiler recognizes the SQL statements embedded in the program, and replaces them with appropriate calls to the functions in the SQL runtime library. The output is pure C/C++ code with all the business logic intact along with appropriate low level calls. Then, a regular C/C++ compiler is used to compile the code and produces the executable. The Pro*C pre-compiler replaces each of the Pro*C calls with appropriate C/C++ calls. The C/C++ compiler then compiles and links the generated C/C++ program like any other regular program. The linker needs to know the locations of the Sybase- or Oracle-specific libraries. Embedded SQL syntax is similar to normal SQL syntax. The data read from the table is received and stored in special host programming language variables known as host variables.
4.Steps
1. Open the Pro * C/C++ compiler by selecting Start All Programs Oracle OraHome92 Application development Pro C-C++ 2. In the Pro * C/C++ window select Edit menu Add option or click the + button on the toolbar
3. From the input file dialog select .PC files and click on Open.
5. Double click on the file listed in the Output File section to open the Output File dialog. Select the Destination folder to store the output of pre-compilation.
6. Select the files which you want to pre-compile and select File menu Precompile or click the precompile button on tool bar.
7. You will get Precompiling finished message if the process is successful. A green tick mark will appear against each file as shown in the fig. above. In case, if an error occurs during the precompilation, a red cross will appear against the failed file. Click on the cross to view the message box, to see the error.
8. Modify the code and repeat steps. 9. Once all the files are pre-complied you can resume with the normal compilation and execution process using the Microsoft Visual Studio IDE.
8
5.Steps
1. Open the Command prompt and type the following command for pre compilation:
2. You will get Pre compiling finished message if the process is successful and the precompiled file (.c) file will be saved in the same folder.
Note : Same steps can be followed to execute the project in Visual Studio 6.0 / Visual Studio 2005.
Step 1: Click on start -> Programs -> Microsoft Visual Studio 2008 -> Microsoft Visual Studio 2008 Step 2: The Microsoft Visual Studio 2008 IDE opens.
Step 3: To execute the C program, you have to first create a project workspace. A workspace is a container for all the files that make up a project. Click on the menu option File -> New ->Project. You will get the following screen:
10
In this window, Visual C++ should be selected from the project types. From the template types, select Win32 Console Application. The project workspace you create will by default be stored in the following path: C:\Documents and Settings\username\Visual Studio 2008\Projects. If you want to change the default path, click on the browse button and select the required location. Type the name of the project in the Project Name field. Example: Assignment1 Click on OK. Step 4: You get the following screen wherein you can select the next button to create an empty project.
11
Step 5: Since we are creating a new application, select An empty project option and then click on the Finish button.
12
The project workspace has been created now. Check to make sure that a folder by name Assignment1 has been created. Observe that inside this folder Assignment1 many other supporting files will be created. A folder by the name Debug will also be created with some files in it. The executables created, after compilation and linking will be stored in this Debug folder. Step 7: Once the workspace has been created, the source code has to be written. For this we need to add the existing source files after the pre compilation process. Solution explorer snapshot is given below:
13
Step 8: In the solution explorer window right click on the resources folder and select the Existing Item option from the drop down.
14
Copy orasql10 from D:\oracle\product\10.2.0\db_2\precomp\lib\ and paste in Visual Studio IDE Resources folder Copy orasqx10 from D:\oracle\product\10.2.0\db_2\precomp\lib\msvc and paste in Visual Studio IDE resource folder
Step 9: Copy all header files from D:\oracle\product\10.2.0\db_2\precomp\public folder and paste in Visual Studio folder i.e., D:\VS\VC\include
15
Step 10: In the solution explorer window right click on the Header Files folder and select the Existing Item option from the drop down. Locate header files of your project viz., db.h, Emp.h, Department.h, etc., and add all these header files to IDE.
16
Step 11: Before you execute your code, pre-compilation is necessary in order to convert the embedded SQL into C/C++ calls. You can locate these files at Pro C files folder. (Project\Employee Information System - Embedded SQL using C Oracle\src\Employee Info System\Pro C files) Open the Command prompt and type the following command for pre compilation:
You will get Pre compiling finished message if the process is successful.
17
Once all the files are pre-complied, you can resume with the normal compilation and execution process using the Microsoft Visual Studio IDE. Step 12: In the solution explorer window right click on the Source folder and select the Existing Item option from the drop down.
Step 13: Database creation: In order to run the project, we need to create Oracle tables. The schema definitions are documented and you can find the same at Projects\Employee Information System - Embedded SQL using C Oracle\Database. Please use the default login ID and password (User: Scott Password: Tiger) to connect to the database. Step 14: Now you are ready with the Project. Run the Project by pressing F5.
18
<<Follow the steps in the attached document to perform the above mentioned steps>>
19