On Sat, Jun 17, 2006 at 09:23:17AM +0530, sathish kumar shanmugavelu wrote:
> I fetch the consultatioin_no and add one to it, i should know this
> consultation_no to save the other 10 tables. because i use this number as
Don't do that. Fetch the number from a sequence first: select
nextval().
Looks good but you really shoud put your stmt.close() and conn.close() in a finally block so even if there is an error everything gets cleaned up properly. That syntax is for Java but the principle is the same for any programming language - always make sure you clean up your connections no matter
Locks are released when the containing transaction
commits. There is no explicit "release."
Instead of calling "begin" and "commit" as statements,
I do something more like below. As Aaron mentioned,
this is JDBC, not SQL. Sorry people.
try {
...
conn.setAutoCommit(false);
//do the insert on
When in this situation I:1. Wait until I have enough data to do a complete commit before even bothering to save any data to the database. I want the life of my transactions to last no more than milliseconds if possible.
2. Use a BIGSERIAL for the primary keys so the IDs are assigned automatically
Dear group
Its my mistake that i did not reveal the whole scenario. Actually within that begin and commit, i insert in 10 tables. The above said table is the key table. I fetch the consultatioin_no and add one to it, i should know this consultation_no to save the other 10 tables. because
I know this is a Java issue but I would recommend something more like:
Statement stmt = con.createStatement(); try { stmt.execute("begin"); stmt.execute("lock table rcp_patient_visit_monitor"); psSave.executeUpdate(); //psSave is a prepared statement
stmt.execute("
>INSERT INTO rcp_patient_visit_monitor (
>entry_no, patient_id, visit_date,
> is_newpatient,
> visit_type, is_medical,
>is_review, is_labtest, is_scan,
> is_scopy, is_xray,
> weight, height)
>VALUES ((SELECT
> coalesce(max(entry_no)+1, 1
I would use a BIGSERIAL for the ID. It simplifies your inserts, you don't have to mess with any locking and the sequence is maintained for you outside your transaction so two transactions can do inserts without stepping on each other.
This is how I handle auto generated numbers.The only downside i
Dear all, I tried the lock table option today. yes it works fine when saving simultaneously. but after two or three times even when all of us close our application, the lock exists there in the database. when we run the select query from other db tool it hangs up.
our code looks like
sathish kumar shanmugavelu wrote:
INSERT INTO rcp_patient_visit_monitor (
entry_no, patient_id, visit_date, is_newpatient,
visit_type, is_medical,
is_review, is_labtest, is_scan, is_scopy, is_xray,
weight, height)
VALUES ((SELECT c
Dear group, Let me explain my issue. We use Database - postgresql-8.1 JDBC Driver - postgresql-8.1-407.jdbc3.jar Java - jdk1.5 The default transaction isolation level is - Read Committed
Auto Commit is fals
> Yes, I have several clients connecting to the db, using
> the same username, doing the same things, pretty much.
>
> Please educate me:
> When a table is accessed, is there an entry that is updated
> in pg_catalog.pg_tables (or somewhere else) in such a fashion
> that the MVCC ca
Hi Tom,
Yes, I have several clients connecting to the db, using the same
username, doing the same things, pretty much.
Please educate me:
When a table is accessed, is there an entry that is updated in
pg_catalog.pg_tables (or somewhere else) in such a fashion that the MVCC
canno
Dag Gullberg <[EMAIL PROTECTED]> writes:
> Warning: pg_query(): Query failed: ERROR: tuple concurrently updated
> CONTEXT: PL/pgSQL function "get_rights" line 5 at SQL statement in
> /home/site/PHP/db_func.php on line 301
> Code of get_rights:
> GRANT SELECT ON c.users TO
> adm,w3;
Hi,
I have a problem with concurrency,
where ordinary selects render me
Warning: pg_query(): Query failed: ERROR: tuple concurrently updated
CONTEXT: PL/pgSQL function "get_rights" line 5 at SQL statement in
/home/site/PHP/db_func.php on line 301
Code of get_rights:
GRANT SELECT
15 matches
Mail list logo