Connection from Win machine

Started by Mihai Gheorghiuover 25 years ago7 messagesgeneral
Jump to latest
#1Mihai Gheorghiu
tanethq@earthlink.net

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

#2Diana Cionoiu
diana@softwaresolutions.ro
In reply to: Jason (#4)
Re: Odd "INSERT" Problems with PostgreSQL - Do YOU know?

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

#3Scott Gilbert
scott.gilbert@netregistry.au.com
In reply to: Mihai Gheorghiu (#1)
RE: 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

Show quoted text

-----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

#4Jason
jason@op480.com
In reply to: Scott Gilbert (#3)
Odd "INSERT" Problems with PostgreSQL - Do YOU know?

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!

#5Richard Huxton
dev@archonet.com
In reply to: Diana Cionoiu (#2)
Re: Odd "INSERT" Problems with PostgreSQL - Do YOU know?

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

#6Tom Lane
tgl@sss.pgh.pa.us
In reply to: Jason (#4)
Re: Odd "INSERT" Problems with PostgreSQL - Do YOU know?

"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

#7Mihai Gheorghiu
tanethq@earthlink.net
In reply to: Scott Gilbert (#3)
Re: Connection from Win machine

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

Show quoted text

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