C program with Oracle database access


 
Thread Tools Search this Thread
Top Forums Programming C program with Oracle database access
# 1  
Old 06-23-2002
C program with Oracle database access

Hey,

I want to access oracle database through Unix C programming.. Can you through me some light on that...
# 2  
Old 06-23-2002
You need the Oracle Pro*C pre-compiler installed on your development machine. Basically, it allows you to embed SQL commands within your C programs. The pre-compiler simply converts all of the embedded SQL code into pure C code that may then be compiled into an executable. Your source code for Pro*C programs will have an extension of .pc (instead of .c). It works great and performace is outstanding!
# 3  
Old 06-24-2002
MySQL

If anyother way to access the Oracle database..? Thanks for an Info. Thanks yeslekmc.
# 4  
Old 07-02-2002
>If anyother way to access the Oracle database..? Thanks for an Info.
None, unless you yourself want to use the SQLCA, SQLDA, .. libraries, which is what the Precompiler exactly does with your .pc program.
# 5  
Old 07-02-2002
You can use the statement listed below to login to Oracle. It will run from within a shell script. I use a shell script to tie together several Oracle spool files and other programs

sqlplus -s /nolog @[filename] $var1

Example:

In shell script, prompt user to enter db_usr_name, db_passwd into one shell variable.

echo "Enter Oracle username and password"
stty -echo
read ora_pwd
stty echo

#ora_pwd format = user_name/passwd[@db_link]

sqlplus -s /nolog @spool_file_name $ora_pwd

#Enter this in the first line of the spool file and it will connect to #the Oracle DB.

connect &1.[@db_link]
set headsep !
set term off
set verify off
set colsep ' '
set feedback off
set timing off
set linesize 80
set pagesize 1000
...

Let me know if that helps or if you have any other questions.
# 6  
Old 07-12-2002
You can use OCI ( Oracle Call Interface) functions and libraries within you C/C++ code. This way of implementation is of the lowest level,enabling interaction between C/C++ application and that of Oracle.
Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. UNIX and Linux Applications

Identify a specific environment Oracle variable to connect a remote Oracle database ?

Good evening I nned your help pls, In an unix server i want to connect to a remote oracle databse server by sqlplus. I tried to find out the user/passwd and service name by env variable and all Ive got is this: ORACLE_SID_REPCOL=SCL_REPCOL ORACLE_SID=xmeta ORACLE_SID_TOL=SCL_PROTOLCOL... (2 Replies)
Discussion started by: alexcol
2 Replies

2. Solaris

Can't create database after Oracle Database installation

I installed Oracle 10 software on Solaris 11 Express, everything was fine execpt I can't create database using dbca.rsp file. I populated file with following options. OPERATION_TYPE = "createDatabase" GDBNAME = "solaris_user.domain.com" SID = "solaris_user" TEMPLATENAME = "General... (0 Replies)
Discussion started by: solaris_user
0 Replies

3. Shell Programming and Scripting

Korn shell program to parse CSV text file and insert values into Oracle database

Enclosed is comma separated text file. I need to write a korn shell program that will parse the text file and insert the values into Oracle database. I need to write the korn shell program on Red Hat Enterprise Linux server. Oracle database is 10g. (15 Replies)
Discussion started by: shellguy
15 Replies

4. UNIX for Dummies Questions & Answers

Access to a database

Hello all, is it possible to write a script in order to connect to a database, load data in a specific domain and execute the corresponding command? (3 Replies)
Discussion started by: FelipeAd
3 Replies

5. Shell Programming and Scripting

Database access

Hell all, I have the following snippet of code: $sql=qq{select * from ( select to_char(t.start_time_timestamp,'yyyy/mm/dd hh24:mi:ss') start_time,t.s_p_number_address, null cos_icsa_code, null cos_icsa_subcode from cc_unrated_msc_flow t union select... (2 Replies)
Discussion started by: chriss_58
2 Replies

6. Shell Programming and Scripting

Script that can access any type of(Teradata,Oracle) database

Hi, I need to create a script that can execute database independent queries. Database can be of any type whether tearadata,Mysql,oracle,DB2. Does anyone have any idea how to implement this. (3 Replies)
Discussion started by: monika
3 Replies
Login or Register to Ask a Question