Home » Server Options » Replication » Connection problem with Pro*C/C++
Connection problem with Pro*C/C++ [message #366465] Thu, 27 May 1999 12:53
Lee
Messages: 56
Registered: May 1999
Member
Please help !!!

I’m trying to run an a c/c++ program using Pro*C/C++, I’m clicking the “rebuilt all” on the “build” menu and I get following error:

Deleting intermediate files and output files for project 'Cv_demo - Win32 Debug'.
--------------------Configuration: Cv_demo - Win32 Debug--------------------
Performing Custom Build Step on .\CV_DEMO.PC
SQL*Plus: Release 8.0.5.0.0 - Production on Thu May 27 12:6:26 1999
(c) Copyright 1998 Oracle Corporation. All rights reserved.
ERROR:
ORA-12203: TNS:unable to connect to destination
Enter user-name:
Pro*C/C++: Release 8.0.5.0.0 - Production on Thu May 27 12:6:27 1999
(c) Copyright 1998 Oracle Corporation. All rights reserved.
Message 1024 not found; No message file for product=pro80, facility=PGOd:\apps\ORANT\pro80\pcscfg.cfg
PCC-F-02104, Unable to connect to Oracle
Error executing c:\winnt\system32\cmd.exe.

CV_DEMO.exe - 1 error(s), 0 warning(s)

I tried to recompile CV_DEMO.PC in Proc*C/C++ and it compiled ok, however when I try to do this in C/C++ I get this error.

I will greatly appreciate it if any one can help me with this problem (I started with Pro*C/C++ last week).

I’m using : Oracle 7.3 and 8, Pro*C/C++ 8.0.5.00, Visual C++ 6.0

The CV_DEMO.PC is as follow:

#include <STDIO.H>
#include <STDLIB.H>
#include <SQLCA.H>

/* Error handling function. */
void sql_error(void)
{
EXEC SQL WHENEVER SQLERROR continue;
printf("%.70s\n", sqlca.sqlerrm.sqlerrmc);
exit(1);
}

void main()
{
char temp32;

EXEC SQL BEGIN DECLARE SECTION;
char db_string20 = "PROD";
char password20 = "highlander";
char userid 10 = "lsagi";
char db_name10 = "PROD";

SQL_CURSOR emp_cursor;
int dept_num;
struct
{
int emp_num;
char emp_name11;
char job10;
int manager;
char hire_date10;
float salary;
float commission;
int dept_num;
} emp_info;

struct
{
short emp_num_ind;
short emp_name_ind;
short job_ind;
short manager_ind;
short hire_date_ind;
short salary_ind;
short commission_ind;
short dept_num_ind;
} emp_info_ind;
EXEC SQL END DECLARE SECTION;

EXEC SQL WHENEVER SQLERROR do sql_error();

EXEC SQL DECLARE prod DATABASE;

/* Connect to Oracle. */

EXEC SQL CONNECT :userid IDENTIFIED BY :password
at :db_name using :db_string;

/* Allocate the cursor variable. */
EXEC SQL ALLOCATE :emp_cursor;

/* Exit the inner for (;;) loop when NO DATA FOUND. */
EXEC SQL WHENEVER NOTFOUND DO break;

for (;;)
{
printf("\nEnter department number (0 to exit): ");
gets(temp);
dept_num = atoi(temp);
if (dept_num <= 0)
break;

EXEC SQL EXECUTE
begin
emp_demo_pkg.open_cur(:emp_cursor, :dept_num);
end;
END-EXEC;

printf("\nFor department %d--\n", dept_num);
printf("ENAME\t SAL\t COMM\n");
printf("-----\t ---\t ----\n");

/* Fetch each row in the EMP table into the data struct.
Note the use of a parallel indicator struct. */
for (;;)
{
EXEC SQL FETCH :emp_cursor
INTO :emp_info INDICATOR :emp_info_ind;

printf("%s\t", emp_info.emp_name);
printf("%8.2f\t\t", emp_info.salary);
if (emp_info_ind.commission_ind != 0)
printf(" NULL\n");
else
printf("%8.2f\n", emp_info.commission);
}
}

/* Close the cursor. */
EXEC SQL CLOSE :emp_cursor;

exit(0);
}
Previous Topic: Synchronising two tables
Next Topic: Snapshot Replication
Goto Forum:
  


Current Time: Thu Mar 28 15:29:47 CDT 2024