Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / Ingres Topics / March 2007

Tip: Looking for answers? Try searching our database.

Embedded SQL

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
kodaliece@gmail.com - 21 Mar 2007 09:37 GMT
Hi,
I am trying to use embedded SQL to work with the Ingres database.
Following is the simple program I have written:

EXEC SQL INCLUDE SQLCA;
EXEC SQL WHENEVER SQLERROR STOP;
EXEC SQL CONNECT causp;
EXEC SQL DELETE FROM indexes WHERE id = 40;
EXEC SQL DISCONNECT;

But these embedded sql statements are not getting recognized and are
resulting in errors.
I am using Microsoft Visual Studio 2005 to write the programs. Can
anyone please tell me how to overcome this?

Thanks in advance
Mohan
John Dennis - 21 Mar 2007 10:00 GMT
Mohan,

You need to pre-process the embedded SQL code - esqlc is the utility.
This will convert the *.sc file to *.c which can then be compiled.

The process is described in the "Embedded SQL Companion Guide".

John

On Mar 21, 7:37 pm, kodali...@gmail.com wrote:
> Hi,
> I am trying to use embedded SQL to work with the Ingres database.
[quoted text clipped - 13 lines]
> Thanks in advance
> Mohan
kodaliece@gmail.com - 21 Mar 2007 10:13 GMT
Hi,
I've tried the command "esqlc -l file.cpp". But the error is: 'esqlc'
is not recognized as an internal or external command,
operable program or batch file.

Mohan

> Mohan,
>
[quoted text clipped - 13 lines]
> > EXEC SQL INCLUDE SQLCA;
> > EXEC SQL WHENEVER SQLERROR STOP;

> > EXEC SQL CONNECT causp;
> > EXEC SQL DELETE FROM indexes WHERE id = 40;
[quoted text clipped - 9 lines]
>
> - Show quoted text -
jpzuate@gmail.com - 21 Mar 2007 10:23 GMT
On 21 mar, 10:13, kodali...@gmail.com wrote:
> Hi,
> I've tried the command "esqlc -l file.cpp". But the error is: 'esqlc'
> is not recognized as an internal or external command,
> operable program or batch file.

Are Ingres variables setted in your environment ? (II_SYSTEM, PATH,
LIB and so on)
Jean-Pierre
Roy Hann - 21 Mar 2007 10:31 GMT
> Hi,
> I've tried the command "esqlc -l file.cpp". But the error is: 'esqlc'
> is not recognized as an internal or external command,
> operable program or batch file.

Is the pre-processor installed on the machine where you are doing this?
What is the PATH for the user who is compiling?

(Also it looks like you are trying to pre-process the wrong file.  esqlc
expects a file with a .sc suffix.)

Roy
kodaliece@gmail.com - 21 Mar 2007 10:52 GMT
what I am doing is write a C++ file and compile it. Is it not possible
to do in this way?
How can we know whether pre-processor is installed or not?

On Mar 21, 2:31 pm, "Roy Hann" <specia...@processed.almost.meat>
wrote:
> <kodali...@gmail.com> wrote in message
>
[quoted text clipped - 12 lines]
>
> Roy
jpzuate@gmail.com - 21 Mar 2007 11:07 GMT
On 21 mar, 10:52, kodali...@gmail.com wrote:
> what I am doing is write a C++ file and compile it. Is it not possible
> to do in this way?
> How can we know whether pre-processor is installed or not?

pre-processor come with the installation of Ingres ...

Are you trying to compile programm for Ingres without Ingres on the
machine ?
Even just a small client installation ?

Look if you can find files like version.rel or config.dat somewere on
your disks, you'll find then the root directory of Ingres (II_SYSTEM).

esqlc should be in the $II_SYSTEM/ingres/bin directory (or %II_SYSTEM%
\ingres\bin)

HTH
Roy Hann - 21 Mar 2007 11:11 GMT
> what I am doing is write a C++ file and compile it. Is it not possible
> to do in this way?

The words EXEC SQL ... are not C++ code are they?  They have to be
translated into API calls in C++ syntax before the C++ compiler ever gets to
see the code.

> How can we know whether pre-processor is installed or not?

There are various ways.  I am old and reactionary so I would do it as
follows.  Log in as the user who is trying to compile the code, start a DOS
window, and (assuming everying is on the C: drive):

 cd %II_SYSTEM%\ingres\bin
 dir esql*.exe

You should see esqlc.exe and esqlcc.exe.

Also, still in the DOS window:

 set

And look for PATH to see if the above ingres\bin directory is in the path.

Roy
kodaliece@gmail.com - 21 Mar 2007 12:36 GMT
Hi,
I have Ingres installed on my machine but I couldn't find esqlc.exe
and esqlcc.exe in my C:\IngresII\ingres\bin directory.
Is there any way to get these files.

On Mar 21, 3:11 pm, "Roy Hann" <specia...@processed.almost.meat>
wrote:
> <kodali...@gmail.com> wrote in message
>
[quoted text clipped - 25 lines]
>
> Roy
Roy Hann - 21 Mar 2007 13:56 GMT
> Hi,
> I have Ingres installed on my machine but I couldn't find esqlc.exe
> and esqlcc.exe in my C:\IngresII\ingres\bin directory.
> Is there any way to get these files.

You should be able to just re-run the Ingres installer on your machine.  It
will discover the existing installation and leave it alone.

I'm not sure an Ingres installation is enormous you should worry about
selecting just the specific components you want, so make sure you install
everything it offers you (including the documentation).

Don't get over-enthusiastic and select (strict) SQL-92 compliance though;
you certainly don't want that.

Roy
kodaliece@gmail.com - 21 Mar 2007 15:13 GMT
Hi
I've tried re-installing, but this didn't create the files esqlc.exe
and esqlcc.exe. Ingres gets installed on my machine when i install a
tool. Is this the reason for not installing those files. If so, what
can be the way to get these files?

Mohan

On Mar 21, 5:56 pm, "Roy Hann" <specia...@processed.almost.meat>
wrote:
> <kodali...@gmail.com> wrote in message
>
[quoted text clipped - 16 lines]
>
> Roy
Roy Hann - 21 Mar 2007 16:34 GMT
> Hi
> I've tried re-installing, but this didn't create the files esqlc.exe
> and esqlcc.exe. Ingres gets installed on my machine when i install a
> tool. Is this the reason for not installing those files. If so, what
> can be the way to get these files?

Hmm.  What is the name of the file that you downloaded from Ingres?   I
wonder if the preprocessors aren't in the package you got?

Roy
John Dennis - 22 Mar 2007 01:23 GMT
What "tool" are you installing which also installs Ingres? Perhaps the
provider of that tool does not deliver the application development
environment with their embedded Ingres.

John

On Mar 22, 1:13 am, kodali...@gmail.com wrote:
> Hi
> I've tried re-installing, but this didn't create the files esqlc.exe
[quoted text clipped - 3 lines]
>
> Mohan
kodaliece@gmail.com - 22 Mar 2007 04:34 GMT
Hi,
I've installed Unicenter Service Plus Knowledge Tool on my machine.
This automatically installs the Ingres database.
Mohan

> What "tool" are you installing which also installs Ingres? Perhaps the
> provider of that tool does not deliver the application development
[quoted text clipped - 13 lines]
>
> - Show quoted text -
John Dennis - 22 Mar 2007 06:23 GMT
It installs the Ingres database server components, but most likely not
the application development copmponents.  That's not part of the deal
to bundle the DBMS in with Unicenter.

John

On Mar 22, 2:34 pm, kodali...@gmail.com wrote:
> Hi,
> I've installed Unicenter Service Plus Knowledge Tool on my machine.
[quoted text clipped - 6 lines]
>
> > John
kodaliece@gmail.com - 22 Mar 2007 06:40 GMT
If it is the case then can't I even connect to the database from a
java program(through JDBC driver)?
Mohan

> It installs the Ingres database server components, but most likely not
> the application development copmponents.  That's not part of the deal
[quoted text clipped - 16 lines]
>
> - Show quoted text -
kodaliece@gmail.com - 22 Mar 2007 09:21 GMT
Hi,
I got esqlc.exe and esqlcc.exe files and copied them to C:\IngresII
\ingres\bin folder. Now the commands are working. But the error is
with program. Below is the program I've written:

#include <stdio.h>

void main() {

    EXEC SQL INCLUDE SQLCA;

    EXEC SQL WHENEVER SQLERROR STOP;

    EXEC SQL CONNECT causp;

    EXEC SQL DELETE FROM skeletons WHERE id = 40;

    EXEC SQL DISCONNECT;
}

If I issue the command esqlc filename.sc, I'am getting the following
error:
ESQL TestKT.sc:
%% Error in file TestKT.sc, Line 14:
E_EQ0205 End of file found in middle of line.
   The current line will be ignored by the preprocessor.

Can any one suggest what modifications need to be done in the program?

Thanks in advance
Mohan
Roy Hann - 22 Mar 2007 10:26 GMT
> Hi,
> I got esqlc.exe and esqlcc.exe files and copied them to C:\IngresII
[quoted text clipped - 18 lines]
>
> Can any one suggest what modifications need to be done in the program?

To my naked eye that looks fine (although I might have included the SQLCA
outside the scope of main()).

If you look in %II_SYSTEM%ingres\files do you see a file called eqdef.h?
That's what is being included, so it needs to be there.  If you don't have
it, presumably you can get it from wherever you got the esqlc.exe.  I have
no idea if you'd get the particular error you are seeing if it doesn't exist
though.

Roy
kodaliece@gmail.com - 22 Mar 2007 11:54 GMT
Hi,
I could see the eqdef.h file at the location %II_SYSTEM%ingres\files.
But still this program is throwing the same error.
Mohan

> To my naked eye that looks fine (although I might have included the SQLCA
> outside the scope of main()).
[quoted text clipped - 8 lines]
>
> - Show quoted text -
ac297@dial.pipex.com - 22 Mar 2007 12:13 GMT
Quoting kodaliece@gmail.com:

> Hi,
> I could see the eqdef.h file at the location %II_SYSTEM%ingres\files.
> But still this program is throwing the same error.
> Mohan

First, try and compile this:

#include <stdio.h>

void main() {
}

If that works, continue with

#include <stdio.h>

void main() {
EXEC SQL INCLUDE SQLCA;
}

I'm expecting that to fail (it's another include command)..

if not just carry on adding code until you see the offending line.

As others have said, copying files one at a time is a really bad approach.

Paul
kodaliece@gmail.com - 22 Mar 2007 14:16 GMT
Hi,
Now I am able to generate the '.c'  file. But the problem is if I try
to compile the file it is showing the "unresolved external symbol"
errors. But the header files are included in the c program and the
header files contain the prototype of these functions. Still it is
throwing the errors.
Mohan
ac297@dial.pipex.com - 22 Mar 2007 14:44 GMT
Quoting kodaliece@gmail.com:

> Hi,
> Now I am able to generate the '.c'  file. But the problem is if I try
> to compile the file it is showing the "unresolved external symbol"
> errors. But the header files are included in the c program and the
> header files contain the prototype of these functions. Still it is
> throwing the errors.

Missing libraries, or incorrect library path probably..

> Mohan
>
> _______________________________________________
> Info-Ingres mailing list
> Info-Ingres@kettleriverconsulting.com
> http://www.kettleriverconsulting.com/mailman/listinfo/info-ingres

--
John Dennis - 22 Mar 2007 11:53 GMT
There's more files needed than just the executables.  The .h files,
libraries, etc... And you can't necessarily simply copy programs from
one installation to another - if the versions are different there's no
guarantee anything will work.

John

On Mar 22, 7:21 pm, kodali...@gmail.com wrote:
> Hi,
> I got esqlc.exe and esqlcc.exe files and copied them to C:\IngresII
[quoted text clipped - 28 lines]
> Thanks in advance
> Mohan
Tim Ellis - 21 Mar 2007 10:04 GMT
On Mar 21, 8:37 am, kodali...@gmail.com wrote:
> Hi,
> I am trying to use embedded SQL to work with the Ingres database.
[quoted text clipped - 13 lines]
> Thanks in advance
> Mohan

You are remembering to pre-compile the code before compiling it?
For C programs use  esqlc -f<output filename> <input filename>
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.