Menu

How to switch datasource

2006-06-15
2013-04-25
  • PrettyHandling

    PrettyHandling - 2006-06-15

    Hi guys,

       I have over 5000 queries to run on Oracle8i and it sometimes hang the database server. I am wondering if I can declare 2 or 3 datasource/connection pool that after like 500 queries it will switch to the other datasource/connection pool. Thanks !

    regards,
    Mark

     
    • Sujit Pal

      Sujit Pal - 2006-06-15

      Hi Mark,

      You cannot do connection pooling in SQLUnit, but you can explicitly declare named multiple connections, which you then reference from your tests. So a test can be forced to work with a specific connection. Theres nothing automatic though...

      -sujit

       
    • PrettyHandling

      PrettyHandling - 2006-06-16

      I do the connection like that:

          <connection>
             <driver>oracle.jdbc.driver.OracleDriver</driver>
             <url>jdbc:oracle:thin:@10.4.36.37:1521:leap1poc</url>
             <user>hyperion</user>
             <password>hyperion</password>
           </connection>

      so how to explicitly declare multiple conection?

      thanks !

       
      • Sathi Chowdhury

        Sathi Chowdhury - 2006-06-16

        you can have different external connection properties files defined for each connection
        and each of them would look like

        sqlunit.driver = oracle.jdbc.driver.OracleDriver
        sqlunit.url =jdbc:oracle:thin:@10.4.36.37:1521:leap1poc
        sqlunit.user = hyperion
        sqlunit.password =hyperion

        and then give this file a name like
        sqlunit-connection1.properties and save it in lib folder

        you can create sqlunit-connection2.properties
        for another connection

        in the test.xml  you will have 
        <connection connection-id="1" extern="sqlunit-connection1" />
        <connection connection-id="2" extern="sqlunit-connection2" />

        and refer to connection-id="1" or "2" as required

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.