pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedCan't insert more than 80 registers!?
4+ messages / 3 participants
[nested] [flat]
* Can't insert more than 80 registers!?
@ 2004-05-11 10:35 Carlos Barroso <miguel.barroso@mail.pt>
0 siblings, 2 replies; 4+ messages in thread
From: Carlos Barroso @ 2004-05-11 10:35 UTC (permalink / raw)
To: pgsql-jdbc
Hi! My first post.
I have a problem that's getting crazy. I'm going to discriminate what I used to
get a better understanding.
Tools used:
-----------
Postgres 7.4.2
JDBC
Drivers tested (all downloaded from Postgres site):
---------------------------------------------------
pg74.1jdbc2.jar
pg74.213.jdbc2.jar
pg74.213.jdbc3.jar
Table (DDL):
------------
CREATE TABLE PLANO_ENSAIO (
id INT8 NOT NULL
, ensaio_fk INT8 NOT NULL
, op_fk INT8 NOT NULL
, data_hora TIMESTAMP(10) NOT NULL
, estado CHAR(1) NOT NULL
, user_id CHAR(10) NOT NULL
, dt_hr TIMESTAMP(10) NOT NULL
, PRIMARY KEY (id)
, CONSTRAINT plano_ensaio_fk FOREIGN KEY (ensaio_fk) REFERENCES ENSAIO
(id)
, CONSTRAINT plano_ensaio_op_fk FOREIGN KEY (op_fk) REFERENCES OP (id)
);
NOTE:
I compiled Postgres server without any tweaking.
Here's the testing code:
Class.forName("org.postgresql.Driver");
Connection conn =
DriverManager.getConnection("jdbc:postgresql://localhost:6543/dbdev",
"developer", "xpto");
Statement st = null;
for(int i = 1; i <= 90; i++) {
st = conn.createStatement();
st.executeUpdate("INSERT INTO
plano_ensaio(id,ensaio_fk,op_fk,data_hora,estado,user_id,dt_hr) VALUES (" + i +
",1,1,'2004-04-04 10:11:11','A','mike','2004-05-05 05:55:55')");
}
st.close();
conn.close();
Results:
The code above doesn't give any error. The BIG problem is that it's only
inserting 80 and NOT 90 registers!?
I've tried everything I know and I can't get it working.
I thought it could be because of some WAL configuration, so I increased the
"wal_buffers" parameter, but got no success.
Can someone please help me? Don't know what to do.
--
Adira já ao Net Dialup Light. Acesso profissional gratuito.
NovisNet, a Internet de quem trabalha. http://www.novisnet.pt
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Can't insert more than 80 registers!?
@ 2004-05-11 11:40 Paul Thomas <paul@tmsl.demon.co.uk>
parent: Carlos Barroso <miguel.barroso@mail.pt>
1 sibling, 0 replies; 4+ messages in thread
From: Paul Thomas @ 2004-05-11 11:40 UTC (permalink / raw)
To: Carlos Barroso <miguel.barroso@mail.pt>; +Cc: pgsql-jdbc
On 11/05/2004 11:35 Carlos Barroso wrote:
> Here's the testing code:
>
> Class.forName("org.postgresql.Driver");
> Connection conn =
> DriverManager.getConnection("jdbc:postgresql://localhost:6543/dbdev",
> "developer", "xpto");
>
> Statement st = null;
> for(int i = 1; i <= 90; i++) {
> st = conn.createStatement();
> st.executeUpdate("INSERT INTO
> plano_ensaio(id,ensaio_fk,op_fk,data_hora,estado,user_id,dt_hr) VALUES ("
> + i +
> ",1,1,'2004-04-04 10:11:11','A','mike','2004-05-05 05:55:55')");
> }
>
> st.close();
> conn.close();
>
> Results:
> The code above doesn't give any error. The BIG problem is that it's only
> inserting 80 and NOT 90 registers!?
> I've tried everything I know and I can't get it working.
> I thought it could be because of some WAL configuration, so I increased
> the
> "wal_buffers" parameter, but got no success.
>
> Can someone please help me? Don't know what to do.
I don't know what the exact problem is but you're got a resource leak.
Your st.close() should really be inside your for() loop.
--
Paul Thomas
+------------------------------+---------------------------------------------+
| Thomas Micro Systems Limited | Software Solutions for
Business |
| Computer Consultants |
http://www.thomas-micro-systems-ltd.co.uk |
+------------------------------+---------------------------------------------+
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Can't insert more than 80 registers!?
@ 2004-05-11 12:47 Oliver Jowett <oliver@opencloud.com>
parent: Carlos Barroso <miguel.barroso@mail.pt>
1 sibling, 0 replies; 4+ messages in thread
From: Oliver Jowett @ 2004-05-11 12:47 UTC (permalink / raw)
To: Carlos Barroso <miguel.barroso@mail.pt>; +Cc: pgsql-jdbc
Carlos Barroso wrote:
> Results:
> The code above doesn't give any error. The BIG problem is that it's only
> inserting 80 and NOT 90 registers!?
> I've tried everything I know and I can't get it working.
I just tested this schema & code against 7.4.2 and pg74.213.jdbc3.jar.
It works as expected, inserting 90 rows. The only difference in schema
was that I dropped the foreign key constraints as you didn't provide DDL
or data for the referenced tables.
Here's what I did:
> oliver@flood:~$ sandbox-7.4.2/bin/psql -p 5742 test
> [... startup banner ...]
> test=> CREATE TABLE PLANO_ENSAIO (
> test(> id INT8 NOT NULL
> test(> , ensaio_fk INT8 NOT NULL
> test(> , op_fk INT8 NOT NULL
> test(> , data_hora TIMESTAMP(10) NOT NULL
> test(> , estado CHAR(1) NOT NULL
> test(> , user_id CHAR(10) NOT NULL
> test(> , dt_hr TIMESTAMP(10) NOT NULL
> test(> , PRIMARY KEY (id) );
> WARNING: TIMESTAMP(10) precision reduced to maximum allowed, 6
> WARNING: TIMESTAMP(10) precision reduced to maximum allowed, 6
> NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "plano_ensaio_pkey" for table "plano_ensaio"
> CREATE TABLE
> test=> \q
>
> oliver@flood:~$ cat Test.java
> import java.sql.*;
>
> public class Test {
> public static void main(String[] args) throws Exception {
> Class.forName("org.postgresql.Driver");
> Connection conn =
> DriverManager.getConnection("jdbc:postgresql://localhost:5742/test",
> "oliver", "oliver");
>
> Statement st = null;
> for(int i = 1; i <= 90; i++) {
> st = conn.createStatement();
> st.executeUpdate("INSERT INTO plano_ensaio(id,ensaio_fk,op_fk,data_hora,estado,user_id,dt_hr) VALUES (" + i + ",1,1,'2004-04-04 10:11:11','A','mike','2004-05-05 05:55:55')");
> }
>
> st.close();
> conn.close();
> }
> }
>
> oliver@flood:~$ javac -classpath pg74.213.jdbc3.jar Test.java
> oliver@flood:~$ java -classpath pg74.213.jdbc3.jar:. Test
> oliver@flood:~$ sandbox-7.4.2/bin/psql -p 5742 test
> [... startup banner ...]
> test=> select count(*) from plano_ensaio;
> count
> -------
> 90
> (1 row)
>
Can you provide something similar showing exactly what you're doing?
Obviously there's something different between our setups.
I'd also check the server logs for any errors; perhaps something is
masking a failure to insert.
Finally, if you do the same inserts by hand via psql, what happens?
-O
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Can't insert more than 80 registers!?
@ 2004-05-11 14:22 Carlos Barroso <miguel.barroso@mail.pt>
0 siblings, 0 replies; 4+ messages in thread
From: Carlos Barroso @ 2004-05-11 14:22 UTC (permalink / raw)
To: Oliver Jowett <oliver@opencloud.com>; +Cc: pgsql-jdbc
Thanks very much for the reply.
I found the problem. I'm using a plugin in Eclipse (JFaceDBC) for my DB viewing
and looks like its limited to a view of 80 registers per table (wierd).
I did a select count(*) via psql and there they where... the 90 registers.
Thanks Oliver.
> Carlos Barroso wrote:
>
> > Results:
> > The code above doesn't give any error. The BIG problem is that it's only
> > inserting 80 and NOT 90 registers!?
> > I've tried everything I know and I can't get it working.
>
> I just tested this schema & code against 7.4.2 and pg74.213.jdbc3.jar.
> It works as expected, inserting 90 rows. The only difference in schema
> was that I dropped the foreign key constraints as you didn't provide DDL
> or data for the referenced tables.
>
> Here's what I did:
>
> > oliver@flood:~$ sandbox-7.4.2/bin/psql -p 5742 test
> > [... startup banner ...]
> > test=> CREATE TABLE PLANO_ENSAIO (
> > test(> id INT8 NOT NULL
> > test(> , ensaio_fk INT8 NOT NULL
> > test(> , op_fk INT8 NOT NULL
> > test(> , data_hora TIMESTAMP(10) NOT NULL
> > test(> , estado CHAR(1) NOT NULL
> > test(> , user_id CHAR(10) NOT NULL
> > test(> , dt_hr TIMESTAMP(10) NOT NULL
> > test(> , PRIMARY KEY (id) );
> > WARNING: TIMESTAMP(10) precision reduced to maximum allowed, 6
> > WARNING: TIMESTAMP(10) precision reduced to maximum allowed, 6
> > NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index
"plano_ensaio_pkey" for table "plano_ensaio"
> > CREATE TABLE
> > test=> \q
> >
> > oliver@flood:~$ cat Test.java
> > import java.sql.*;
> >
> > public class Test {
> > public static void main(String[] args) throws Exception {
> > Class.forName("org.postgresql.Driver");
> > Connection conn =
> >
DriverManager.getConnection("jdbc:postgresql://localhost:5742/test",
> > "oliver", "oliver");
> >
> > Statement st = null;
> > for(int i = 1; i <= 90; i++) {
> > st = conn.createStatement();
> > st.executeUpdate("INSERT INTO
plano_ensaio(id,ensaio_fk,op_fk,data_hora,estado,user_id,dt_hr) VALUES (" + i +
",1,1,'2004-04-04 10:11:11','A','mike','2004-05-05 05:55:55')");
> > }
> >
> > st.close();
> > conn.close();
> > }
> > }
> >
> > oliver@flood:~$ javac -classpath pg74.213.jdbc3.jar Test.java
> > oliver@flood:~$ java -classpath pg74.213.jdbc3.jar:. Test
> > oliver@flood:~$ sandbox-7.4.2/bin/psql -p 5742 test
> > [... startup banner ...]
> > test=> select count(*) from plano_ensaio;
> > count
> > -------
> > 90
> > (1 row)
> >
>
> Can you provide something similar showing exactly what you're doing?
> Obviously there's something different between our setups.
>
> I'd also check the server logs for any errors; perhaps something is
> masking a failure to insert.
>
> Finally, if you do the same inserts by hand via psql, what happens?
>
> -O
--
Adira já ao Net Dialup Light. Acesso profissional gratuito.
NovisNet, a Internet de quem trabalha. http://www.novisnet.pt
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2004-05-11 14:22 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-05-11 10:35 Can't insert more than 80 registers!? Carlos Barroso <miguel.barroso@mail.pt>
2004-05-11 11:40 ` Paul Thomas <paul@tmsl.demon.co.uk>
2004-05-11 12:47 ` Oliver Jowett <oliver@opencloud.com>
2004-05-11 14:22 Re: Can't insert more than 80 registers!? Carlos Barroso <miguel.barroso@mail.pt>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox