Обсуждение: Connection from Win machine

Поиск
Список
Период
Сортировка

Connection from Win machine

От
"Mihai Gheorghiu"
Дата:
PostgreSQL 7.1 on RH 7.0; database mydata has a few files created.
Access 95 on Win98 ODBC driver 6.50.00
Access connects to the database but "sees" no tables.
Thanks for the help.

Mihai Gheorghiu


RE: Connection from Win machine

От
"Scott Gilbert"
Дата:
you need the 7.1 version of the drivers.  There is no installer available at
this time (so far as I am aware) so you will need to go to the postgresql
ftp site to download the odbc dll contained in a zip file called
psqlodbc-07_01_0005.zip

> -----Original Message-----
> From: pgsql-general-owner@postgresql.org
> [mailto:pgsql-general-owner@postgresql.org]On Behalf Of Mihai
> Gheorghiu
> Sent: Thursday, May 24, 2001 3:59 AM
> To: pgsql-general@postgresql.org
> Subject: [GENERAL] Connection from Win machine
>
>
> PostgreSQL 7.1 on RH 7.0; database mydata has a few files created.
> Access 95 on Win98 ODBC driver 6.50.00
> Access connects to the database but "sees" no tables.
> Thanks for the help.
>
> Mihai Gheorghiu
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to
> majordomo@postgresql.org
>


Odd "INSERT" Problems with PostgreSQL - Do YOU know?

От
"Jason"
Дата:
Hi,

I am using php. When executing a query I do not get an error. However, when
I look at the DB it hasn't added the row and all other rows in the series of
queries have been added.

I've echo'd the $sql statement and actually ran it through the command line
with no problems.

The odd thing is, when I do these queries they do not fail, yet they do not
insert. It still increases the serial primary key ("id") so when I do a
query through the command line the first record for example would start at
12 (becuase i have tried to insert from the php code 12 times prior to
adding it manually).

Any idea on what the prob is?

Here's my sql statement:
$sql = "insert into pricing (prod_id, size_id, price) values ($prod_id,
$size_id, 0.00)";

here's an example of what it generates before it inserts:
insert into pricing (prod_id, size_id, price) values (148, 48, 0.00)

the table pricing has the following columns:
id - primar key/serial
prod_id - int4
size_id - int4
price - float4

Any help would be very much appreciated!

Thanks!


Re: Odd "INSERT" Problems with PostgreSQL - Do YOU know?

От
Diana Cionoiu
Дата:
>Here's my sql statement:
>$sql = "insert into pricing (prod_id, size_id, price) values ($prod_id,
>$size_id, 0.00)";
>
>here's an example of what it generates before it inserts:
>insert into pricing (prod_id, size_id, price) values (148, 48, 0.00)

The problem is from php, please do this
print $prod_id;
and see what it give you
in php you must have someting like.
$mumu = pg_exec ($conn, "insert into mumulica (mumu1,mumu2) values('" .
$mumu1 . "','" . $mumu2 . "')");

>Thanks!

Have fun

Diana


Re: Odd "INSERT" Problems with PostgreSQL - Do YOU know?

От
"Richard Huxton"
Дата:
From: "Diana Cionoiu" <diana@softwaresolutions.ro>

> >Here's my sql statement:
> >$sql = "insert into pricing (prod_id, size_id, price) values ($prod_id,
> >$size_id, 0.00)";
> >
> >here's an example of what it generates before it inserts:
> >insert into pricing (prod_id, size_id, price) values (148, 48, 0.00)
>
> The problem is from php, please do this
> print $prod_id;
> and see what it give you
> in php you must have someting like.
> $mumu = pg_exec ($conn, "insert into mumulica (mumu1,mumu2) values('" .
> $mumu1 . "','" . $mumu2 . "')");

Absolutely correct for strings, although in your example you could use:

pg_exec($conn, "insert into mumulica (mumu1,mumu2) values
('$mumu1','$mumu2')")

bearing in mind the need to escape ' marks. But - Jason's using numbers so
he should be fine.

Jason - sounds like you're checking return values, so we can be reasonably
sure the insert occurred. You're not inside a transaction block that gets
rolled back are you?

Might be scripts failing half-way through because of connection problems
too.

I'd be tempted to print $sql to a log-file so you can see what you think you
inserted and compare it to Postgres. You can also turn the logging level up
in PG to see individual queries, but that can be a little overwhelming.

- Richard Huxton


Re: Odd "INSERT" Problems with PostgreSQL - Do YOU know?

От
Tom Lane
Дата:
"Jason" <jason@op480.com> writes:
> The odd thing is, when I do these queries they do not fail, yet they do not
> insert.

Perhaps the php code is running inside a transaction block?  If so, the
added rows won't be visible to other connections until (and unless) the
transaction is committed.  The rows *would* be visible to subsequent
commands issued by that same php connection, though --- have you tried
checking that way?

> It still increases the serial primary key ("id")

This is consistent with my theory.  Sequence-object bumps are
immediately visible regardless of transaction boundaries.

            regards, tom lane

Re: Connection from Win machine

От
"Mihai Gheorghiu"
Дата:
Thanks a lot,

Mihai

-----Original Message-----
From: Scott Gilbert <scott.gilbert@netregistry.au.com>
To: pgsql-general@postgresql.org <pgsql-general@postgresql.org>
Date: Thursday, May 24, 2001 2:38 AM
Subject: RE: [GENERAL] Connection from Win machine


>you need the 7.1 version of the drivers.  There is no installer available
at
>this time (so far as I am aware) so you will need to go to the postgresql
>ftp site to download the odbc dll contained in a zip file called
>psqlodbc-07_01_0005.zip
>
>> -----Original Message-----
>> From: pgsql-general-owner@postgresql.org
>> [mailto:pgsql-general-owner@postgresql.org]On Behalf Of Mihai
>> Gheorghiu
>> Sent: Thursday, May 24, 2001 3:59 AM
>> To: pgsql-general@postgresql.org
>> Subject: [GENERAL] Connection from Win machine
>>
>>
>> PostgreSQL 7.1 on RH 7.0; database mydata has a few files created.
>> Access 95 on Win98 ODBC driver 6.50.00
>> Access connects to the database but "sees" no tables.
>> Thanks for the help.
>>
>> Mihai Gheorghiu
>>
>>
>> ---------------------------(end of
>> broadcast)---------------------------
>> TIP 1: subscribe and unsubscribe commands go to
>> majordomo@postgresql.org
>>
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 4: Don't 'kill -9' the postmaster