Shall I use synchronized keyword?

Hi there!
I have made a small client-server applikation with RMI.
The server has a connection to a database (only one connection). On the server I have also placed the SQL-queries in separate methods that can be invoced from the clients. The question is:
Do I have to sychronize these methods that access the databse from the one and only database connection? Or can several clients that invoce the same method simultanously use the same one and only database connection?
Thanks in advance!
/Mackan

According to my experience, the connection can be shared among multiple threads, but the statements and resultsets must be in method scope.

Similar Messages

  • Object or Statement Block locking using synchronized keyword in java

    Hi ,
    Can anyone tell me how java is implementing the Object locking and the code block locking mechanism using the 'synchronized' keyword internally??
    Thanks in advance
    Raj

    The JVM implements a concept known as a monitor using a combination of direct implementation and support by the operating system. For more detail, refer to the Java JVM and language specifications.
    Chuck

  • How to use Synchronized Keyword

    Hi guys,
    Sorry if this is a simple question, but I'm not sure about the following:
    Suppose we have the class,
    Class Foo
    public synchronized void bar1() {...}
    public synchronized void bar2() {...}
    If I have two threads running concurrently, say T1 and T2.
    I know that T1 and T2 can't both be in bar1() at the same time right? [It has to be in some serial order]
    But, can T1 be in bar1() and T2 be in bar2() at the same time?
    I guess the question is, does the synchronized apply to that specific method only? Or rather to the object (which basically limits at most one thread calling that object's synchronized methods)?
    Thanks a bunch! :)
    -Michael.

    Hi Michael,
    In general, when you syncronize a block of code, the execution of the block is syncronized ON an object. Any object can function as a lock, and only one thread can have a lock of one object at a time. If one thread already has a lock on an object and another thread tries to acquire lock on the same object, the latter thread will wait until the lock is released.
    When you use 'synchronized' in method declaration, it means that the execution of the whole method is syncronized on the object itself (NOT class, if the method is non-static. Static method would be synchronized on the .class object.)
    So, if you have more than one syncronized methods, only one of them is executed at a time ON THE SAME OBJECT. The same method can, of course, be executed simultaneously on other objects. Also, if some of the methods are synchronized, but other methods are not, the non-synchronized methods are not affected in any way.
    It might be good to note that these two pieces of code have exactly the same meaning:
    public synchronized doSomething() {
        // do something
    }and
    public doSomething() {
        synchronized (this) {
            // do something
    }Hope this helps.
    Cheers,
    Vesa
    p.s. It's a good idea to design your code so that one thread will have no more than one lock at a time. If it's possible for more than one thread to have lock on more than one object, there may be a risk of the threads dead-locking, which will crash any program...

  • Oracle deadlock - how to use "synchronised" keyword in a transaction?

    Hi,
    I use WL6.1 SP4, Oracle 8.1.6, with some Java objects which execute a
    lot
    of SQL queries (mixed update, insert and select) using plain JDBC
    calls,
    and Weblogic connection pools. These objects are called by servlets.
    I experienced recently deadlocks when two users call the object at the
    same
    time (See error below).
    I execute the queries using "synchronized" keyword in the following
    way:
    synchronized (this)
    conConnection.setAutoCommit(false);
    executeTransaction(myStatement);
    conConnection.commit();
    executeTransaction is overriden in sub-classes and is the method which
    executes
    all the queries.
    It calls methods in other objects. These methods are not declared as
    synchronized.
    1) Should they?
    2) Should I use the keyword "synchronized" in another way?
    3) This part of code is also called when I do only "select"
    statements. I guess
    it should only be synchronized when we do "update" and "insert" which
    could lead
    to a deadlock?
    4) Do you have any idea why this deadlock occurs as I use the
    "synchronized"
    keyword, and one thread should wait until the other one has finished?
    Thanks for any idea,
    Stéphanie
    ----------------- error:
    <ExecuteThread: '4' for queue: 'default'> <> <> <000000> <SQL request
    sent to database: UPDATE PARTICIPANT par SET par.PARTICIPANTLASTRANK =
    4 WHERE par.IDPARTICIPANT = 8983566>
    <ExecuteThread: '11' for queue: 'default'> <> <> <000000> <SQL request
    sent to database: UPDATE PARTICIPANT par SET par.PARTICIPANTLASTRANK =
    6 WHERE par.IDPARTICIPANT = 8983570>
    ORA-00060: deadlock detected while waiting for resource
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
         at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
         at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:573)
         at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1891)
         at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1093)
         at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2047)
         at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1940)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2709)
         at oracle.jdbc.driver.OracleStatement.executeUpdate(OracleStatement.java:796)
         at weblogic.jdbc.pool.Statement.executeUpdate(Statement.java:872)
         at weblogic.jdbc.rmi.internal.StatementImpl.executeUpdate(StatementImpl.java:89)
         at weblogic.jdbc.rmi.SerialStatement.executeUpdate(SerialStatement.java:100)
         at bfinance.framework.EDBBLBean.executeSQL(EDBBLBean.java:299)

    Hi Stepanie,
    I'd try to group update statement together. Usually it helps.
    Regards,
    Slava Imeshev
    "Stephanie" <[email protected]> wrote in message
    news:[email protected]...
    Thanks for your answer.
    In the case you describe, is there a way to ensure that tx-2 waits for
    tx-1
    to be finished before beginning?
    My transaction which causes the problem is the following (simplified):
    UPDATE tableA SET islast=0 WHERE externalid=myid;
    for (int i=0; i< aVector.size(); i++) {
    INSERT INTO tableA (id, islast, ranking, externalid) (SELECT
    SEQ_tableA.nextval, 1, 0, myid);
    UPDATE tableA SET ranking = /*calculated ranking */
    WHERE externalid=myid AND islast=1;
    UPDATE tableB ....
    commit;
    tx-1 and tx-2 execute this transaction at the same time. tx-1 begins
    The deadlock appears when tx-2 executes the second UPDATE tableA
    query.
    I don't see how I can avoid to execute these two update queries, so if
    I can find another way to prevent deadlock, it would be great!
    Stéphanie
    Joseph Weinstein <[email protected]_this> wrote in message
    news:<[email protected]_this>...
    Stephanie wrote:
    Hi,
    I use WL6.1 SP4, Oracle 8.1.6, with some Java objects which execute a
    lot
    of SQL queries (mixed update, insert and select) using plain JDBC
    calls,
    and Weblogic connection pools. These objects are called by servlets.
    I experienced recently deadlocks when two users call the object at the
    same
    time (See error below).Hi. The error you are getting isn't necessarily from a lack ofsynchronization
    of your java objects. It has to do with the order in which you accessDBMS
    data. You are getting ordinary DBMS deadlocks, which are caused when
    two DBMS connections each have a lock the other wants, in order toproceed.
    The DBMS will quickly discover this and will kill one transaction inorder to
    let the other one proceed:
    time 0: tx-1 and tx-2 have started.....
    time 1: tx-1: update tableA set val = 1 where key = 'A'
    time 2: tx-2: update tableB set val = 2 where key = 'B'
    time 3: tx-1: update tableB set val = 1 where key = 'B' (waitsbecause tx-2 has the row
    locked)
    time 4: tx-2: update tableA set val = 2 where key = 'A' (waitsbecause tx-1 has the row
    locked)
    This is a deadlock. The solution is to organize your application code sothat every
    transaction accesses the data in the same order, eg: update tableAfirst, then update tableB.
    This will prevent deadlocks.
    Joe Weinstein at BEA
    I execute the queries using "synchronized" keyword in the following
    way:
    synchronized (this)
    conConnection.setAutoCommit(false);
    executeTransaction(myStatement);
    conConnection.commit();
    executeTransaction is overriden in sub-classes and is the method which
    executes
    all the queries.
    It calls methods in other objects. These methods are not declared as
    synchronized.
    1) Should they?
    2) Should I use the keyword "synchronized" in another way?
    3) This part of code is also called when I do only "select"
    statements. I guess
    it should only be synchronized when we do "update" and "insert" which
    could lead
    to a deadlock?
    4) Do you have any idea why this deadlock occurs as I use the
    "synchronized"
    keyword, and one thread should wait until the other one has finished?
    Thanks for any idea,
    Stéphanie
    ----------------- error:
    <ExecuteThread: '4' for queue: 'default'> <> <> <000000> <SQL request
    sent to database: UPDATE PARTICIPANT par SET par.PARTICIPANTLASTRANK =
    4 WHERE par.IDPARTICIPANT = 8983566>
    <ExecuteThread: '11' for queue: 'default'> <> <> <000000> <SQL request
    sent to database: UPDATE PARTICIPANT par SET par.PARTICIPANTLASTRANK =
    6 WHERE par.IDPARTICIPANT = 8983570>
    ORA-00060: deadlock detected while waiting for resource
    at
    oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
    at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
    at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:573)
    atoracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1891)
    atoracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1093)
    atoracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2047
    atoracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1940)
    atoracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java
    :2709)
    atoracle.jdbc.driver.OracleStatement.executeUpdate(OracleStatement.java:796)
    atweblogic.jdbc.pool.Statement.executeUpdate(Statement.java:872)
    atweblogic.jdbc.rmi.internal.StatementImpl.executeUpdate(StatementImpl.java:89
    atweblogic.jdbc.rmi.SerialStatement.executeUpdate(SerialStatement.java:100)
    at bfinance.framework.EDBBLBean.executeSQL(EDBBLBean.java:299)

  • Synchronized keyword for simple addition

    Hi, I have a function, as given below
    {noformat}public static void increment() {{noformat}{noformat} a = a + 1; {noformat}{noformat}}
    {noformat}
    This function will be called from multiple threads (a is also a static variable).
    My question is should I use "synchronized" keyword for this method to avoid unpredictable results? Is there a way to wirte this function without using "synchronized" keyword?
    Please suggest.

    Thanks, jwenting. I wanted to confirm that "synchronized" has to be used.
    jwenting wrote:
    yes. Depending of course on what you decide to be "unpredictable" :)you understand what "unpredictable" means here ;)
    jwenting wrote:
    yes, don't use a static variable but a method local one. Of course that will have a totally different effect.Variable "a" should be a class level variable. Yes, local variable has a totally different effect. ;)

  • How shall I use my IMac and MacBookPro, with synchronized files

    Hi, how shall I use my IMac and MacBookPro, with synchronized files? I used to work at home and office with those to machines and finally always have different version of my documents. Is there any dispositive that I should use, where all my files are moving with me? os there is something to synchronized the computers using WiFi or bluetooth?

    The following has instructions: OS X Mavericks: Share your Internet connection

  • Use of synchronized keyword with portal services

    Hi,
    Can you confirm me if it is true that a portal service is a Singleton? I mean, when using an instance variable of a portal service I am able to set the value of the instance variable using one client app and get it afterwards using another client app. So we are talking about the same and only instance of the portal service, right?
    If this is true how can I synchronize the access to a portal's service method? I tried to mark
    the method syncronized (in the interface) but then I realized that this issues a compiler error because one can not mark an interface method synchronized. So can I mark the implementation class instead? That is, can I leave the interface without the synchronized keyword for the method and still mark the implementation of the method in the service class as syncronized? Does this work?
    Thanks in advance,
    Diz

    Hi,
    Portal service is not a Singleton, as the name says a service is just provider for services which does not save state between two requests/applications.
    So if you want to save state, then use some session variables to save it.
    In a cluster installation, each server node has its own portal services, so if you save state in service, then your application should save this state on all servers of the cluster.
    So you should change your approch.
    http://help.sap.com/saphelp_nw70/helpdata/en/e3/fab74247e2b611e10000000a155106/frameset.htm
    Greetings,
    Praveen Gudapati
    [Points are always welcome for helpful answers]

  • Understanding 'synchronized' keyword

    Hello,
    I have a main class (ClsA.java) that extends JFrame, the frame contains one JButton and one JTextArea.
    When pressing the button x number of threads are created and each thread will write a couple of messages in the JTextArea by using a method in ClsA.java, the method looks like this:
    public void output(String output){
      this.taOutput.append(new java.util.Date(System.currentTimeMillis()) + ":" + output + System.getProperty("line.separator"));
    }everything works fine, but sometimes a few messages from different threads end up on the same line in the JTextArea. To fix this I changed the output method to this:
    public synchronized void output(String output){
      this.taOutput.append(new java.util.Date(System.currentTimeMillis()) + ":" + output + System.getProperty("line.separator"));
    }I have just added the synchronized keyword that will make the the system associates a unique lock with every instance of ClsA (there is only one). This works alomost fine, but when I increase the number of concurrent threads the application freezes(I�m not able to scroll down in the textarea or press the button)? Why does it freeze? I have tried adding notifyAll() at the end of the output method but there is no difference. What am I doing wrong here? The acquisition and release of a lock is done automatically and atomically by the Java runtime system.....but can it still end up in a freeze?!
    Greatfull for any suggestions!
    //Anders =)

    Hi,
    Use
    public void output(String output){
    SwingUtilities.invokeLater(new Runnable()
    public void run()
    taOutput.append(new java.util.Date(System.currentTimeMillis()) + ":" + output + System.getProperty("line.separator"));
    so as to update the text area only in the event thread!
    Roger

  • Shall I use one datasource for multiple connection pool?

    Hi,
    I need to clarrify that, Shall I use one Datasource for multiple connection pool in distributed transaction?
    Thanks with regards
    Suresh

    No. If its transactions across multiple databases you should use different datasources.

  • How do I filter photos using the keyword hierarchy?

    Since Aperture 3.1 came out, I've been taking another look at it and considering switching back from Lightroom. One baby step was to set up a proper keyword hierarchy with Aperture. Trying to use that for sorting photos, I started feeling incredibly frustrated and felt like I must be missing something screamingly obvious.
    Here's my issue. Using the keyword HUD, I can set up a nested, hierarchical keyword list. The HUD helpfully displays a running tally of all photos that keyword is applied to. "Great!" I thought, I've got 46 photos of John Smith, let's take a look at them. So I click on the number. Apparently, while Aperture is happy to show you the number of photos with the keyword, it's not willing to take you to those photos (i.e., create a library filter and show the results) via the Keyword HUD.
    Bringing up the filter HUD seems unhelpful for the opposite reason. While you can search via the keywords there, it doesn't show the keyword hierarchy! Am I missing something? Say I've got keywords for two people, Adam and Zoe, filed under People/Friends/. Using the keyword box in the filter HUD will list one at the beginning and the other at the end of my entire list of keywords. Worse, the filter HUD only seems helpful for keywords if you know which ones you're looking for, which defeats the point of using a hierarchy. If, say, I know there's 3 or 4 people I'm looking for under a particular category, but I can't remember their name of the top of my head, how do I go about finding them using the filter HUD? All I have is the long, uncategorized master list of keywords.
    Again, I feel I must be missing something obvious. Thanks for your help.
    Cheers.

    I agree, clicking on a keyword in the HUD that has a number after it to get those photos seems like a no brainer. Even though I know it doesn't do that I still find myself clicking on it before I catch myself. Need to send feedback to Apple on this, clicking on a keyword should create a filter to and display those images.
    In your example the images of Adam and Zoe should be tagged with the keywords that apply to them. That is they would have the keywords people, friends, male or female, Adam or Zoe, and whatever other keywords you use to describe these images. Then you check as many keywords in the filter that apply and you can remember.
    While the keyword HUD shows the keywords in a hierarchy, keywords applied to an image are one dimensional, linear. Its just a string of words without structure. The hierarchy is just there to make it easier to conceptualize the structure.

  • Which cable (original apple usb or bmw y) shall i use to connect my 4th gen iPod photo 60 gb to bmw f10 (with com box) is it going to work with the apple usb cable and how long does it take till I can access the 33gb content via the bmw display?

    Which cable (original apple usb or bmw y) shall I use to connect my 4th gen iPod photo 60 gb (old but still working ok) to bmw f10 (with com box), build december 2010 > is it going to work with the apple usb cable and if so, how long does it take till I should be able to access the 33gb content via the bmw display?
    Alternatively: How long does it take if I would have to use the bmw y cable till I can access the 33gb content via the bmw display?

    Which cable (original apple usb or bmw y) shall I use to connect my 4th gen iPod photo 60 gb (old but still working ok) to bmw f10 (with com box), build december 2010 > is it going to work with the apple usb cable and if so, how long does it take till I should be able to access the 33gb content via the bmw display?
    Alternatively: How long does it take if I would have to use the bmw y cable till I can access the 33gb content via the bmw display?

  • How to Use synchronous RFC calls during test run for remote accesses

    there is a Setting for the usage of RFC accesses from a tested system
    using eCATT.
    'X' - Use asynchronous RFC calls during test run for remote accesses
    ' ' - Use synchronous RFC calls during test run for remote accesses
    I developed an eCATT as following :
      SAPGUI ( SAPGUI_1 , Target_system_1 ).
      SAPGUI ( SAPGUI_2 , Target_system_2 ).
    My question is how to run the eCATT in a synchronous RFC calls
    PS: I do not want to change the Target_system to the same one in the
    above script of ecatt.Because I need to run it in 2 different Target
    systems sometime.
    for example, I give a Target_system_3 when run this eCATT
    I want the SAPGUI_1 and SAPGUI_2 run the Target_system_3 but not the
    Target_system_1 or Target_system_2 .
    Could you please tell me how to make it without the changes in script?
    Edited by: Weitong Liu on Mar 24, 2011 9:44 AM

    Hi Liu,
    Weitong Liu wrote:
    > ' ' - Use synchronous RFC calls during test run for remote accesses
    This is the standard option value. Asynchronous are not the standard way and used only for very special purposes.
    Weitong Liu wrote:
    > I developed an eCATT as following :
    >   SAPGUI ( SAPGUI_1 , Target_system_1 ).
    >   SAPGUI ( SAPGUI_2 , Target_system_2 ).
    > My question is how to run the eCATT in a synchronous RFC calls
    The commands will be executed in sequence. So each call will be synchronously replayed against TS1 and TS2.
    What is you issue with this standard procedure?
    Kind regards,
    Christoph

  • Equi Join and Outer join using outer keyword

    Hi,
    First lets take the create statment for scott schema.
    create table scott.emp_details(empno number, bonus_date date);
    Insert Into Scott.Emp_Details Values(7369, To_Date('01-jan-2013'));
    Insert Into Scott.Emp_Details Values(7499, To_Date('05-jan-2013'));
    Insert Into Scott.Emp_Details Values(7521, To_Date('10-jan-2013'));
    Insert Into Scott.Emp_Details Values(7566, To_Date('01-feb-2013'));
    Insert Into Scott.Emp_Details Values(7654, To_Date('05-feb-2013'));
    commit;lets also consider the basic scott.emp and scott.dept tables
    Now I would like to equi join emp table deptno col with dept table deptno col and left outer join emp table hiredate with emp_details bonus_date and empno col in emp_details can be joined(Equi Join) with empno col of emp table if needed .The outer join has to be placed using the keyword (left/right)outer join
    The select statement can have all the detials of emp table .The requirement may look weird but we have some such requirement.
    Please suggest

    Hi,
    sri wrote:
    Hi,
    First lets take the create statment for scott schema.
    create table scott.emp_details(empno number, bonus_date date);
    Insert Into Scott.Emp_Details Values(7369, To_Date('01-jan-2013'));
    Insert Into Scott.Emp_Details Values(7499, To_Date('05-jan-2013'));
    Insert Into Scott.Emp_Details Values(7521, To_Date('10-jan-2013'));
    Insert Into Scott.Emp_Details Values(7566, To_Date('01-feb-2013'));
    Insert Into Scott.Emp_Details Values(7654, To_Date('05-feb-2013'));
    commit;
    It's best not to create your own tables in Oracle-supplied schemas, such as SCOTT. Use your own schema for your own tables.
    lets also consider the basic scott.emp and scott.dept tablesI see; you're using the standard scott,emp and scott.dept tables, plus the emp_details table you posted above.
    Now I would like to equi join emp table deptno col with dept table deptno col and left outer join emp table hiredate with emp_details bonus_date and empno col in emp_details can be joined(Equi Join) with empno col of emp table if needed .The outer join has to be placed using the keyword (left/right)outer join
    The select statement can have all the detials of emp table .The requirement may look weird but we have some such requirement.
    Please suggestThanks for posting the sample data. Don't forget to post the exact output you want from that sample data.
    Do you want something like this?
    `    EMPNO ENAME          DEPTNO DNAME          BONUS_DAT
          7369 SMITH              20 RESEARCH       01-JAN-13
          7499 ALLEN              30 SALES          05-JAN-13
          7521 WARD               30 SALES          10-JAN-13
          7566 JONES              20 RESEARCH       01-FEB-13
          7654 MARTIN             30 SALES          05-FEB-13
          7698 BLAKE              30 SALES
          7782 CLARK              10 ACCOUNTING
          7788 SCOTT              20 RESEARCH
          7839 KING               10 ACCOUNTING
          7844 TURNER             30 SALES
          7876 ADAMS              20 RESEARCH
          7900 JAMES              30 SALES
          7902 FORD               20 RESEARCH
          7934 MILLER             10 ACCOUNTING
                                  40 OPERATIONSIf so, here's one way to do it:
    SELECT       e.empno, e.ename     -- or whatever columns you want
    ,       d.deptno, d.dname     -- or whatever columns you want
    ,       ed.bonus_date
    FROM           scott.dept  d
    LEFT OUTER JOIN      scott.emp   e   ON  e.deptno     = d.deptno
    LEFT OUTER JOIN      emp_details ed      ON  ed.empno     = e.empno
    ORDER BY  e.empno
    ;

  • Use 'default' keyword in call string while calling stored proc?

    I am calling following sql server stored procedure from java code using my jdbc driver for sql server: CREATE PROCEDURE test_findTbInfo (
    @paramIn_Str varchar(10),
    @paramOut_Int int OUT,
    @paramIn_Int int = 20
    AS
    begin
    set @paramOut_Int = @paramIn_Int * 100
    end
    If I make a call like this:
    CallableStatement cs = conn.prepareCall(" { call test_findTbInfo(? , , ? ) }");
    cs.setString(1, "test_tab");
    cs.setInt(2, 4);
    cs.execute();
    It works without any error. But this is not a right behavior. !! The second parameter as you see is passed like an optional parameter. But in stored proc it is NOT an optional param and so if the value not passed it should fail...
    Now if I change the code to
    CallableStatement cs = conn.prepareCall(" { call test_findTbInfo(? , default, ? ) }");
    it works correctly. Gives error that "Procedure 'test_findTbInfo' expects parameter '@paramOut_Int', which was not supplied." which is correct.
    So is it a normal practice to use 'default' keyword while calling sql server stored procedures having optional parameters in jdbc ????
    Anyone knows ??? As far as I know "call test_findTbInfo(? , , ? )" works fine except in some cases and also it forces users to put all optional parameters at the end of parameter list in stored proc.
    Please let me know whether I should go with 'default' throuout for sql server stored proc while calling using my jdbc driver.
    Amit

    {?= call <procedure-name>[<arg1>,<arg2>, ...]}The question mark in the above is the result parameter
    that must be registered.
    That is not the same as an OUT argument.Yes that is true. The result value and OUT parameters are different but they both MUST be registered as per jdbc API
    "The type of all OUT parameters must be registered prior to executing the stored procedure; their values are retrieved after execution via the get methods provided here."
    Anyway, my original question still stays as it was. If there are some optional IN parameters in stored procedure
    e.g.
    PROCEDURE test_findTbInfo (
    @paramIn_Int int = 20,
    @paramOut_Int int OUT
    how do you call this?
    CallableStatement cs = conn.prepareCall(" { call test_findTbInfo( , ? ) }");
    cs.registerOutParameter(1, Types.INTEGER);
    cs.execute();
    or
    CallableStatement cs = conn.prepareCall(" { call test_findTbInfo(default, ? ) }");
    Also note that I am intending to use ONLY sql server driver for this.
    The first as well second seem to work. Except that second way is seems reliable. I just wanted a second opinion on that...
    Amit

  • Why use “synchronized” to decorate an object which its type is Vector

    Hello,guys.
    Recently,I readed the source code of java.util.Observable.Unfortunately,I encounted some problems&#12290;In the source code ,there is an object named “obs”.Its type is Vector. As we all know,Vector is thread-safe.why use “synchronized” in below code?
        public synchronized void deleteObservers() {
         obs.removeAllElements();
        }thanks.
    Edited by: qiao123 on Dec 21, 2009 7:07 PM

    My " NewBie" Definition of Thread Safe :Is of no interest. It already has a definition and that isn't it.I wanted to make clear what my definition is.
    The [JLS DEF FOR COLLECTION|http://java.sun.com/j2se/1.4.2/docs/api/java/util/Collections.html] says:
    That is the Javadoc for Collections actually, nothing to do with the JLS or Collection.They are authoritative links for Java Language and the discussion in hand, not Fantasies of Lucy Aunty.
    So,how do we draw any inference(s) here?Yes, that you have selectively quoted the Javadoc, which goes on to talk about how you have to use it when iterating.Still not answering my question,Sir.
    ejp,you seem to have knowledge but you don't have the attitude to forward the same to others or bear what others say,even when initiative has been taken by others to put forward a problem.
    P.S : Not all hackers are arrogant and not all arrogant are hackers.
    Another P.S : Waste of my time really !!!
    Edited by: punter on Dec 22, 2009 1:09 AM

Maybe you are looking for

  • Disable field highlighting?

    Good Morning, Working on a form that will be distributed to a number of users.  The form utilizes a lot of scripts to highlight fields that require attention.  The form works/shows well when the preset "highlight fields" is turned off (currently done

  • Mail account setup loop

    I recently reinstalled Mac OS X on my MacBook Pro (to get rid of some of the software I had downloaded/installed during my first run with a Mac), and I had backed up my Keychain, Mail and preferences, and iCalendar database to a CD--or so I thought.

  • Some one can help me ? Idendification of MultiCube

    Hello Experts,  (BI7.0) I have a MultiProvider in wich 4 InfoCubes inside. In ervery InfoCube is ProfitCENTER. Like this: 1. CUBE :0WBS_ELEMT__0PROFIT_CTR 2. CUBE: 0COSTCENTER__0PROFIT_CTR 3.CUBE: ZWIO_COOR__0PROFIT_CTR 4.CUBE: ZWIO_COOR__0PROFIT_CTR

  • HT1657 My rented movie keeps stopping and not working, what's wrong with it?

    I've just downloaded a rental movie to my iPad. The movie has stopped about 40 times in 3 mins. I move the cursor back slightly to rewind the movie and it plays again for a 10 seconds then stops... I have enough storage, any suggestions?

  • I guess you've just to stick it out

    Motion is NOT easy and when Apple adds real world shadows, a focusable camera, and other 3D conventions it will be even harder. With Andy Neil's encouragement, I'm struggling through a 3D tutorial disk hosted by Mark Spencer. This will be the fourth,