Re: Sybase Tutorial
- From: ria_rohitraj@xxxxxxxxxxx
- Date: 25 Oct 2005 10:40:01 -0700
Thanks for the information.
I would like to know, how can I execute the qurries in my local
machine.
I have cygwin installed in my machine, and tried to install sqsh.
But it does not get installed.
If anybody knows a better way to set up the environment on my windows
machine please let me know.
thanks
ria.
pokerdragon wrote:
> D_Peglow wrote:
> > ria_rohitraj@xxxxxxxxxxx schrieb:
> >
> > > I am new to this group and looking for a good tutorial to start with
> > > sybase. I would like to know about how to execute the queries within a
> > > script. Please help.
> >
> > There a several ways to do it.
> >
> > Some Unix-Shells Scripts:
> >
> > #!/bin/sh
> > isql -U<USER> -P<PASSWORD> <<SQL
> > SELECT *
> > FROM Table
> > GO
> > SQL
> > # End
> >
> > Or put yor query in a file query.sql
> >
> > #!/bin/sh
> > isql -U<USER> -P<PASSWORD> -i query.sql
> > # end
> >
> > Dietmar
>
> Some enhancements to Dietmar's ideas:
>
> To avoid confision... the "SQL" in the above isn't saying put your SQL
> here... it's a delimiter that tells the script the beginning and the
> end of the actual statement. You can put any delimiter here... I
> usually use an exclamation point.
>
> Some issues if security is a concern:
> Ideally, you'll create a password variable, and populate it with some
> other command that grabs it, encrypted, from some location before
> calling the ISQL. Then, instead of specifying the -P on the isql
> command line, put the password variable as the very first line of your
> SQL. Otherwise the password will appear plain text to anyone who does
> a 'ps' on the box while the isql is running.
>
> So you would have:
>
> #!/bin/sh
>
> ## Call some script to retrieve the password
> SYBASE_PW=`/somepath/.get_password`
>
> ## Execute the sql
> isql -Uuser -Sserver << ! >>
> $SYBASE_PW
> select * from table
> go
> !
>
> At the very least, if you don't have a password generation script and
> have to hard code the password into the script, put it within the isql
> as above so it doesn't show up when doing a 'ps', and set read access
> on the script to only those who should know the password.
>
> You could pass the password in on the command line, but again, doing
> this causes it to appear when doing a PS during the entire time the
> script is running (as opposed to only when the isql statements are
> running). If this is an interactive script you could prompt for the
> password of course.
>
> Just keep in mind that the password has to be on a line by itself as
> the first line if your sql statement inside of your delimiter ('!',
> 'SQL', or whatever else you choose).
>
> The method of passing in the sql with the -i option also works, but
> again with this option you allow the password to be clearly displayed
> on a 'ps' listing while the isql is running.
>
> -Mike
.
- References:
- Sybase Tutorial
- From: ria_rohitraj
- Re: Sybase Tutorial
- From: D_Peglow
- Re: Sybase Tutorial
- From: pokerdragon
- Sybase Tutorial
- Prev by Date: Re: simple questions on field/table names and query
- Next by Date: find within range of values
- Previous by thread: Re: Sybase Tutorial
- Next by thread: Re: Sybase Tutorial
- Index(es):
Relevant Pages
|