A simple example of the configuration of proc in a Linux-C + + operation database

Source: Internet
Author: User

The ORACLE11G database was installed on the virtual machine and was originally intended to be used in a C/s + + learning operations database. The result was a big pit. It took two days from the installation of the Oracle database to the configuration of the proc compilation options. But it made me realize that I was weak: 1. There is not enough use of Linux commands and scripts. 2. The role of Linux folders is not well understood; (plan to add a summary blog next time.) 3. English is still very bad for me. Good as the real question.

Because I introduced the configuration, do not want to toss, so there is no error in reproducing, just say the idea and the contents of the configuration file.

The role of the. Bash_profile in the 1.oracle user root is: ~/.bash_profile: Each user can use the file to enter the shell information that is dedicated to their own use, and when the user logs in, the file executes only once! By default, he sets some environment variables, Executes the user's. bashrc.

So configure the. bash_profile file first because the installation directory is different to the corresponding changes.

  

. bash_profile     # Get the aliases and functions   if [-f ~/.BASHRC]; then           . ~/.bashrc  fi     # User specific Environment and startup programs  umask 022  oracle_base=/u01/  oracle_home= $ORACLE _base/oracle/  OACLE_SID=ORCL  path= $PATH: $HOME/bin: $ORACLE _home/bin  ld_library_path= $ORACLE _home/lib:/usr/lib  # Lang=c  export oracle_base oracle_home oracle_sid PATH ld_library_path lang~

2. There is the configuration Precomp/admin folder under the pcscfg.cfg is mainly added proc library files and Oracle's home directory

Sys_include=/u01/precomp/public

Sys_include=/u01/oraclesys_include=/usr/includesys_include=/u01/oracle/lib/code=cppcpp_suffix=ccparse=none Oracle_base=/u01/oracle_home= $ORACLE _base/oracle/export oracle_base oracle_home

 

 

3.oracle data start-up and shutdown

Sqlplus/scott/password
Startup-Start the database
Shutdown immediate--Close the database
 
4. Start monitoring
Lsnrctl

5.proc compiling. pc files
Proc DM01_HELLO.PC
Pro*c/c++: Release 11.2.0.1.0-production on Tue Oct 11 11:20:50 2016
Copyright (c) 1982, the Oracle and/or its affiliates. All rights reserved.
System default option values taken from:/u01/oracle/precomp/admin/pcscfg.cfg

6. Compile the generated. cc files remember to add the corresponding header file path after the engineering writing can be written as makefile form

g++ dm01_hello.cc-o dm01_hello-i/u01/oracle/precomp/public/-l/u01/oracle/lib/-lclntsh

The corresponding dm01_hello.pc file

#include <stdio.h>#include<string.h>#include<string.h>#include"sqlca.h"EXEC SQL BEGIN DECLARE section;Char*serverid ="Scott/[email protected]"; EXEC SQL END DECLARE section; intMain () {intRET =0; printf ("hello....\n"); printf ("serverid:%s \ n", ServerID);         EXEC SQL Connect:serverid; if(Sqlca.sqlcode! =0) {ret=Sqlca.sqlcode; printf ("EXEC SQL connect:err,%d\n", ret); returnret; } printf ("Connect ok\n"); returnret;}

7. Results: 

[Email protected] day3]$./dm01_hello
Hello ....
Serverid:scott/[email protected]
Connect OK

  

A simple example of the configuration of proc in a Linux-C + + operation database

Contact Us

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: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.