PROBLEM WITH ROW LOCKING

PROBLEM WITH ROW LOCKING

Post by Apostolis Hatziyanni » Fri, 14 Sep 2001 19:01:24



Until  now, i was developing client applications using jbuilder 2  and
oracle 8i database and oracle jdbc driver.
when i wanted to lock a number of rows, i used directly my JDBC connection
as the follow:

...........................................
Database database1 = prog.DataModule1.getDataModule().getMainDatabase();
QueryDataSet queryDataSet1 = new QueryDataSet();
ParameterRow pr = new ParameterRow();
..................................
pr.addColumn(new Column("test","",borland.jbcl.util.Variant.STRING));
..................................
queryDataSet1.setQuery(new borland.sql.dataset.QueryDescriptor(database1,
"SELECT * FROM STOCK.S200  WHERE   S200.COD1 = :test   FOR UPDATE NOWAIT ",
pr, true, Load.ALL));
................................
 try {
        database1.commit();
        database1.getJdbcConnection().setAutoCommit(false);
 } catch (SQLException ioex) {ioex.printStackTrace();}
 pr.setString("test",o_COD1.getValue().trim());
queryDataSet1.executeQuery();
...........................................

now i've changed the database. I'm trying to use SQL Server 2000 and ODBC
driver.
how can i the previous thing in SQL Server 2000?
could you help me?

thank you in advance

 
 
 

PROBLEM WITH ROW LOCKING

Post by Leonid Kozhinsk » Fri, 14 Sep 2001 19:36:56


Use
SELECT * FROM STOCK.S200  (HOLDLOCK) WHERE   S200.COD1 = :test

Luck!
Leonid Kozhinsky


Quote:> Until  now, i was developing client applications using jbuilder 2  and
> oracle 8i database and oracle jdbc driver.
> when i wanted to lock a number of rows, i used directly my JDBC connection
> as the follow:

> ...........................................
> Database database1 = prog.DataModule1.getDataModule().getMainDatabase();
> QueryDataSet queryDataSet1 = new QueryDataSet();
> ParameterRow pr = new ParameterRow();
> ..................................
> pr.addColumn(new Column("test","",borland.jbcl.util.Variant.STRING));
> ..................................
> queryDataSet1.setQuery(new borland.sql.dataset.QueryDescriptor(database1,
> "SELECT * FROM STOCK.S200  WHERE   S200.COD1 = :test   FOR UPDATE NOWAIT
",
> pr, true, Load.ALL));
> ................................
>  try {
>         database1.commit();
>         database1.getJdbcConnection().setAutoCommit(false);
>  } catch (SQLException ioex) {ioex.printStackTrace();}
>  pr.setString("test",o_COD1.getValue().trim());
> queryDataSet1.executeQuery();
> ...........................................

> now i've changed the database. I'm trying to use SQL Server 2000 and ODBC
> driver.
> how can i the previous thing in SQL Server 2000?
> could you help me?

> thank you in advance


 
 
 

1. PROBLEM WITH ROW LOCKING

Until  now, i was developing client applications using jbuilder 2  and
oracle 8i database and oracle jdbc driver.
when i wanted to lock a number of rows, i used directly my JDBC connection
as the follow:

...........................................
Database database1 = prog.DataModule1.getDataModule().getMainDatabase();
QueryDataSet queryDataSet1 = new QueryDataSet();
ParameterRow pr = new ParameterRow();
..................................
pr.addColumn(new Column("test","",borland.jbcl.util.Variant.STRING));
..................................
queryDataSet1.setQuery(new borland.sql.dataset.QueryDescriptor(database1,
"SELECT * FROM STOCK.S200  WHERE   S200.COD1 = :test   FOR UPDATE NOWAIT ",
pr, true, Load.ALL));
................................
 try {
        database1.commit();
        database1.getJdbcConnection().setAutoCommit(false);
 } catch (SQLException ioex) {ioex.printStackTrace();}
 pr.setString("test",o_COD1.getValue().trim());
queryDataSet1.executeQuery();
...........................................

now i've changed the database. I'm trying to use SQL Server 2000 and ODBC
driver.
how can i the previous thing in SQL Server 2000?
could you help me?

thank you in advance

2. Oracle Financials Implementators needed in New York, NY

3. Sort table names and maintain referential integrity

4. i am facing a problem with row level locking

5. pgsql/src/backend/utils/adt (arrayfuncs.c)

6. Page lock to simulate row level lock

7. oracle resources on the net

8. Row lock via VB problem

9. Help: Problem about Row-Level locking

10. Row lock automagically being escalated to Table Locks

11. table-level lock or row-level lock

12. Row Locking Problem