|
9 years ago 1 |
This is a tutorial that documents my successful installation
of Oracle Database 10g Express Edition & Oracle PRO*C on my
Linux Mint 32 bit computer.
Oracle offers a newer edition of Oracle express - Oracle Database Express Edition 11g Release 2 .
http://www.oracle.com/technetwork/products/express-edition/downloads/index.html
But this version only works for 32 bit Windows machines
and 64 bit Linux machines. So, this tutorial can be
useful for those Linux/Linux Mint users who are operating
on a 32 bit machine.
This Oracle Database 10g Express Edition & Oracle PRO*C install used the below Linux version:
anthony@an1:~ $ cat /etc/lsb-release
DISTRIB_ID=LinuxMint
DISTRIB_RELEASE=14
DISTRIB_CODENAME=nadia
DISTRIB_DESCRIPTION="Linux Mint 14 Nadia"
anthony@an1:~ $ uname -a
Linux an1 3.5.0-17-generic #28-Ubuntu SMP Tue Oct 9 19:32:08 UTC 2012 i686 i686 i686 GNU/Linux
http://www.linuxquestions.org/questions/linux-general-1/getting-the-linux-distribution-name-and-version-number-23726/
http://www.linuxquestions.org/questions/linux-general-1/how-to-check-linux-kernel-is-32-bit-or-64-bit-612352/
To install Oracle Database 10g Express Edition,
I used as a guide
http://www.debianhelp.co.uk/oracle.htm .
Per the suggestion in the above guide, I added
"deb https://oss.oracle.com/debian/ unstable main non-free"
("https", not "http")
to my "/etc/apt/sources.list" file .
I did not add
"deb-src http://oss.oracle.com/debian/ unstable main"
to my "/etc/apt/sources.list" file .
To perform the PRO*C install, I used as a guide
"Getting Started with Oracle Pro*C on Linux (Instant Client Zip Files)"
by Mark Williams
http://oradim.blogspot.com/2009/09/getting-started-with-oracle-proc-on.html
I downloaded the "Instant Client" packages from these links.
http://www.oracle.com/technetwork/topics/linuxsoft-082809.html
# Instant Client Package - Basic Lite
# Instant Client Package - SDK
# Instant Client Package - SQL*Plus
http://www.oracle.com/technetwork/topics/precomp-112010-084940.html
# Instant Client Package - Precompiler
anthony@an1:~/oracle $ ls *.zip
instantclient-basiclite-linux-11.2.0.3.0.zip instantclient-sdk-linux-11.2.0.3.0.zip
instantclient-precomp-linux-11.2.0.3.0.zip instantclient-sqlplus-linux-11.2.0.3.0.zip
Use "unzip" to unzip ".zip" files.
Unzipping will install the files in an "instantclient_11_2"
directory as suggested in the article.
Created "oic11.env" file and executed it to enable
Oracle paths in my shell, as suggested in the article.
To test the Oracle "Instant Client" package
installation, I modified the suggested command
line to successfully connect to SqlPlus.
-------------------------------------------
anthony@an1:~/oracle $ sqlplus hr/hr@an1:1521/XE
SQL*Plus: Release 11.2.0.3.0 Production on Wed Mar 27 09:04:30 2013
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
SQL>
-------------------------------------------
To compile and build the sample PRO*C file "proctest.pc",
I created a "PRO*C_Example" directory that contains
the sample code and "make" files.
1) Modified "proctest.pc" source code to refer to my login.
-- /* strncpy((char *) database.arr, "oel02:1521/XE", NAME_LEN); */
-- strncpy((char *) database.arr, "an1:1521/XE", NAME_LEN);
2) Copied a sample makefile from the downloaded PRO*C sample directory.
-- cp $ORACLE_HOME/sdk/demo/demo_proc_ic.mk .
3) Modified "pcscfg.cfg":
-- Added sys_include=/usr/include/i386-linux-gnu .
(path from my personal Linux Mint installation)
Used Linux command
dpkg-architecture -qDEB_HOST_MULTIARCH
to obtain correct include path.
4) Modified sys_include in "demo_proc_ic.mk"
as above to add "/usr/include/i386-linux-gnu"
to existing sys_include path .
5) Added
define=_STDIO_H
define=_STRING_H
define=_STDLIB_H
to beginning of "pcscfg.cfg" per suggestion from
https://community.oracle.com/message/288770
to prevent "stdarg.h", "stddef.h"
Thus, my "pcsdfg.cfg" looks like this:
define=_STDIO_H
define=_STRING_H
define=_STDLIB_H
sys_include=/usr/include
sys_include=/usr/include/i386-linux-gnu
ltype=short
6) Added "#define size_t long" to the beginning of "proctest.pc"
to prevent core dumps during compilation.
7) Modified "sql_error" in "proctest.pc" to
eliminate a compiler warning message.
-- /* printf("%.*s", msg_len, err_msg); */
-- printf("%.*s", (int) msg_len, err_msg);
I defined 2 "make" commands as suggested in the article.
make -f demo_proc_ic.mk build PROCFLAGS="common_parser=yes" EXE=proctest OBJS="proctest.o"
make -f demo_proc_ic.mk dust PROCDEMO=proctest
----------------------------------------------------
Executing "make" and "proctest" on my Linux computer, displaying output.
anthony@an1:~/oracle/PRO*C_Example$ make -f demo_proc_ic.mk build PROCFLAGS="common_parser=yes" EXE=proctest OBJS="proctest.o"
rm -rf SunWS_cachea
rm -rf /home/anthony/oracle/PRO*C/instantclient_11_2/libclntsh.so
make -f demo_proc_ic.mk PROCFLAGS="common_parser=yes" PCCSRC=proctest I_SYM=include= pc1
make[1]: Entering directory `/home/anthony/oracle/PRO*C_Example'
/home/anthony/oracle/PRO*C/instantclient_11_2/sdk/proc common_parser=yes iname=proctest include=. sys_include=\(/home/anthony/oracle/PRO*C/instantclient_11_2/sdk/include,/usr/include,/usr/include/i386-linux-gnu\)
Pro*C/C++: Release 11.2.0.3.0 - Production on Wed Apr 10 03:21:29 2013
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
System default option values taken from: /home/anthony/oracle/PRO*C/instantclient_11_2/precomp/admin/pcscfg.cfg
make[1]: Leaving directory `/home/anthony/oracle/PRO*C_Example'
/usr/bin/gcc -m32 -O2 -fPIC -DPRECOMP -I/home/anthony/oracle/PRO*C/instantclient_11_2/sdk/include -DLINUX -D_GNU_SOURCE -D_LARGEFILE64_SOURCE=1 -D_LARGEFILE_SOURCE=1 -DSLTS_ENABLE -DSLMXMX_ENABLE -D_REENTRANT -DNS_THREADS -c proctest.c
ln /home/anthony/oracle/PRO*C/instantclient_11_2/libclntsh.so.11.1 /home/anthony/oracle/PRO*C/instantclient_11_2/libclntsh.so
/usr/bin/gcc -m32 -o proctest proctest.o -g -L/home/anthony/oracle/PRO*C/instantclient_11_2/ -lclntsh -ldl -lm -lpthread
rm -rf /home/anthony/oracle/PRO*C/instantclient_11_2/libclntsh.so
anthony@an1:~/oracle/PRO*C_Example$ ./proctest
10, Jennifer Whalen, 4400, 1
20, Michael Hartstein, 13000, 1
20, Pat Fay, 6000, 2
30, Den Raphaely, 11000, 1
30, Alexander Khoo, 3100, 2
30, Shelli Baida, 2900, 3
40, Susan Mavris, 6500, 1
50, Adam Fripp, 8200, 1
50, Matthew Weiss, 8000, 2
50, Payam Kaufling, 7900, 3
60, Alexander Hunold, 9000, 1
60, Bruce Ernst, 6000, 2
60, David Austin, 4800, 3
70, Hermann Baer, 10000, 1
80, John Russell, 14000, 1
80, Karen Partners, 13500, 2
80, Alberto Errazuriz, 12000, 3
90, Steven King, 24000, 1
90, Neena Kochhar, 17000, 2
90, Lex De Haan, 17000, 3
100, Nancy Greenberg, 12000, 1
100, Daniel Faviet, 9000, 2
100, John Chen, 8200, 3
110, Shelley Higgins, 12000, 1
110, William Gietz, 8300, 2
nicely described
I personally prefer to use mysql. It is easy to install, free and helpful in web development.
A slightly confusing mix of random thoughts, loose snippets from the actual install instruction from Oracle (that you linked to) and random examples of embedded SQL in C.
Not impressed ...