Package nexj.core.util

Examples of nexj.core.util.JDBCInfo


       * @param backingDB The backing database
       * @return The database specific jdbc connection info
       */
      protected JDBCConnectionInfo createJDBCConnectionInfo(RelationalDatabase backingDB)
      {
         JDBCInfo jdbcInfo = JDBCInfo.getInstance(backingDB.getDriver(), backingDB.getAdapter().getName());
         RelationalDatabaseFragment backingDBFragment = (RelationalDatabaseFragment)backingDB.getDefaultFragment();
         String sDriver = jdbcInfo.getURLDriver();
         String sConnURL = jdbcInfo.getURL(backingDBFragment.getHost(),
            String.valueOf(backingDBFragment.getPort()), backingDBFragment.getDatabase());

         return new JDBCConnectionInfo(backingDB, sDriver, sConnURL, jdbcInfo.getTestSQL());
      }
View Full Code Here


      {
         throw new RuntimeException("Please ensure that all of the following jms.jdbc.* properties " +
            "are specified for a custom JMS data source: url, driver, user, password");
      }

      JDBCInfo jdbcInfo = JDBCInfo.getInstance(sJMSDBURL);
      RelationalDatabase jmsDB = new RelationalDatabase(sJMSDBName);
      RelationalDatabaseFragment jmsDBFragment = (RelationalDatabaseFragment)jmsDB.getDefaultFragment();

      jmsDB.setAlias(sJMSDBName);
      jmsDB.setUnicode(false);
      jmsDB.setAdapter(new DataSourceAdapter(jdbcInfo.getDBTypeName()));
      jmsDBFragment.setAlias(sJMSDBName + jmsDBFragment.getSuffix());
      jmsDBFragment.setUser(sJMSDBUser);
      jmsDBFragment.setPassword(sJMSDBPassword);

      int nMinPoolSize;
      int nMaxPoolSize;

      try
      {
         String sMaxPoolSize = m_properties.getProperty("jms.jdbc.maxPoolSize");
         nMaxPoolSize = (sMaxPoolSize == null) ? getJMSDSMaxPoolSize() : Integer.parseInt(sMaxPoolSize);
      }
      catch (NumberFormatException e)
      {
         throw new IllegalArgumentException("Invalid JMS DS maxPoolSize \"" + m_properties.getProperty("jms.jdbc.maxPoolSize") + "\"", e);
      }

      try
      {
         String sMinPoolSize = m_properties.getProperty("jms.jdbc.minPoolSize");
         nMinPoolSize = (sMinPoolSize == null) ? Math.min(3, nMaxPoolSize) : Integer.parseInt(sMinPoolSize);
      }
      catch (NumberFormatException e)
      {
         throw new IllegalArgumentException("Invalid JMS DS minPoolSize \"" + m_properties.getProperty("jms.jdbc.minPoolSize") + "\"", e);
      }

      jmsDBFragment.setMinPoolSize(nMinPoolSize);
      jmsDBFragment.setMaxPoolSize(nMaxPoolSize);

      String sCustomProps = m_properties.getProperty("jms.jdbc.properties");

      if (sCustomProps != null)
      {
         Properties properties = PropertyUtil.fromString(sCustomProps);

         for (Iterator itr = properties.entrySet().iterator(); itr.hasNext();)
         {
            Map.Entry entry = (Map.Entry)itr.next();
            jmsDBFragment.getPropertyHolder().addDefaultProperty((String)entry.getKey(), (String)entry.getValue());
         }
      }

      return new JDBCConnectionInfo(jmsDB, sJMSDBDriver, sJMSDBURL, jdbcInfo.getTestSQL());
   }
View Full Code Here

TOP

Related Classes of nexj.core.util.JDBCInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.