Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: [Pro*C] Newbie question.

Re: [Pro*C] Newbie question.

From: J. Wegener NOSPAM <xjw_at_xdde.xdk>
Date: Mon, 5 Jul 1999 13:54:47 +0200
Message-ID: <7lq6bi$i6u$1@news101.telia.com>


Yi, Ji-soo <killcat_at_insunginfo.co.kr> skrev i en nyhedsmeddelelse:7louje$gm9$1_at_news.kren.nm.kr...
> We have two Solaris machines. One is an Oracle DB Server, and the other is
a
> Web Server with Apache. I want to build cgi program on Web Server which
> gather information from the Oracle DB Server. The Web Server doesn't
contain
> any Oracle program. (The DB Server opens only telnet port to Web Server.)
>
> 1. Is it possible? I'm afraid that the web server also have sort of DB
> connection program or library. Additionally, is it necessary to open
another
> port for DB connection(like 1433 port for SQL Server)?

Yes, it is possible, but you MUST install the Oracle networking software on the Web Server before your CGI program can connect to the Oracle server. I can't see why that is something to be afraid of (if I understand you correctly)? Oracle networking software usually uses TCP/IP port 1521 and/or 1526, if thats the protocol you want to use.

> 2. If possible, how to do?

A very brief intro:

a) Install the Oracle networking software on your Web server
b) Start the "Listener" on your DB server, if necessary (probably not)
c) Define a connection alias on the Web server that refers to your DB
server. I am not quite sure how this is done on Solaris though... You typically need to define aliasname, tcp/ip hostname or IP address, listerner port number and Oracle instance name. e.g. "Myalias", "192.168.23.1", "1521", "ORCL".
d) Create your Pro*C program and have it log in using your newly defined alias, e.g:
...
EXEC SQL BEGIN DECLARE SECTION;
  char szUserInfo[100];
EXEC SQL END DECLARE SECTION;
...
strcpy(szUserInfo, "username/password_at_Myalias"); EXEC SQL CONNECT :szUserInfo;
....

> 3. Could you tell me resources(tutorial or sample code) which help me
> understand the process?

See the Oracle Net8 guide together with the Pro*C Programmer's Guide. It contains a lot of examples.

Cheers,
Johan
--
Johan Wegener
Reply to: xjw_at_xdde.xdk
NOSPAM: Delete xxx from my email address Received on Mon Jul 05 1999 - 06:54:47 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US