Employee Information System C Oracle Deployment Steps

19
1 Employee Information System User Guide for Deployment Author(s) Department Project

description

campus connect

Transcript of Employee Information System C Oracle Deployment Steps

Page 1: Employee Information System C Oracle Deployment Steps

1

Employee Information System

User Guide for Deployment

Author(s)

Department

Project

Page 2: Employee Information System C Oracle Deployment Steps

2

Table of Contents

EMPLOYEE INFORMATION SYSTEM USING EMBEDDED SQL ....................................................... 3

1. SOFTWARE REQUIREMENTS ...................................................................................... 3

2. FILES USED .......................................................................................................... 3

3. BACKGROUND ....................................................................................................... 4

4. STEPS TO PRE-COMPILE PROC (.PC) FILES – ORACLE 9X ................................................... 5

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/C’S ......................................... 19

Page 3: Employee Information System C Oracle Deployment Steps

3

Employee Information System using Embedded SQL

The Employee Information System is a project created with an objective of integrating the use of C language with Relational Database Management System (RDBMS). The project is an Employee Information system to maintain the details about departments and employees. The

data has to be maintained in a database tables using a suitable RDBMS (e.g. Oracle). The system should be

designed and coded in C language.

This document describes the step by step deployment process of Employee Information system.

1. Software Requirements

Programming Language C

Database Oracle 9i or Higher versions.

IDE Microsoft Visual Studio 6.0 or VS 2005 or VS 2008 or any other IDE.

Pre-Complier Pro *C/C++ .

2. Files used Main folder : Integrated Project artifacts

Folder/File Description

Location Employee Information System - Embedded SQL using C Oracle \Employee Information System_Project_ Files

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 Location Employee Information System - Embedded SQL using C Oracle \Employee Information System_Project_ Files \Employee Info System

This folders contains:

build log and all object modules.

Pro C source files with embedded SQL.

C Source code after pre-compilation and header files.

Project file.

Pro C : Folder Location Employee Information System - Embedded SQL using C Oracle \Employee Information System_Project_ Files \Employee Info System \Pro C files

Department.pc

Emp.pc

Login.pc

MainFuncion.pc

Page 4: Employee Information System C Oracle Deployment Steps

4

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.

Page 5: Employee Information System C Oracle Deployment Steps

5

4. Steps to Pre-Compile ProC (.pc) files – Oracle 9x

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.

Page 6: Employee Information System C Oracle Deployment Steps

6

4. These files will be added to the Input File section

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.

Page 7: Employee Information System C Oracle Deployment Steps

7

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 pre-compilation, a red cross will appear against the failed file. Click on the cross to view the message box, to see the error.

Page 8: Employee Information System C Oracle Deployment Steps

8

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.

Page 9: Employee Information System C Oracle Deployment Steps

9

5. Steps to Pre-Compile ProC (.pc) files – Oracle 10G/11G

1. Open the Command prompt and type the following command for pre compilation:

proc iname=<file path>

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.

10. Steps to Execute the Project (Visual Studio 2008 & Oracle

9i/10g/11G)

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.

Page 10: Employee Information System C Oracle Deployment Steps

10

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:

Page 11: Employee Information System C Oracle Deployment Steps

11

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.

Page 12: Employee Information System C Oracle Deployment Steps

12

Step 5: Since we are creating a new application, select “An empty project” option and then click on the Finish button.

Page 13: Employee Information System C Oracle Deployment Steps

13

Step 6: Click on Finish and you see the following screen.

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:

Page 14: Employee Information System C Oracle Deployment Steps

14

Step 8: In the solution explorer window right click on the resources folder and select the Existing Item option from the drop down.

Page 15: Employee Information System C Oracle Deployment Steps

15

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

Page 16: Employee Information System C Oracle Deployment Steps

16

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.

Page 17: Employee Information System C Oracle Deployment Steps

17

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:

proc iname=<file path>

You will get Pre compiling finished message if the process is successful.

Page 18: Employee Information System C Oracle Deployment Steps

18

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.

Page 19: Employee Information System C Oracle Deployment Steps

19

11. Steps to connect to Oracle server from client M/C’s

Background: With regard to Oracle installation there are 2 scenarios that can exist in the training venue:

1. Oracle server (9i/10G/11G) is installed in all training machines 2. One instance of Oracle Server(9i/10G/11G) is installed in the server machine and oracle

client(9i/10G/11G) is installed in all training (Client) machines Steps to be followed in case of Scenario 2: Ensure that the following things are taken care of before executing the Integrated Project:

Oracle Database has been created in the Server machine

Listener for the database has been created in the Server machine

Network Service Name is created for corresponding listener in the client machines

You are able to connect from SQL PLUS in the client machine to the Oracle Server

<<Follow the steps in the attached document to perform the above mentioned steps>>

Steps to Oracle Client Server Connectivity.docx