7 Replies Latest reply on Jan 10, 2004 10:46 AM by mandar

    Question about Multiple JBoss servers going to same database

    mandar Newbie

      Hi,

      We have mulitple Jboss servers (stand alone - non clustered) going to the same database. I plan to deploy a CMP entity bean on both jboss instances. Will this cause any issue/deadlocks as the bean will be deployed in two places and it will map to the same table ?

      Also, what happens in CMP Entity beans if some external progam adds/updates/deletes rows directly from the database ? Will this cause any errors ?

      Thanks a lot for your help.

      Regards
      Mandar

        • 1. Re: Question about Multiple JBoss servers going to same data
          Juha Lindfors Master

          You should set <row-locking> in jbosscmp-jdbc.xml to true to avoid concurrency issues, and obviously cannot use commit option A (the default option B is ok).

          • 2. Re: Question about Multiple JBoss servers going to same data
            mandar Newbie

            Thanks a lot for your response.

            We use SQL Server 2000 as the database and I am not sure if it supports row-level locking.

            What setting can we do in the database to support this (or to find out if it is supported ? )

            Will JBoss or database driver do something to support row-locking if the database does not support it ?

            Also, I have some question about Java J2EE Transactions and database commit mode setting.

            If the database runs in auto-commit mode

            I start a EJB transaction
            update row 1 in table1 (using entity bean)
            update row 2 in table 2 (using entity bean)

            Assuming second update fails, will the container still roll back the first update ?

            If not.
            do I need to do some setting for achieving this rollback ?

            Thanks a lot.

            Regards
            Mandar


            • 3. Re: Question about Multiple JBoss servers going to same data
              Juha Lindfors Master

              row-locking means SELECT ... FOR UPDATE, or similar and is configurable in the CMP engine

              • 4. Re: Question about Multiple JBoss servers going to same data
                mandar Newbie

                Thanks once again.

                Is it possible to write "SELECT FOR UPDATE" using SQL Server 2000 as the database ?
                Does the CMP engine provide these features with all database ?

                While reading about SQL Server locking stratagies, I read that by default it locks at Page Level (bunch of rows) and hence row level lock such as SELECT FOR UPDATE supported by Oracle etc is not valid.

                Also,
                What happens if some other application directly adds/updates/deletes rows from a table that is mapped to an entity bean in Jboss ?
                Can this cause any errors (Except for FinderException,CreateException etc) ?


                Thanks a lot.

                Regards
                Mandar



                • 5. Re: Question about Multiple JBoss servers going to same data
                  Juha Lindfors Master

                   

                  "mandarm" wrote:

                  Is it possible to write "SELECT FOR UPDATE" using SQL Server 2000 as the database ?
                  Does the CMP engine provide these features with all database ?

                  While reading about SQL Server locking stratagies, I read that by default it locks at Page Level (bunch of rows) and hence row level lock such as SELECT FOR UPDATE supported by Oracle etc is not valid.


                  I don't know anything about SQL Server so you're going to have to figure that out by your own or ask someone else.

                  "mandarm" wrote:

                  What happens if some other application directly adds/updates/deletes rows from a table that is mapped to an entity bean in Jboss ?
                  Can this cause any errors (Except for FinderException,CreateException etc) ?



                  • 6. Re: Question about Multiple JBoss servers going to same data
                    Juha Lindfors Master

                     

                    "mandarm" wrote:

                    Is it possible to write "SELECT FOR UPDATE" using SQL Server 2000 as the database ?
                    Does the CMP engine provide these features with all database ?

                    While reading about SQL Server locking stratagies, I read that by default it locks at Page Level (bunch of rows) and hence row level lock such as SELECT FOR UPDATE supported by Oracle etc is not valid.


                    I don't know anything about SQL Server so you're going to have to figure that out by your own or ask someone else.

                    "mandarm" wrote:

                    What happens if some other application directly adds/updates/deletes rows from a table that is mapped to an entity bean in Jboss ?
                    Can this cause any errors (Except for FinderException,CreateException etc) ?


                    No, if you use commit option B/C and row locking as suggested.




                    • 7. Re: Question about Multiple JBoss servers going to same data
                      mandar Newbie

                      Hi,
                      Thanks a lot.

                      I will use Commit Option B/C as suggested.

                      I will find out about the SELECT FOR UPDATE using SQLServer.

                      Regards
                      Mandar