Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 79bde2d

Browse files
Add more C examples and update the makefile and README files (#447)
* Create simpleConnDemo.c Basic Connection and Query execution to Oracle Database * Update and rename drcp.c to drcpDemo.c Update the username and password to a generic string * Update makefile Make the makefile generic * Update simpleConnDemo.c Add the required setup and related blog details * Update simpleConnDemo.c Remove blog details. To be updated in README * Create sessionPoolingDemo Demo for OCI Session Pooling and Multithreading * Update README.md Add more details in the README.md file * Update README.md Minor change * Rename sessionPoolingDemo to sessionPoolingDemo.c Add .c extension in the file name * Update makefile Make the makefile more correct * Update makefile Add some comments
1 parent 538954f commit 79bde2d

File tree

5 files changed

+964
-12
lines changed

5 files changed

+964
-12
lines changed

‎C/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,11 @@
11
# Oracle Call Interface (OCI) Examples
22
This directory contains samples that uses Oracle Call Interface's C libraries for accessing and working with Oracle Database.
3+
It also contains a sample makefile that can be used to compile these samples and create executables.
4+
5+
List of files
6+
-------------
7+
| File Name | Description |
8+
|-----------|-------------|
9+
|[simpleConnDemo.c](./simpleConnDemo.c)| Shows a simple connection and query to Oracle Database using OCI. For explanation and the required setup, see the [blog](https://medium.com/oracledevs/oracle-call-interface-for-c-developers-simple-database-connection-and-query-58be8243a393).|
10+
|[sessionPoolingDemo.c](./sessionPoolingDemo.c)| Shows session pooling with Oracle Database using OCI Threads. For explanation and the required setup, see the [blog](https://medium.com/oracledevs/oracle-call-interface-for-c-developers-session-pooling-and-multithreading-87f56cec993a).|
11+
|[drcpDemo.c](./drcpDemo.c)| Shows a simple query with DRCP connection to Oracle Database using OCI|

‎C/drcp.c renamed to ‎C/drcpDemo.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
/* Copyright (c) 2022, Oracle. All rights reserved. */
1+
/* Copyright (c) 2022, 2025, Oracle. All rights reserved. */
22

3-
/* drcp.c */
3+
/* drcpDemo.c */
44

55
/* Oracle OCI Database Resident Connection Pooling (DRCP) Example */
66
/* Christopher Jones, 2022 */
@@ -11,8 +11,8 @@
1111
#include <unistd.h>
1212
#include <oci.h>
1313

14-
// const OraText userName[] = "SCOTT";
15-
// const OraText userPassword[] = "TIGER";
14+
// const OraText userName[] = "<username>";
15+
// const OraText userPassword[] = "<password>";
1616

1717
/* Take the user credentials as inputs*/
1818
OraText userName[129];

‎C/makefile

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,27 @@
1-
# Copyright (c) 2022, Oracle. All rights reserved.
2-
# Makefile for Oracle OCI Database Resident Connection Pooling (DRCP) Example
1+
# Copyright (c) 2022, 2025, Oracle. All rights reserved.
2+
# Makefile for Oracle Call Interface examples
33
# Christopher Jones, 2022
4+
# Sharad Chandran R, 2025
45

5-
IC=$(HOME)/instantclient_19_11
6+
# Update the instant client path here
7+
IC=$(HOME)/instantclient_19_26
68
OLIB=$(IC)
79
OINC=$(IC)/sdk/include
10+
DEMOS=drcpDemo simpleConnDemo sessionPoolingDemo
811

9-
#OH=/u01/app/oracle/product/12.1.0/dbhome_1
12+
# Uncomment the following 3 lines if you are using an
13+
# Oracle Database home
14+
#OH=/u01/app/oracle/product/19.26.0/dbhome_1
1015
#OLIB=$(OH)/lib
1116
#OINC=$(OH)/rdbms/public
1217

13-
drcp: clean
14-
$(CC) -Wall -Wextra -c -I$(OINC) drcp.c
15-
$(CC) -o drcp drcp.o -Wl,--rpath -Wl,$(OLIB) -L$(OLIB) -lclntsh
18+
.PHONY: all clean
19+
20+
all: $(DEMOS)
21+
22+
$(DEMOS): %: %.c
23+
$(CC) -Wall -Wextra -c -I$(OINC) $<
24+
$(CC) -o $@ $@.o -Wl,--rpath -Wl,$(OLIB) -L$(OLIB) -lclntsh
1625

1726
clean:
18-
rm -f drcp.o drcp
27+
rm -f $(DEMOS)*.o

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /