Informix / UNIX
Posted in 2000
A poster asked whether SQL can be run against an Informix database straight from UNIX, or whether embedded SQL in C is required. Answer: use the dbaccess utility. Examples given include interactive use (dbaccess - -), piping statements in (echo "select tabname from systables where tabid > 99" | dbaccess sysmaster), and here-documents (dbaccess stores <<-EOF ... EOF), with arguments substitutable in scripts. A follow-up asked if this is Informix's sqlplus equivalent and what the system account is; the answer was that user 'informix' corresponds to Oracle's system user, with super-DBA rights and the ability to start/stop the engine.
Auto-generated by DrWatson from the posts below — may be imperfect; read the full thread.
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
Is it possible to connect to an Informix DB and perform SQL queries directly from UNIX or must you use embedded SQL in a programming language such as C.
We have a 'dbaccess' utility that provides this type of functionality.
Slaphead wrote:
> Is it possible to connect to an Informix DB and perform SQL queries
> directly from UNIX or must you use embedded SQL in a programming
> language such as C.
Mike,
I should have given a couple of examples of how to use dbaccess within a
script.
1) Method 1
dbaccess - -
>
The first '-' is for the initial database. The second is for the
script. If a '-' is used for the script, then that tells dbaccess that
it is expecting the commands to be entered on the next lines until a
<ctrl-C> is entered.
2) Method 2
echo "SQL commands " | dbaccess <database>
For example to select a list of the tables from systables within the
database sysmaster...
echo "select tabname from systables where tabid > 99" | dbaccess
sysmaster
3) Method 3 - the <<! technique....
This is really just another flavor of Method 2
dbaccess <<!
database sysmaster;
select tabname from systables where tabid > 99;!
Slaphead wrote:
> Is it possible to connect to an Informix DB and perform SQL queries
> directly from UNIX or must you use embedded SQL in a programming
> language such as C.
You can use with the DBACCESS
Eg.
If u want to use the stores database in the unix shell scripts
dbaccess stores <<-EOF
select * from order; ......
EOF
Even you can pass the arguments also in the queries.
Thanks
Zafar
"Slaphead" <mike@mwgw.freeserve.co.uk> wrote in message
news:3994830d.6874189@news.freeserve.net...
> Is it possible to connect to an Informix DB and perform SQL queries
> directly from UNIX or must you use embedded SQL in a programming
> language such as C.
\
Please check the other note that I posted. I included an example of how it
could be used within a script.
Abraham Oommen wrote:
> Is this equivalent to sqlplus for Oracle? Please advise as I am a newbie
> to Informix. Also what is the sys or system user for Informix?
>
> Madison Pruet wrote:
>
> > We have a 'dbaccess' utility that provides this type of functionality.
> >
> > Slaphead wrote:
> >
> > > Is it possible to connect to an Informix DB and perform SQL queries
> > > directly from UNIX or must you use embedded SQL in a programming
> > > language such as C.
--
Madison Pruet
===========================================
Enterprise Replication Product Developement
Dallas, Texas
Informix Software
===========================================
The equivalent of the system user in Oracle is user informix which has
super-DBA access to everything and can start or stop the engine.
Art S. Kagel
Abraham Oommen wrote:
>
> Is this equivalent to sqlplus for Oracle? Please advise as I am a newbie
> to Informix. Also what is the sys or system user for Informix?
>
> Madison Pruet wrote:
>
> > We have a 'dbaccess' utility that provides this type of functionality.
> >
> > Slaphead wrote:
> >
> > > Is it possible to connect to an Informix DB and perform SQL queries
> > > directly from UNIX or must you use embedded SQL in a programming
> > > language such as C.
The equivalent of the system user in Oracle is user informix which has
super-DBA access to everything and can start or stop the engine.
Art S. Kagel
Abraham Oommen wrote:
>
> Is this equivalent to sqlplus for Oracle? Please advise as I am a newbie
> to Informix. Also what is the sys or system user for Informix?
>
> Madison Pruet wrote:
>
> > We have a 'dbaccess' utility that provides this type of functionality.
> >
> > Slaphead wrote:
> >
> > > Is it possible to connect to an Informix DB and perform SQL queries
> > > directly from UNIX or must you use embedded SQL in a programming
> > > language such as C.
The equivalent of the system user in Oracle is user informix which has
super-DBA access to everything and can start or stop the engine.
Art S. Kagel
Abraham Oommen wrote:
>
> Is this equivalent to sqlplus for Oracle? Please advise as I am a newbie
> to Informix. Also what is the sys or system user for Informix?
>
> Madison Pruet wrote:
>
> > We have a 'dbaccess' utility that provides this type of functionality.
> >
> > Slaphead wrote:
> >
> > > Is it possible to connect to an Informix DB and perform SQL queries
> > > directly from UNIX or must you use embedded SQL in a programming
> > > language such as C.
The equivalent of the system user in Oracle is user informix which has
super-DBA access to everything and can start or stop the engine.
Art S. Kagel
Abraham Oommen wrote:
>
> Is this equivalent to sqlplus for Oracle? Please advise as I am a newbie
> to Informix. Also what is the sys or system user for Informix?
>
> Madison Pruet wrote:
>
> > We have a 'dbaccess' utility that provides this type of functionality.
> >
> > Slaphead wrote:
> >
> > > Is it possible to connect to an Informix DB and perform SQL queries
> > > directly from UNIX or must you use embedded SQL in a programming
> > > language such as C.