[jira] Created: (OFBIZ-986) ConnectionFactory implementation is incomplete/faulty

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] Created: (OFBIZ-986) ConnectionFactory implementation is incomplete/faulty

Nicolas Malin (Jira)
ConnectionFactory implementation is incomplete/faulty
-----------------------------------------------------

                 Key: OFBIZ-986
                 URL: https://issues.apache.org/jira/browse/OFBIZ-986
             Project: OFBiz (The Open for Business Project)
          Issue Type: Bug
          Components: framework
         Environment: ALL
            Reporter: Valeriu


The current implementation of method org.ofbiz.entity.jdbc.ConnectionFactory.tryGenericConnectionSources(String helperName, Element inlineJdbcElement) is:
    public static Connection tryGenericConnectionSources(String helperName, Element inlineJdbcElement) throws SQLException, GenericEntityException {
        // Minerva Based
        try {
            Connection con = MinervaConnectionFactory.getConnection(helperName, inlineJdbcElement);
            if (con != null) return con;
        } catch (Exception ex) {
            Debug.logError(ex, "There was an error getting a Minerva datasource.", module);
        }

        /* DEJ20040103 XAPool still seems to have some serious issues and isn't working right, of course we may not be using it right, but I don't really feel like trying to track it down now
        // XAPool & JOTM Based
        try {
            Connection con = XaPoolConnectionFactory.getConnection(helperName, inlineJdbcElement);
            if (con != null) return con;
        } catch (Exception ex) {
            Debug.logError(ex, "There was an error getting a Minerva datasource.", module);
        }
        */

        /* DEJ20050103 This pretty much never works anyway, so leaving out to reduce error messages when things go bad
        // next try DBCP
        try {
            Connection con = DBCPConnectionFactory.getConnection(helperName, inlineJdbcElement);
            if (con != null) return con;
        } catch (Exception ex) {
            Debug.logError(ex, "There was an error getting a DBCP datasource.", module);
        }
       
        // Default to plain JDBC.
        String driverClassName = inlineJdbcElement.getAttribute("jdbc-driver");
        if (driverClassName != null && driverClassName.length() > 0) {
            try {
                ClassLoader loader = Thread.currentThread().getContextClassLoader();
                Class clazz = loader.loadClass(driverClassName);
                clazz.newInstance();
            } catch (ClassNotFoundException e) {
                Debug.logWarning(e, "Could not find JDBC driver class named " + driverClassName, module);
                return null;
            } catch (java.lang.IllegalAccessException e) {
                Debug.logWarning(e, "Not allowed to access JDBC driver class named " + driverClassName, module);
                return null;
            } catch (java.lang.InstantiationException e) {
                Debug.logWarning(e, "Could not create new instance of JDBC driver class named " + driverClassName, module);
                return null;
            }
            return DriverManager.getConnection(inlineJdbcElement.getAttribute("jdbc-uri"),
                    inlineJdbcElement.getAttribute("jdbc-username"), inlineJdbcElement.getAttribute("jdbc-password"));
        }
        */

        return null;
    }

The code seems not to be touched for a very long time (what is DEJ20050103? couldn't find any issue related to this). The only active section is the "Minerva" section.
What happened with plain JDBC or DBCP?
Basically I don't want to be tied by a specific implementation of connection factory, and most of all I don't want to use Minerva at all. As I understand, this is useful when you have distributed transactions (remote RDBMS') which is not my case.


--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Closed: (OFBIZ-986) ConnectionFactory implementation is incomplete/faulty

Nicolas Malin (Jira)

     [ https://issues.apache.org/jira/browse/OFBIZ-986?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jacopo Cappellato closed OFBIZ-986.
-----------------------------------

    Resolution: Fixed

A beta implementation (that it will probably be the default connection pool soon) of a DBCP factory is in svn with rev. 575181


> ConnectionFactory implementation is incomplete/faulty
> -----------------------------------------------------
>
>                 Key: OFBIZ-986
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-986
>             Project: OFBiz
>          Issue Type: Bug
>          Components: framework
>         Environment: ALL
>            Reporter: Valeriu
>
> The current implementation of method org.ofbiz.entity.jdbc.ConnectionFactory.tryGenericConnectionSources(String helperName, Element inlineJdbcElement) is:
>     public static Connection tryGenericConnectionSources(String helperName, Element inlineJdbcElement) throws SQLException, GenericEntityException {
>         // Minerva Based
>         try {
>             Connection con = MinervaConnectionFactory.getConnection(helperName, inlineJdbcElement);
>             if (con != null) return con;
>         } catch (Exception ex) {
>             Debug.logError(ex, "There was an error getting a Minerva datasource.", module);
>         }
>         /* DEJ20040103 XAPool still seems to have some serious issues and isn't working right, of course we may not be using it right, but I don't really feel like trying to track it down now
>         // XAPool & JOTM Based
>         try {
>             Connection con = XaPoolConnectionFactory.getConnection(helperName, inlineJdbcElement);
>             if (con != null) return con;
>         } catch (Exception ex) {
>             Debug.logError(ex, "There was an error getting a Minerva datasource.", module);
>         }
>         */
>         /* DEJ20050103 This pretty much never works anyway, so leaving out to reduce error messages when things go bad
>         // next try DBCP
>         try {
>             Connection con = DBCPConnectionFactory.getConnection(helperName, inlineJdbcElement);
>             if (con != null) return con;
>         } catch (Exception ex) {
>             Debug.logError(ex, "There was an error getting a DBCP datasource.", module);
>         }
>        
>         // Default to plain JDBC.
>         String driverClassName = inlineJdbcElement.getAttribute("jdbc-driver");
>         if (driverClassName != null && driverClassName.length() > 0) {
>             try {
>                 ClassLoader loader = Thread.currentThread().getContextClassLoader();
>                 Class clazz = loader.loadClass(driverClassName);
>                 clazz.newInstance();
>             } catch (ClassNotFoundException e) {
>                 Debug.logWarning(e, "Could not find JDBC driver class named " + driverClassName, module);
>                 return null;
>             } catch (java.lang.IllegalAccessException e) {
>                 Debug.logWarning(e, "Not allowed to access JDBC driver class named " + driverClassName, module);
>                 return null;
>             } catch (java.lang.InstantiationException e) {
>                 Debug.logWarning(e, "Could not create new instance of JDBC driver class named " + driverClassName, module);
>                 return null;
>             }
>             return DriverManager.getConnection(inlineJdbcElement.getAttribute("jdbc-uri"),
>                     inlineJdbcElement.getAttribute("jdbc-username"), inlineJdbcElement.getAttribute("jdbc-password"));
>         }
>         */
>         return null;
>     }
> The code seems not to be touched for a very long time (what is DEJ20050103? couldn't find any issue related to this). The only active section is the "Minerva" section.
> What happened with plain JDBC or DBCP?
> Basically I don't want to be tied by a specific implementation of connection factory, and most of all I don't want to use Minerva at all. As I understand, this is useful when you have distributed transactions (remote RDBMS') which is not my case.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.