Re: [GENERAL] Database connectivity using a unix shell

2006-07-05 Thread Joshua D. Drake
On Wednesday 05 July 2006 10:29, Richard Broersma Jr wrote: > > On Wednesday 05 July 2006 09:11, Jasbinder Bali wrote: > > > Hi, > > > Before using ECPG, i had a few questions. > > > Lets say i have a C code and want to do something with my postgres > > > database. > > > What all header files do i

Re: [GENERAL] Database connectivity using a unix shell

2006-07-05 Thread Richard Broersma Jr
> On Wednesday 05 July 2006 09:11, Jasbinder Bali wrote: > > Hi, > > Before using ECPG, i had a few questions. > > Lets say i have a C code and want to do something with my postgres > > database. > > What all header files do i need for ECPG. > > Also how and where exactly am i going to write these

Re: [GENERAL] Database connectivity using a unix shell

2006-07-05 Thread Joshua D. Drake
On Wednesday 05 July 2006 09:11, Jasbinder Bali wrote: > Hi, > Before using ECPG, i had a few questions. > > Lets say i have a C code and want to do something with my postgres > database. > > What all header files do i need for ECPG. > Also how and where exactly am i going to write these EXEC SQL s

Re: [GENERAL] Database connectivity using a unix shell

2006-07-05 Thread Jasbinder Bali
Hi,Before using ECPG, i had a few questions.Lets say i have a C code and want to do something with my postgres database. What all header files do i need for ECPG.Also how and where exactly am i going to write these EXEC SQL statements for ECPG. Can I be briefed about the steps to do this.Regards,~J

Re: [GENERAL] Database connectivity using a unix shell

2006-06-29 Thread Richard Broersma Jr
> What if I don't have a shell script and instead of that I have a C code and > need to connect to the postgres database. > How do i accomplish this? do i still need to call this psql clinet interface > or there is some other way to do it.. In this case you could use ecpg: http://www.postgresql.or

Re: [GENERAL] Database connectivity using a unix shell

2006-06-29 Thread Peter Wilson
Are you just asking random questions? What do you actually want to do? You've asked how to access Postres from a shell - now you're using 'C'. Are you going to work your way through Java, Perl and a host of others. All of this information is *very* clearly available in the manual at: http://www.

Re: [GENERAL] Database connectivity using a unix shell

2006-06-29 Thread Jasbinder Bali
What if I don't have a shell script and instead of that I have a C code and need to connect to the postgres database. How do i accomplish this? do i still need to call this psql clinet interface or there is some other way to do it.. ~JasOn 6/29/06, Scott Marlowe <[EMAIL PROTECTED]> wrote: On Thu, 2

Re: [GENERAL] Database connectivity using a unix shell

2006-06-29 Thread Chris Browne
[EMAIL PROTECTED] ("Jasbinder Bali") writes: > in my bash script where and how do i specify the database connection > parameters There are three ways: 1. You can store them in environment variables: PGDATABASE=my_database PGPORT=8901 PGUSER=superman PGHOST=some.host.somewhere export PGDATABASE

Re: [GENERAL] Database connectivity using a unix shell

2006-06-29 Thread elein
This is a variation of the same: a=`psql -U postgres -h my.host.dom -Atc "select col1 from sometable where col2=6" dbname` echo $a Note that the -U and -h can specify the user name and hostname if necessary. -A gets the data unaligned -t gets the data without the decorations -c "query" specifie

Re: [GENERAL] Database connectivity using a unix shell

2006-06-29 Thread Richard Broersma Jr
> isn't my normal bash script different from psql. > In a bash script how wud u specify the db parameters This link might have something that you would like? http://www.psn.co.jp/PostgreSQL/pgbash/index-e.html Regards, Richard Broersma Jr. ---(end of broadcast)-

Re: [GENERAL] Database connectivity using a unix shell

2006-06-29 Thread Alan Hodgson
On Thursday 29 June 2006 09:08, "Jasbinder Bali" <[EMAIL PROTECTED]> wrote: > in my bash script where and how do i specify the database connection > parameters man psql -- Alan ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner wil

Re: [GENERAL] Database connectivity using a unix shell

2006-06-29 Thread Scott Marlowe
On Thu, 2006-06-29 at 11:29, Jasbinder Bali wrote: > isn't my normal bash script different from psql. > In a bash script how wud u specify the db parameters Look at how I'm doing it here: > > > query="select * from sometable"; > > > a=`echo $query|psql -tq dbname`; Note that I'm

Re: [GENERAL] Database connectivity using a unix shell

2006-06-29 Thread Jasbinder Bali
isn't my normal bash script different from psql. In a bash script how wud u specify the db parameters  On 6/29/06, Scott Marlowe <[EMAIL PROTECTED]> wrote: On Thu, 2006-06-29 at 11:08, Jasbinder Bali wrote:>> On 6/29/06, Scott Marlowe < [EMAIL PROTECTED]> wrote:> On Thu, 2006-06-29 at 10:24

Re: [GENERAL] Database connectivity using a unix shell

2006-06-29 Thread Scott Marlowe
On Thu, 2006-06-29 at 11:08, Jasbinder Bali wrote: > > On 6/29/06, Scott Marlowe <[EMAIL PROTECTED]> wrote: > On Thu, 2006-06-29 at 10:24, Jasbinder Bali wrote: > > > Hi > > > I need to connect to the postgres database using my unix shell. > > > How should i go about it? > > > Is libpq

Re: [GENERAL] Database connectivity using a unix shell

2006-06-29 Thread Jasbinder Bali
in my bash script where and how do i specify the database connection parameters ~Jas  On 6/29/06, Scott Marlowe <[EMAIL PROTECTED]> wrote: On Thu, 2006-06-29 at 10:24, Jasbinder Bali wrote:> Hi> I need to connect to the postgres database using my unix shell. > How should i go about it?> Is libpq go

Re: [GENERAL] Database connectivity using a unix shell

2006-06-29 Thread Scott Marlowe
On Thu, 2006-06-29 at 10:24, Jasbinder Bali wrote: > Hi > I need to connect to the postgres database using my unix shell. > How should i go about it? > Is libpq going to be helpful here? There is a shell interface for postgresql called psql. If you have postgresql installed on a box, then the psq

Re: [GENERAL] Database connectivity using a unix shell

2006-06-29 Thread Richard Broersma Jr
> I need to connect to the postgres database using my unix shell. > How should i go about it? > Is libpq going to be helpful here? If postgres is install on the unix server, you can use the postgreSQL client that installs with the server. it is called psql. Regards, Richard Broersma Jr. -

[GENERAL] Database connectivity using a unix shell

2006-06-29 Thread Jasbinder Bali
Hi I need to connect to the postgres database using my unix shell. How should i go about it? Is libpq going to be helpful here?   Thanks and regards, ~Jas