Connect to DATA BASE (ORACLE)

S

sanjay

Hi to all the people. please will u tell how can i Connect to the
Database through C program. i have No clarity in that.
 
W

Walter Roberson

Hi to all the people. please will u tell how can i Connect to the
Database through C program. i have No clarity in that.

It is not possible using only routines that are part of standard C.
You will need to use routines that are not part of C itself
(though, of course, calling those routines from within your C program).

For some operating systems and some databases, you can use
operating-system supplied routines to make the connection, with
the operating system providing a standard connection interface
that is database independant.

For other operating systems, or for databases that do not have
that kind of interface available, or for doing operations that are
not within the scope of those operating-system supplied interfaces,
you will have to use routines supplied by the database manufacturer.

Some databases provide an interface that is based upon TCP/IP
network protocols, with it being expected that you will do all
the hand-coding to open a network connection and communicate back
and forth with the database.

Clearly the details of how you should proceed vary, based upon
product and operating system differences. There is no standard way
to communicate with -all- kinds of databases (though some have
evolved well-defined interfaces intended for use amongst multiple
competing products.)

For further details, you will need to consult a newsgroup
that deals with your particular database, and possibly also a
newsgroup that deals with your operating system.
 
U

user923005

Hi to all the people. please will u tell how can i Connect to the
Database through C program. i have No clarity in that.

Probably, one of the oracle or database newsgroups is a better bet
than
The language itself does not offer any pre-defined method to do that.

There are ways to connect to a database that have standards for them:

1. Embedded C or Module Language C : http://www.itl.nist.gov/div897/ctg/sql_form.htm
2. ODBC or SQL/CLI (see : http://www.sqlsummit.com/DataAcce.htm )
3. OLEDB (see : http://www.sqlsummit.com/DataAcce.htm )
4. .NET (assumes Windows or MONO) (see : http://www.sqlsummit.com/DataAcce.htm
)

You can also connect with a database specific API. Oracle's API is
called OCI: http://www.oracle.com/technology/tech/oci/index.html
You can also connect with a tool designed for that sort of thing like
OTL: http://otl.sourceforge.net/

Probably, you will want to find a newsgroup that caters to your exact
question (which is not really about the C programming language at
all).
 
S

sanjay

Hi walter thx for ur reply. it is interesting to read but when i go back
to coding it still hasnt helped me know what to type :(
 
W

Walter Roberson

Hi walter thx for ur reply. it is interesting to read but when i go back
to coding it still hasnt helped me know what to type :(

Well, I don't know what you need to type either. The C language
standards say nothing about what you have to type for your situation,
so we can't consult them on the matter.

If I were inclined to deconstruct Mr. Roberson's response, quoted
just above, I suspect that it would come out something like:

- You asked your question in the wrong place. The answer is not
to be found within any definition of the C language.

- The *right* place for you depends on which operating system you
are using, and upon the database (Oracle) that you are using.

- No, we're not just "pretending" not to know the answer in order to
get you to go away. We don't *know* the answer for your situation,
and we *can't* know the answer for your situation, as our mind-
reading skills do not extend as far as knowing which operating system
(or operating systems) you plan to use for your project.

- Since -you- know which operating system you are using, the person
most likely to be able to find the right place to ask your question,
is *you*. So we suggest that *you* search for an appropriate place
using a web or newsgroup searching engine.

- Even if we knew what operating system you are using, this would
*still* not be an appropriate place to ask the question, as this
newsgroup does not deal with databases or the communications with
databases.

And if I were inclined to deconstruct the above deconstruction, I
might come out with something like:

- Warning: if you persist in asking about this topic here, then any
further responses might *look* reasonable but might have been chosen
to fail at the last moment, just when you need a working program the most.
We are experts in providing contradictory or subtly misleading answers
to off-topic questions, so if you want *accurate* answers to your
questions, you should ask somewhere else.
 
K

kk

Hello,

By using pro*c you can connect database. what's ur os. first create a
file and save it with extension name is .pc and compile it with proc
<filename.pc> then compile it with cc and execute it with a.out if u r
using unix os.

the code looks like this:

#include <sqlca.h>
main()
{

varchar uid[]="system",passwd[]="manager";

EXEC SQL connect :uid identified by :passwd;

printf("successfully connected to database");

/* u r code goes here */

}
 
D

Default User

sanjay said:
Hi walter thx for ur reply. it is interesting to read but when i go
back to coding it still hasnt helped me know what to type :(

You still aren't getting the message. You are in the wrong group.
Either find a group or mailing list for your software package, or try
comp.databases.

Drop the text-speak.

Please don't top-post. Your replies belong following or interspersed
with properly trimmed quotes. See the majority of other posts in the
newsgroup, or:
<http://www.caliburn.nl/topposting.html>




Brian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,169
Messages
2,570,915
Members
47,456
Latest member
JavierWalp

Latest Threads

Top