You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "yuyf (JIRA)" <ji...@apache.org> on 2012/07/26 03:36:35 UTC

[jira] [Created] (DBUTILS-96) No suitable driver found for jdbc

yuyf created DBUTILS-96:
---------------------------

             Summary:  No suitable driver found for jdbc
                 Key: DBUTILS-96
                 URL: https://issues.apache.org/jira/browse/DBUTILS-96
             Project: Commons DbUtils
          Issue Type: Bug
         Environment: jdk 1.6
            Reporter: yuyf


By this way(use Dbutil get connect),it will say:No suitable driver found for jdbc:mysql://127.0.0.1:3306/xxx

urls = new URL[1];
urls[0] = new File("d:\\mysql_connector_5.1.15_bin.jar").toURL();		
DbUtils.loadDriver(urlClassLoader,driver);
Properties conProps = new Properties(); 
conProps.put("user", user); 
conProps.put("password", pwd); 
conProps.put("defaultRowPrefetch", "20"); 
scanedConnection = DriverManager.getConnection(url, conProps);


but by this way (use jdbc's api get connect),it's ok

try {
URL jdbcDriverURL = new File("d:\\mysql_connector_5.1.15_bin.jar").toURL();
URL[] urls = new URL[1];
urls[0] = jdbcDriverURL;
URLClassLoader urlclassLoader = new URLClassLoader(urls,ClassLoader.getSystemClassLoader());
try {
java.sql.Driver driverd = (java.sql.Driver) urlclassLoader.loadClass(driver).newInstance();
System.out.println(driverd.toString());
Properties props = new Properties();
props.setProperty("user", theUser);
props.setProperty("password", thePw);
try {
c = driverd.connect(dbUrl, props);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}//

} catch (MalformedURLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}




is this a bug or my useing falut?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (DBUTILS-96) dynamic load jdbc jars use Dbutils,it say No suitable driver found for jdbc

Posted by "yuyf (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DBUTILS-96?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

yuyf updated DBUTILS-96:
------------------------

    Attachment: mysql.properties
                dynamicloadjar.zip

please see the zip file.

in directory “dynamicloadjar” there're two classes,TestSimpleJdbc.java runs none exception,but TestDbutils.java runs error,it says:No suitable driver found for jdbc:mysql://127.0.0.1:3306/test

also when you run zhe program,please put the mysql_connector_5.1.15_bin.jar in D: directory
                
> dynamic load jdbc jars use Dbutils,it say  No suitable driver found for jdbc
> ----------------------------------------------------------------------------
>
>                 Key: DBUTILS-96
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-96
>             Project: Commons DbUtils
>          Issue Type: Bug
>         Environment: jdk 1.6
>            Reporter: yuyf
>         Attachments: dynamicloadjar.zip, mysql.properties
>
>
> By this way(use Dbutil get connect),it will say: {{No suitable driver found for jdbc:mysql://127.0.0.1:3306/xxx}}
> {code}
> urls = new URL[1];
> urls[0] = new File("d:\mysql_connector_5.1.15_bin.jar").toURL();
> URLClassLoader urlClassLoader= new URLClassLoader(urls, ClassLoader.getSystemClassLoader())		
> DbUtils.loadDriver(urlClassLoader, driver);
> Properties conProps = new Properties(); 
> conProps.put("user", user); 
> conProps.put("password", pwd); 
> conProps.put("defaultRowPrefetch", "20");
> scanedConnection = DriverManager.getConnection(url, conProps);
> {code}
> but by this way (use jdbc's api get connect),it's ok
> {code}
> try {
>     URL jdbcDriverURL = new File("d:\\mysql_connector_5.1.15_bin.jar").toURL();
>     URL[] urls = new URL[1];
>     urls[0] = jdbcDriverURL;
>     URLClassLoader urlclassLoader = new URLClassLoader(urls, ClassLoader.getSystemClassLoader());
>     try {
>         java.sql.Driver driverd = (java.sql.Driver) urlclassLoader.loadClass(driver).newInstance();
>         System.out.println(driverd.toString());
>         Properties props = new Properties();
>         props.setProperty("user", theUser);
>         props.setProperty("password", thePw);
>         try {
>             c = driverd.connect(dbUrl, props);
>         } catch (SQLException e) {
>             // TODO Auto-generated catch block
>             e.printStackTrace();
>         }
>     } catch (InstantiationException e) {
>         // TODO Auto-generated catch block
>         e.printStackTrace();
>     } catch (IllegalAccessException e) {
>         // TODO Auto-generated catch block
>         e.printStackTrace();
>     }
> } catch (MalformedURLException e1) {
>     // TODO Auto-generated catch block
>     e1.printStackTrace();
> }
> {code}
> is this a bug or my useing falut?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (DBUTILS-96) dynamic load jdbc jars use Dbutils,it say No suitable driver found for jdbc

Posted by "yuyf (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DBUTILS-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13423112#comment-13423112 ] 

yuyf commented on DBUTILS-96:
-----------------------------

I'm sorry for d:\mysql_connector_5.1.15_bin.jar。In my real program,there are all "d:\\mysql...jar",so it is not this reason.
                
> dynamic load jdbc jars use Dbutils,it say  No suitable driver found for jdbc
> ----------------------------------------------------------------------------
>
>                 Key: DBUTILS-96
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-96
>             Project: Commons DbUtils
>          Issue Type: Bug
>         Environment: jdk 1.6
>            Reporter: yuyf
>
> By this way(use Dbutil get connect),it will say:No suitable driver found for jdbc:mysql://127.0.0.1:3306/xxx
> urls = new URL[1];
> urls[0] = new File("d:\mysql_connector_5.1.15_bin.jar").toURL();
> URLClassLoader urlClassLoader= new URLClassLoader(urls,ClassLoader.getSystemClassLoader())		
> DbUtils.loadDriver(urlClassLoader,driver);
> Properties conProps = new Properties(); 
> conProps.put("user", user); 
> conProps.put("password", pwd); 
> conProps.put("defaultRowPrefetch", "20"); 
> scanedConnection = DriverManager.getConnection(url, conProps);
> but by this way (use jdbc's api get connect),it's ok
> try {
> URL jdbcDriverURL = new File("d:\\mysql_connector_5.1.15_bin.jar").toURL();
> URL[] urls = new URL[1];
> urls[0] = jdbcDriverURL;
> URLClassLoader urlclassLoader = new URLClassLoader(urls,ClassLoader.getSystemClassLoader());
> try {
> java.sql.Driver driverd = (java.sql.Driver) urlclassLoader.loadClass(driver).newInstance();
> System.out.println(driverd.toString());
> Properties props = new Properties();
> props.setProperty("user", theUser);
> props.setProperty("password", thePw);
> try {
> c = driverd.connect(dbUrl, props);
> } catch (SQLException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
> } catch (InstantiationException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> } catch (IllegalAccessException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }//
> } catch (MalformedURLException e1) {
> // TODO Auto-generated catch block
> e1.printStackTrace();
> }
> is this a bug or my useing falut?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (DBUTILS-96) dynamic load jdbc jars use Dbutils,it say No suitable driver found for jdbc

Posted by "yuyf (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DBUTILS-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13427926#comment-13427926 ] 

yuyf commented on DBUTILS-96:
-----------------------------

OK
thank u very much!

USE  such code  is ok

DriverManager.registerDriver(new DriverAdapter(driver)); 
                
> dynamic load jdbc jars use Dbutils,it say  No suitable driver found for jdbc
> ----------------------------------------------------------------------------
>
>                 Key: DBUTILS-96
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-96
>             Project: Commons DbUtils
>          Issue Type: Bug
>         Environment: jdk 1.6
>            Reporter: yuyf
>         Attachments: DBUTILS-96.patch, dbutils-96.tar.gz, dynamicloadjar.zip, mysql.properties
>
>
> By this way(use Dbutil get connect),it will say: {{No suitable driver found for jdbc:mysql://127.0.0.1:3306/xxx}}
> {code}
> urls = new URL[1];
> urls[0] = new File("d:\mysql_connector_5.1.15_bin.jar").toURL();
> URLClassLoader urlClassLoader= new URLClassLoader(urls, ClassLoader.getSystemClassLoader())		
> DbUtils.loadDriver(urlClassLoader, driver);
> Properties conProps = new Properties(); 
> conProps.put("user", user); 
> conProps.put("password", pwd); 
> conProps.put("defaultRowPrefetch", "20");
> scanedConnection = DriverManager.getConnection(url, conProps);
> {code}
> but by this way (use jdbc's api get connect),it's ok
> {code}
> try {
>     URL jdbcDriverURL = new File("d:\\mysql_connector_5.1.15_bin.jar").toURL();
>     URL[] urls = new URL[1];
>     urls[0] = jdbcDriverURL;
>     URLClassLoader urlclassLoader = new URLClassLoader(urls, ClassLoader.getSystemClassLoader());
>     try {
>         java.sql.Driver driverd = (java.sql.Driver) urlclassLoader.loadClass(driver).newInstance();
>         System.out.println(driverd.toString());
>         Properties props = new Properties();
>         props.setProperty("user", theUser);
>         props.setProperty("password", thePw);
>         try {
>             c = driverd.connect(dbUrl, props);
>         } catch (SQLException e) {
>             // TODO Auto-generated catch block
>             e.printStackTrace();
>         }
>     } catch (InstantiationException e) {
>         // TODO Auto-generated catch block
>         e.printStackTrace();
>     } catch (IllegalAccessException e) {
>         // TODO Auto-generated catch block
>         e.printStackTrace();
>     }
> } catch (MalformedURLException e1) {
>     // TODO Auto-generated catch block
>     e1.printStackTrace();
> }
> {code}
> is this a bug or my useing falut?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Comment Edited] (DBUTILS-96) dynamic load jdbc jars use Dbutils,it say No suitable driver found for jdbc

Posted by "yuyf (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DBUTILS-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13423112#comment-13423112 ] 

yuyf edited comment on DBUTILS-96 at 7/26/12 2:39 PM:
------------------------------------------------------

I'm sorry for d:\mysql_connector_5.1.15_bin.jar。In my real program,there are all "d:\\\\mysql...jar",so it is not this reason.
                
      was (Author: yyflyons):
    I'm sorry for d:\mysql_connector_5.1.15_bin.jar。In my real program,there are all "d:\\mysql...jar",so it is not this reason.
                  
> dynamic load jdbc jars use Dbutils,it say  No suitable driver found for jdbc
> ----------------------------------------------------------------------------
>
>                 Key: DBUTILS-96
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-96
>             Project: Commons DbUtils
>          Issue Type: Bug
>         Environment: jdk 1.6
>            Reporter: yuyf
>
> By this way(use Dbutil get connect),it will say:No suitable driver found for jdbc:mysql://127.0.0.1:3306/xxx
> urls = new URL[1];
> urls[0] = new File("d:\mysql_connector_5.1.15_bin.jar").toURL();
> URLClassLoader urlClassLoader= new URLClassLoader(urls,ClassLoader.getSystemClassLoader())		
> DbUtils.loadDriver(urlClassLoader,driver);
> Properties conProps = new Properties(); 
> conProps.put("user", user); 
> conProps.put("password", pwd); 
> conProps.put("defaultRowPrefetch", "20"); 
> scanedConnection = DriverManager.getConnection(url, conProps);
> but by this way (use jdbc's api get connect),it's ok
> try {
> URL jdbcDriverURL = new File("d:\\mysql_connector_5.1.15_bin.jar").toURL();
> URL[] urls = new URL[1];
> urls[0] = jdbcDriverURL;
> URLClassLoader urlclassLoader = new URLClassLoader(urls,ClassLoader.getSystemClassLoader());
> try {
> java.sql.Driver driverd = (java.sql.Driver) urlclassLoader.loadClass(driver).newInstance();
> System.out.println(driverd.toString());
> Properties props = new Properties();
> props.setProperty("user", theUser);
> props.setProperty("password", thePw);
> try {
> c = driverd.connect(dbUrl, props);
> } catch (SQLException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
> } catch (InstantiationException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> } catch (IllegalAccessException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }//
> } catch (MalformedURLException e1) {
> // TODO Auto-generated catch block
> e1.printStackTrace();
> }
> is this a bug or my useing falut?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Updated] (DBUTILS-96) dynamic load jdbc jars use Dbutils,it say No suitable driver found for jdbc

Posted by "Simone Tripodi (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DBUTILS-96?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Simone Tripodi updated DBUTILS-96:
----------------------------------

    Description: 
By this way(use Dbutil get connect),it will say: {{No suitable driver found for jdbc:mysql://127.0.0.1:3306/xxx}}

{code}
urls = new URL[1];
urls[0] = new File("d:\mysql_connector_5.1.15_bin.jar").toURL();
URLClassLoader urlClassLoader= new URLClassLoader(urls,ClassLoader.getSystemClassLoader())		
DbUtils.loadDriver(urlClassLoader, driver);

Properties conProps = new Properties(); 
conProps.put("user", user); 
conProps.put("password", pwd); 
conProps.put("defaultRowPrefetch", "20");

scanedConnection = DriverManager.getConnection(url, conProps);
{code}

but by this way (use jdbc's api get connect),it's ok

{code}
try {
    URL jdbcDriverURL = new File("d:\\mysql_connector_5.1.15_bin.jar").toURL();
    URL[] urls = new URL[1];
    urls[0] = jdbcDriverURL;
    URLClassLoader urlclassLoader = new URLClassLoader(urls, ClassLoader.getSystemClassLoader());
    try {
        java.sql.Driver driverd = (java.sql.Driver) urlclassLoader.loadClass(driver).newInstance();
        System.out.println(driverd.toString());
        Properties props = new Properties();
        props.setProperty("user", theUser);
        props.setProperty("password", thePw);
        try {
            c = driverd.connect(dbUrl, props);
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    } catch (InstantiationException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
} catch (IllegalAccessException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}//

} catch (MalformedURLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
{code}

is this a bug or my useing falut?

  was:
By this way(use Dbutil get connect),it will say: {{No suitable driver found for jdbc:mysql://127.0.0.1:3306/xxx}}

{code}
urls = new URL[1];
urls[0] = new File("d:\mysql_connector_5.1.15_bin.jar").toURL();
URLClassLoader urlClassLoader= new URLClassLoader(urls,ClassLoader.getSystemClassLoader())		
DbUtils.loadDriver(urlClassLoader,driver);

Properties conProps = new Properties(); 
conProps.put("user", user); 
conProps.put("password", pwd); 
conProps.put("defaultRowPrefetch", "20");

scanedConnection = DriverManager.getConnection(url, conProps);
{code}

but by this way (use jdbc's api get connect),it's ok

{code}
try {
    URL jdbcDriverURL = new File("d:\\mysql_connector_5.1.15_bin.jar").toURL();
    URL[] urls = new URL[1];
    urls[0] = jdbcDriverURL;
    URLClassLoader urlclassLoader = new URLClassLoader(urls,ClassLoader.getSystemClassLoader());
    try {
        java.sql.Driver driverd = (java.sql.Driver)             urlclassLoader.loadClass(driver).newInstance();
        System.out.println(driverd.toString());
        Properties props = new Properties();
        props.setProperty("user", theUser);
        props.setProperty("password", thePw);
        try {
            c = driverd.connect(dbUrl, props);
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    } catch (InstantiationException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
} catch (IllegalAccessException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}//

} catch (MalformedURLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
{code}

is this a bug or my useing falut?

    
> dynamic load jdbc jars use Dbutils,it say  No suitable driver found for jdbc
> ----------------------------------------------------------------------------
>
>                 Key: DBUTILS-96
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-96
>             Project: Commons DbUtils
>          Issue Type: Bug
>         Environment: jdk 1.6
>            Reporter: yuyf
>
> By this way(use Dbutil get connect),it will say: {{No suitable driver found for jdbc:mysql://127.0.0.1:3306/xxx}}
> {code}
> urls = new URL[1];
> urls[0] = new File("d:\mysql_connector_5.1.15_bin.jar").toURL();
> URLClassLoader urlClassLoader= new URLClassLoader(urls,ClassLoader.getSystemClassLoader())		
> DbUtils.loadDriver(urlClassLoader, driver);
> Properties conProps = new Properties(); 
> conProps.put("user", user); 
> conProps.put("password", pwd); 
> conProps.put("defaultRowPrefetch", "20");
> scanedConnection = DriverManager.getConnection(url, conProps);
> {code}
> but by this way (use jdbc's api get connect),it's ok
> {code}
> try {
>     URL jdbcDriverURL = new File("d:\\mysql_connector_5.1.15_bin.jar").toURL();
>     URL[] urls = new URL[1];
>     urls[0] = jdbcDriverURL;
>     URLClassLoader urlclassLoader = new URLClassLoader(urls, ClassLoader.getSystemClassLoader());
>     try {
>         java.sql.Driver driverd = (java.sql.Driver) urlclassLoader.loadClass(driver).newInstance();
>         System.out.println(driverd.toString());
>         Properties props = new Properties();
>         props.setProperty("user", theUser);
>         props.setProperty("password", thePw);
>         try {
>             c = driverd.connect(dbUrl, props);
>         } catch (SQLException e) {
>             // TODO Auto-generated catch block
>             e.printStackTrace();
>         }
>     } catch (InstantiationException e) {
>         // TODO Auto-generated catch block
>         e.printStackTrace();
> } catch (IllegalAccessException e) {
>     // TODO Auto-generated catch block
>     e.printStackTrace();
> }//
> } catch (MalformedURLException e1) {
> // TODO Auto-generated catch block
> e1.printStackTrace();
> }
> {code}
> is this a bug or my useing falut?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (DBUTILS-96) dynamic load jdbc jars use Dbutils,it say No suitable driver found for jdbc

Posted by "Simone Tripodi (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DBUTILS-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13424814#comment-13424814 ] 

Simone Tripodi commented on DBUTILS-96:
---------------------------------------

OK I figured out that {{DriverManager}} is not able to manage {{Driver}} instances that were not loaded by the system {{ClassLoader}}, see [Pick your JDBC driver at runtime |http://www.kfu.com/~nsayer/Java/dyn-jdbc.html].

If no objections, I could work on a patch to DbUtils to work around that problem.

Bill, WDYT? TIA!
                
> dynamic load jdbc jars use Dbutils,it say  No suitable driver found for jdbc
> ----------------------------------------------------------------------------
>
>                 Key: DBUTILS-96
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-96
>             Project: Commons DbUtils
>          Issue Type: Bug
>         Environment: jdk 1.6
>            Reporter: yuyf
>         Attachments: dynamicloadjar.zip, mysql.properties
>
>
> By this way(use Dbutil get connect),it will say: {{No suitable driver found for jdbc:mysql://127.0.0.1:3306/xxx}}
> {code}
> urls = new URL[1];
> urls[0] = new File("d:\mysql_connector_5.1.15_bin.jar").toURL();
> URLClassLoader urlClassLoader= new URLClassLoader(urls, ClassLoader.getSystemClassLoader())		
> DbUtils.loadDriver(urlClassLoader, driver);
> Properties conProps = new Properties(); 
> conProps.put("user", user); 
> conProps.put("password", pwd); 
> conProps.put("defaultRowPrefetch", "20");
> scanedConnection = DriverManager.getConnection(url, conProps);
> {code}
> but by this way (use jdbc's api get connect),it's ok
> {code}
> try {
>     URL jdbcDriverURL = new File("d:\\mysql_connector_5.1.15_bin.jar").toURL();
>     URL[] urls = new URL[1];
>     urls[0] = jdbcDriverURL;
>     URLClassLoader urlclassLoader = new URLClassLoader(urls, ClassLoader.getSystemClassLoader());
>     try {
>         java.sql.Driver driverd = (java.sql.Driver) urlclassLoader.loadClass(driver).newInstance();
>         System.out.println(driverd.toString());
>         Properties props = new Properties();
>         props.setProperty("user", theUser);
>         props.setProperty("password", thePw);
>         try {
>             c = driverd.connect(dbUrl, props);
>         } catch (SQLException e) {
>             // TODO Auto-generated catch block
>             e.printStackTrace();
>         }
>     } catch (InstantiationException e) {
>         // TODO Auto-generated catch block
>         e.printStackTrace();
>     } catch (IllegalAccessException e) {
>         // TODO Auto-generated catch block
>         e.printStackTrace();
>     }
> } catch (MalformedURLException e1) {
>     // TODO Auto-generated catch block
>     e1.printStackTrace();
> }
> {code}
> is this a bug or my useing falut?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (DBUTILS-96) dynamic load jdbc jars use Dbutils,it say No suitable driver found for jdbc

Posted by "Simone Tripodi (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DBUTILS-96?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Simone Tripodi updated DBUTILS-96:
----------------------------------

    Attachment: DBUTILS-96_v3.patch

Last patch that takes in consideration also {{Driver}} implementation with private constructors.

Please check, if no objections I can commit it.

TIA!
                
> dynamic load jdbc jars use Dbutils,it say  No suitable driver found for jdbc
> ----------------------------------------------------------------------------
>
>                 Key: DBUTILS-96
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-96
>             Project: Commons DbUtils
>          Issue Type: Bug
>         Environment: jdk 1.6
>            Reporter: yuyf
>         Attachments: DBUTILS-96.patch, DBUTILS-96_v2.patch, DBUTILS-96_v3.patch, dbutils-96.tar.gz, dynamicloadjar.zip, mysql.properties
>
>
> By this way(use Dbutil get connect),it will say: {{No suitable driver found for jdbc:mysql://127.0.0.1:3306/xxx}}
> {code}
> urls = new URL[1];
> urls[0] = new File("d:\mysql_connector_5.1.15_bin.jar").toURL();
> URLClassLoader urlClassLoader= new URLClassLoader(urls, ClassLoader.getSystemClassLoader())		
> DbUtils.loadDriver(urlClassLoader, driver);
> Properties conProps = new Properties(); 
> conProps.put("user", user); 
> conProps.put("password", pwd); 
> conProps.put("defaultRowPrefetch", "20");
> scanedConnection = DriverManager.getConnection(url, conProps);
> {code}
> but by this way (use jdbc's api get connect),it's ok
> {code}
> try {
>     URL jdbcDriverURL = new File("d:\\mysql_connector_5.1.15_bin.jar").toURL();
>     URL[] urls = new URL[1];
>     urls[0] = jdbcDriverURL;
>     URLClassLoader urlclassLoader = new URLClassLoader(urls, ClassLoader.getSystemClassLoader());
>     try {
>         java.sql.Driver driverd = (java.sql.Driver) urlclassLoader.loadClass(driver).newInstance();
>         System.out.println(driverd.toString());
>         Properties props = new Properties();
>         props.setProperty("user", theUser);
>         props.setProperty("password", thePw);
>         try {
>             c = driverd.connect(dbUrl, props);
>         } catch (SQLException e) {
>             // TODO Auto-generated catch block
>             e.printStackTrace();
>         }
>     } catch (InstantiationException e) {
>         // TODO Auto-generated catch block
>         e.printStackTrace();
>     } catch (IllegalAccessException e) {
>         // TODO Auto-generated catch block
>         e.printStackTrace();
>     }
> } catch (MalformedURLException e1) {
>     // TODO Auto-generated catch block
>     e1.printStackTrace();
> }
> {code}
> is this a bug or my useing falut?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Comment Edited] (DBUTILS-96) dynamic load jdbc jars use Dbutils,it say No suitable driver found for jdbc

Posted by "yuyf (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DBUTILS-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13423112#comment-13423112 ] 

yuyf edited comment on DBUTILS-96 at 7/26/12 2:40 PM:
------------------------------------------------------

I'm sorry for d:\mysql_connector_5.1.15_bin.jar。In my real program,there are all "d://mysql...jar",so it is not this reason.
                
      was (Author: yyflyons):
    I'm sorry for d:\mysql_connector_5.1.15_bin.jar。In my real program,there are all "d:\\\mysql...jar",so it is not this reason.
                  
> dynamic load jdbc jars use Dbutils,it say  No suitable driver found for jdbc
> ----------------------------------------------------------------------------
>
>                 Key: DBUTILS-96
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-96
>             Project: Commons DbUtils
>          Issue Type: Bug
>         Environment: jdk 1.6
>            Reporter: yuyf
>
> By this way(use Dbutil get connect),it will say:No suitable driver found for jdbc:mysql://127.0.0.1:3306/xxx
> urls = new URL[1];
> urls[0] = new File("d:\mysql_connector_5.1.15_bin.jar").toURL();
> URLClassLoader urlClassLoader= new URLClassLoader(urls,ClassLoader.getSystemClassLoader())		
> DbUtils.loadDriver(urlClassLoader,driver);
> Properties conProps = new Properties(); 
> conProps.put("user", user); 
> conProps.put("password", pwd); 
> conProps.put("defaultRowPrefetch", "20"); 
> scanedConnection = DriverManager.getConnection(url, conProps);
> but by this way (use jdbc's api get connect),it's ok
> try {
> URL jdbcDriverURL = new File("d:\\mysql_connector_5.1.15_bin.jar").toURL();
> URL[] urls = new URL[1];
> urls[0] = jdbcDriverURL;
> URLClassLoader urlclassLoader = new URLClassLoader(urls,ClassLoader.getSystemClassLoader());
> try {
> java.sql.Driver driverd = (java.sql.Driver) urlclassLoader.loadClass(driver).newInstance();
> System.out.println(driverd.toString());
> Properties props = new Properties();
> props.setProperty("user", theUser);
> props.setProperty("password", thePw);
> try {
> c = driverd.connect(dbUrl, props);
> } catch (SQLException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
> } catch (InstantiationException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> } catch (IllegalAccessException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }//
> } catch (MalformedURLException e1) {
> // TODO Auto-generated catch block
> e1.printStackTrace();
> }
> is this a bug or my useing falut?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (DBUTILS-96) dynamic load jdbc jars use Dbutils,it say No suitable driver found for jdbc

Posted by "Simone Tripodi (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DBUTILS-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13424799#comment-13424799 ] 

Simone Tripodi commented on DBUTILS-96:
---------------------------------------

Did you notice that if in your "home made" solution, if you invoke {{DriverManager.getConnection( dbUrl, props )}} rather than {{driverd.connect( dbUrl, props )}} you obtain the same error message and the test fails as well?
                
> dynamic load jdbc jars use Dbutils,it say  No suitable driver found for jdbc
> ----------------------------------------------------------------------------
>
>                 Key: DBUTILS-96
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-96
>             Project: Commons DbUtils
>          Issue Type: Bug
>         Environment: jdk 1.6
>            Reporter: yuyf
>         Attachments: dynamicloadjar.zip, mysql.properties
>
>
> By this way(use Dbutil get connect),it will say: {{No suitable driver found for jdbc:mysql://127.0.0.1:3306/xxx}}
> {code}
> urls = new URL[1];
> urls[0] = new File("d:\mysql_connector_5.1.15_bin.jar").toURL();
> URLClassLoader urlClassLoader= new URLClassLoader(urls, ClassLoader.getSystemClassLoader())		
> DbUtils.loadDriver(urlClassLoader, driver);
> Properties conProps = new Properties(); 
> conProps.put("user", user); 
> conProps.put("password", pwd); 
> conProps.put("defaultRowPrefetch", "20");
> scanedConnection = DriverManager.getConnection(url, conProps);
> {code}
> but by this way (use jdbc's api get connect),it's ok
> {code}
> try {
>     URL jdbcDriverURL = new File("d:\\mysql_connector_5.1.15_bin.jar").toURL();
>     URL[] urls = new URL[1];
>     urls[0] = jdbcDriverURL;
>     URLClassLoader urlclassLoader = new URLClassLoader(urls, ClassLoader.getSystemClassLoader());
>     try {
>         java.sql.Driver driverd = (java.sql.Driver) urlclassLoader.loadClass(driver).newInstance();
>         System.out.println(driverd.toString());
>         Properties props = new Properties();
>         props.setProperty("user", theUser);
>         props.setProperty("password", thePw);
>         try {
>             c = driverd.connect(dbUrl, props);
>         } catch (SQLException e) {
>             // TODO Auto-generated catch block
>             e.printStackTrace();
>         }
>     } catch (InstantiationException e) {
>         // TODO Auto-generated catch block
>         e.printStackTrace();
>     } catch (IllegalAccessException e) {
>         // TODO Auto-generated catch block
>         e.printStackTrace();
>     }
> } catch (MalformedURLException e1) {
>     // TODO Auto-generated catch block
>     e1.printStackTrace();
> }
> {code}
> is this a bug or my useing falut?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (DBUTILS-96) dynamic load jdbc jars use Dbutils,it say No suitable driver found for jdbc

Posted by "William R. Speirs (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DBUTILS-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13429329#comment-13429329 ] 

William R. Speirs commented on DBUTILS-96:
------------------------------------------

v3 looks good. I'd say commit, post the SVN rev number here, and resolve. Thanks!
                
> dynamic load jdbc jars use Dbutils,it say  No suitable driver found for jdbc
> ----------------------------------------------------------------------------
>
>                 Key: DBUTILS-96
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-96
>             Project: Commons DbUtils
>          Issue Type: Bug
>         Environment: jdk 1.6
>            Reporter: yuyf
>            Assignee: Simone Tripodi
>         Attachments: DBUTILS-96.patch, DBUTILS-96_v2.patch, DBUTILS-96_v3.patch, dbutils-96.tar.gz, dynamicloadjar.zip, mysql.properties
>
>
> By this way(use Dbutil get connect),it will say: {{No suitable driver found for jdbc:mysql://127.0.0.1:3306/xxx}}
> {code}
> urls = new URL[1];
> urls[0] = new File("d:\mysql_connector_5.1.15_bin.jar").toURL();
> URLClassLoader urlClassLoader= new URLClassLoader(urls, ClassLoader.getSystemClassLoader())		
> DbUtils.loadDriver(urlClassLoader, driver);
> Properties conProps = new Properties(); 
> conProps.put("user", user); 
> conProps.put("password", pwd); 
> conProps.put("defaultRowPrefetch", "20");
> scanedConnection = DriverManager.getConnection(url, conProps);
> {code}
> but by this way (use jdbc's api get connect),it's ok
> {code}
> try {
>     URL jdbcDriverURL = new File("d:\\mysql_connector_5.1.15_bin.jar").toURL();
>     URL[] urls = new URL[1];
>     urls[0] = jdbcDriverURL;
>     URLClassLoader urlclassLoader = new URLClassLoader(urls, ClassLoader.getSystemClassLoader());
>     try {
>         java.sql.Driver driverd = (java.sql.Driver) urlclassLoader.loadClass(driver).newInstance();
>         System.out.println(driverd.toString());
>         Properties props = new Properties();
>         props.setProperty("user", theUser);
>         props.setProperty("password", thePw);
>         try {
>             c = driverd.connect(dbUrl, props);
>         } catch (SQLException e) {
>             // TODO Auto-generated catch block
>             e.printStackTrace();
>         }
>     } catch (InstantiationException e) {
>         // TODO Auto-generated catch block
>         e.printStackTrace();
>     } catch (IllegalAccessException e) {
>         // TODO Auto-generated catch block
>         e.printStackTrace();
>     }
> } catch (MalformedURLException e1) {
>     // TODO Auto-generated catch block
>     e1.printStackTrace();
> }
> {code}
> is this a bug or my useing falut?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (DBUTILS-96) dynamic load jdbc jars use Dbutils,it say No suitable driver found for jdbc

Posted by "Simone Tripodi (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DBUTILS-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13423859#comment-13423859 ] 

Simone Tripodi commented on DBUTILS-96:
---------------------------------------

Could you please attach a zip/tar/whatever program that reproduces the issue, rather than pasting the code?
TIA!
                
> dynamic load jdbc jars use Dbutils,it say  No suitable driver found for jdbc
> ----------------------------------------------------------------------------
>
>                 Key: DBUTILS-96
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-96
>             Project: Commons DbUtils
>          Issue Type: Bug
>         Environment: jdk 1.6
>            Reporter: yuyf
>
> By this way(use Dbutil get connect),it will say:No suitable driver found for jdbc:mysql://127.0.0.1:3306/xxx
> urls = new URL[1];
> urls[0] = new File("d:\mysql_connector_5.1.15_bin.jar").toURL();
> URLClassLoader urlClassLoader= new URLClassLoader(urls,ClassLoader.getSystemClassLoader())		
> DbUtils.loadDriver(urlClassLoader,driver);
> Properties conProps = new Properties(); 
> conProps.put("user", user); 
> conProps.put("password", pwd); 
> conProps.put("defaultRowPrefetch", "20"); 
> scanedConnection = DriverManager.getConnection(url, conProps);
> but by this way (use jdbc's api get connect),it's ok
> try {
> URL jdbcDriverURL = new File("d:\\mysql_connector_5.1.15_bin.jar").toURL();
> URL[] urls = new URL[1];
> urls[0] = jdbcDriverURL;
> URLClassLoader urlclassLoader = new URLClassLoader(urls,ClassLoader.getSystemClassLoader());
> try {
> java.sql.Driver driverd = (java.sql.Driver) urlclassLoader.loadClass(driver).newInstance();
> System.out.println(driverd.toString());
> Properties props = new Properties();
> props.setProperty("user", theUser);
> props.setProperty("password", thePw);
> try {
> c = driverd.connect(dbUrl, props);
> } catch (SQLException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
> } catch (InstantiationException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> } catch (IllegalAccessException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }//
> } catch (MalformedURLException e1) {
> // TODO Auto-generated catch block
> e1.printStackTrace();
> }
> is this a bug or my useing falut?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (DBUTILS-96) dynamic load jdbc jars use Dbutils,it say No suitable driver found for jdbc

Posted by "William R. Speirs (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DBUTILS-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13423104#comment-13423104 ] 

William R. Speirs commented on DBUTILS-96:
------------------------------------------

This is most likely your use. I noticed in the non-working one you have the path as "d:\mysql_connector_5.1.15_bin.jar" but in the working one you have "d:mysql_connector_5.1.15_bin.jar". I'm guessing the issue is the improperly escaped \m 
                
> dynamic load jdbc jars use Dbutils,it say  No suitable driver found for jdbc
> ----------------------------------------------------------------------------
>
>                 Key: DBUTILS-96
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-96
>             Project: Commons DbUtils
>          Issue Type: Bug
>         Environment: jdk 1.6
>            Reporter: yuyf
>
> By this way(use Dbutil get connect),it will say:No suitable driver found for jdbc:mysql://127.0.0.1:3306/xxx
> urls = new URL[1];
> urls[0] = new File("d:\mysql_connector_5.1.15_bin.jar").toURL();
> URLClassLoader urlClassLoader= new URLClassLoader(urls,ClassLoader.getSystemClassLoader())		
> DbUtils.loadDriver(urlClassLoader,driver);
> Properties conProps = new Properties(); 
> conProps.put("user", user); 
> conProps.put("password", pwd); 
> conProps.put("defaultRowPrefetch", "20"); 
> scanedConnection = DriverManager.getConnection(url, conProps);
> but by this way (use jdbc's api get connect),it's ok
> try {
> URL jdbcDriverURL = new File("d:\\mysql_connector_5.1.15_bin.jar").toURL();
> URL[] urls = new URL[1];
> urls[0] = jdbcDriverURL;
> URLClassLoader urlclassLoader = new URLClassLoader(urls,ClassLoader.getSystemClassLoader());
> try {
> java.sql.Driver driverd = (java.sql.Driver) urlclassLoader.loadClass(driver).newInstance();
> System.out.println(driverd.toString());
> Properties props = new Properties();
> props.setProperty("user", theUser);
> props.setProperty("password", thePw);
> try {
> c = driverd.connect(dbUrl, props);
> } catch (SQLException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
> } catch (InstantiationException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> } catch (IllegalAccessException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }//
> } catch (MalformedURLException e1) {
> // TODO Auto-generated catch block
> e1.printStackTrace();
> }
> is this a bug or my useing falut?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (DBUTILS-96) dynamic load jdbc jars use Dbutils,it say No suitable driver found for jdbc

Posted by "Simone Tripodi (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DBUTILS-96?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Simone Tripodi updated DBUTILS-96:
----------------------------------

    Description: 
By this way(use Dbutil get connect),it will say: {{No suitable driver found for jdbc:mysql://127.0.0.1:3306/xxx}}

{code}
urls = new URL[1];
urls[0] = new File("d:\mysql_connector_5.1.15_bin.jar").toURL();
URLClassLoader urlClassLoader= new URLClassLoader(urls, ClassLoader.getSystemClassLoader())		
DbUtils.loadDriver(urlClassLoader, driver);

Properties conProps = new Properties(); 
conProps.put("user", user); 
conProps.put("password", pwd); 
conProps.put("defaultRowPrefetch", "20");

scanedConnection = DriverManager.getConnection(url, conProps);
{code}

but by this way (use jdbc's api get connect),it's ok

{code}
try {
    URL jdbcDriverURL = new File("d:\\mysql_connector_5.1.15_bin.jar").toURL();
    URL[] urls = new URL[1];
    urls[0] = jdbcDriverURL;
    URLClassLoader urlclassLoader = new URLClassLoader(urls, ClassLoader.getSystemClassLoader());
    try {
        java.sql.Driver driverd = (java.sql.Driver) urlclassLoader.loadClass(driver).newInstance();
        System.out.println(driverd.toString());
        Properties props = new Properties();
        props.setProperty("user", theUser);
        props.setProperty("password", thePw);
        try {
            c = driverd.connect(dbUrl, props);
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    } catch (InstantiationException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
} catch (MalformedURLException e1) {
    // TODO Auto-generated catch block
    e1.printStackTrace();
}
{code}

is this a bug or my useing falut?

  was:
By this way(use Dbutil get connect),it will say: {{No suitable driver found for jdbc:mysql://127.0.0.1:3306/xxx}}

{code}
urls = new URL[1];
urls[0] = new File("d:\mysql_connector_5.1.15_bin.jar").toURL();
URLClassLoader urlClassLoader= new URLClassLoader(urls, ClassLoader.getSystemClassLoader())		
DbUtils.loadDriver(urlClassLoader, driver);

Properties conProps = new Properties(); 
conProps.put("user", user); 
conProps.put("password", pwd); 
conProps.put("defaultRowPrefetch", "20");

scanedConnection = DriverManager.getConnection(url, conProps);
{code}

but by this way (use jdbc's api get connect),it's ok

{code}
try {
    URL jdbcDriverURL = new File("d:\\mysql_connector_5.1.15_bin.jar").toURL();
    URL[] urls = new URL[1];
    urls[0] = jdbcDriverURL;
    URLClassLoader urlclassLoader = new URLClassLoader(urls, ClassLoader.getSystemClassLoader());
    try {
        java.sql.Driver driverd = (java.sql.Driver) urlclassLoader.loadClass(driver).newInstance();
        System.out.println(driverd.toString());
        Properties props = new Properties();
        props.setProperty("user", theUser);
        props.setProperty("password", thePw);
        try {
            c = driverd.connect(dbUrl, props);
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    } catch (InstantiationException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
} catch (IllegalAccessException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}//

} catch (MalformedURLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
{code}

is this a bug or my useing falut?

    
> dynamic load jdbc jars use Dbutils,it say  No suitable driver found for jdbc
> ----------------------------------------------------------------------------
>
>                 Key: DBUTILS-96
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-96
>             Project: Commons DbUtils
>          Issue Type: Bug
>         Environment: jdk 1.6
>            Reporter: yuyf
>
> By this way(use Dbutil get connect),it will say: {{No suitable driver found for jdbc:mysql://127.0.0.1:3306/xxx}}
> {code}
> urls = new URL[1];
> urls[0] = new File("d:\mysql_connector_5.1.15_bin.jar").toURL();
> URLClassLoader urlClassLoader= new URLClassLoader(urls, ClassLoader.getSystemClassLoader())		
> DbUtils.loadDriver(urlClassLoader, driver);
> Properties conProps = new Properties(); 
> conProps.put("user", user); 
> conProps.put("password", pwd); 
> conProps.put("defaultRowPrefetch", "20");
> scanedConnection = DriverManager.getConnection(url, conProps);
> {code}
> but by this way (use jdbc's api get connect),it's ok
> {code}
> try {
>     URL jdbcDriverURL = new File("d:\\mysql_connector_5.1.15_bin.jar").toURL();
>     URL[] urls = new URL[1];
>     urls[0] = jdbcDriverURL;
>     URLClassLoader urlclassLoader = new URLClassLoader(urls, ClassLoader.getSystemClassLoader());
>     try {
>         java.sql.Driver driverd = (java.sql.Driver) urlclassLoader.loadClass(driver).newInstance();
>         System.out.println(driverd.toString());
>         Properties props = new Properties();
>         props.setProperty("user", theUser);
>         props.setProperty("password", thePw);
>         try {
>             c = driverd.connect(dbUrl, props);
>         } catch (SQLException e) {
>             // TODO Auto-generated catch block
>             e.printStackTrace();
>         }
>     } catch (InstantiationException e) {
>         // TODO Auto-generated catch block
>         e.printStackTrace();
>     } catch (IllegalAccessException e) {
>         // TODO Auto-generated catch block
>         e.printStackTrace();
>     }
> } catch (MalformedURLException e1) {
>     // TODO Auto-generated catch block
>     e1.printStackTrace();
> }
> {code}
> is this a bug or my useing falut?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Comment Edited] (DBUTILS-96) dynamic load jdbc jars use Dbutils,it say No suitable driver found for jdbc

Posted by "yuyf (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DBUTILS-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13424748#comment-13424748 ] 

yuyf edited comment on DBUTILS-96 at 7/30/12 8:28 AM:
------------------------------------------------------

please see the zip file.

in directory “dynamicloadjar” there're two classes,TestSimpleJdbc.java runs none exception,but TestDbutils.java runs error,it says:No suitable driver found for jdbc:mysql://127.0.0.1:3306/test

also when you run zhe program,please put the mysql_connector_5.1.15_bin.jar in D: directory

and modify mysql.properties with your mysql info

thank you!
                
      was (Author: yyflyons):
    please see the zip file.

in directory “dynamicloadjar” there're two classes,TestSimpleJdbc.java runs none exception,but TestDbutils.java runs error,it says:No suitable driver found for jdbc:mysql://127.0.0.1:3306/test

also when you run zhe program,please put the mysql_connector_5.1.15_bin.jar in D: directory
                  
> dynamic load jdbc jars use Dbutils,it say  No suitable driver found for jdbc
> ----------------------------------------------------------------------------
>
>                 Key: DBUTILS-96
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-96
>             Project: Commons DbUtils
>          Issue Type: Bug
>         Environment: jdk 1.6
>            Reporter: yuyf
>         Attachments: dynamicloadjar.zip, mysql.properties
>
>
> By this way(use Dbutil get connect),it will say: {{No suitable driver found for jdbc:mysql://127.0.0.1:3306/xxx}}
> {code}
> urls = new URL[1];
> urls[0] = new File("d:\mysql_connector_5.1.15_bin.jar").toURL();
> URLClassLoader urlClassLoader= new URLClassLoader(urls, ClassLoader.getSystemClassLoader())		
> DbUtils.loadDriver(urlClassLoader, driver);
> Properties conProps = new Properties(); 
> conProps.put("user", user); 
> conProps.put("password", pwd); 
> conProps.put("defaultRowPrefetch", "20");
> scanedConnection = DriverManager.getConnection(url, conProps);
> {code}
> but by this way (use jdbc's api get connect),it's ok
> {code}
> try {
>     URL jdbcDriverURL = new File("d:\\mysql_connector_5.1.15_bin.jar").toURL();
>     URL[] urls = new URL[1];
>     urls[0] = jdbcDriverURL;
>     URLClassLoader urlclassLoader = new URLClassLoader(urls, ClassLoader.getSystemClassLoader());
>     try {
>         java.sql.Driver driverd = (java.sql.Driver) urlclassLoader.loadClass(driver).newInstance();
>         System.out.println(driverd.toString());
>         Properties props = new Properties();
>         props.setProperty("user", theUser);
>         props.setProperty("password", thePw);
>         try {
>             c = driverd.connect(dbUrl, props);
>         } catch (SQLException e) {
>             // TODO Auto-generated catch block
>             e.printStackTrace();
>         }
>     } catch (InstantiationException e) {
>         // TODO Auto-generated catch block
>         e.printStackTrace();
>     } catch (IllegalAccessException e) {
>         // TODO Auto-generated catch block
>         e.printStackTrace();
>     }
> } catch (MalformedURLException e1) {
>     // TODO Auto-generated catch block
>     e1.printStackTrace();
> }
> {code}
> is this a bug or my useing falut?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Updated] (DBUTILS-96) dynamic load jdbc jars use Dbutils,it say No suitable driver found for jdbc

Posted by "Simone Tripodi (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DBUTILS-96?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Simone Tripodi updated DBUTILS-96:
----------------------------------

    Attachment: DBUTILS-96_v2.patch

A new small patch where added a guard for {{ClassCastException}} to return {{false}} when happens.
Moreover I renamed the {{DriverAdapter}} to {{DriverProxy}}, sounds more reasonable.

{{TODO}}: I am still not able to manage the {{IllegalAccessException}}...
                
> dynamic load jdbc jars use Dbutils,it say  No suitable driver found for jdbc
> ----------------------------------------------------------------------------
>
>                 Key: DBUTILS-96
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-96
>             Project: Commons DbUtils
>          Issue Type: Bug
>         Environment: jdk 1.6
>            Reporter: yuyf
>         Attachments: DBUTILS-96.patch, DBUTILS-96_v2.patch, dbutils-96.tar.gz, dynamicloadjar.zip, mysql.properties
>
>
> By this way(use Dbutil get connect),it will say: {{No suitable driver found for jdbc:mysql://127.0.0.1:3306/xxx}}
> {code}
> urls = new URL[1];
> urls[0] = new File("d:\mysql_connector_5.1.15_bin.jar").toURL();
> URLClassLoader urlClassLoader= new URLClassLoader(urls, ClassLoader.getSystemClassLoader())		
> DbUtils.loadDriver(urlClassLoader, driver);
> Properties conProps = new Properties(); 
> conProps.put("user", user); 
> conProps.put("password", pwd); 
> conProps.put("defaultRowPrefetch", "20");
> scanedConnection = DriverManager.getConnection(url, conProps);
> {code}
> but by this way (use jdbc's api get connect),it's ok
> {code}
> try {
>     URL jdbcDriverURL = new File("d:\\mysql_connector_5.1.15_bin.jar").toURL();
>     URL[] urls = new URL[1];
>     urls[0] = jdbcDriverURL;
>     URLClassLoader urlclassLoader = new URLClassLoader(urls, ClassLoader.getSystemClassLoader());
>     try {
>         java.sql.Driver driverd = (java.sql.Driver) urlclassLoader.loadClass(driver).newInstance();
>         System.out.println(driverd.toString());
>         Properties props = new Properties();
>         props.setProperty("user", theUser);
>         props.setProperty("password", thePw);
>         try {
>             c = driverd.connect(dbUrl, props);
>         } catch (SQLException e) {
>             // TODO Auto-generated catch block
>             e.printStackTrace();
>         }
>     } catch (InstantiationException e) {
>         // TODO Auto-generated catch block
>         e.printStackTrace();
>     } catch (IllegalAccessException e) {
>         // TODO Auto-generated catch block
>         e.printStackTrace();
>     }
> } catch (MalformedURLException e1) {
>     // TODO Auto-generated catch block
>     e1.printStackTrace();
> }
> {code}
> is this a bug or my useing falut?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (DBUTILS-96) dynamic load jdbc jars use Dbutils,it say No suitable driver found for jdbc

Posted by "Simone Tripodi (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DBUTILS-96?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Simone Tripodi updated DBUTILS-96:
----------------------------------

    Description: 
By this way(use Dbutil get connect),it will say: {{No suitable driver found for jdbc:mysql://127.0.0.1:3306/xxx}}

{code}
urls = new URL[1];
urls[0] = new File("d:\mysql_connector_5.1.15_bin.jar").toURL();
URLClassLoader urlClassLoader= new URLClassLoader(urls,ClassLoader.getSystemClassLoader())		
DbUtils.loadDriver(urlClassLoader,driver);

Properties conProps = new Properties(); 
conProps.put("user", user); 
conProps.put("password", pwd); 
conProps.put("defaultRowPrefetch", "20");

scanedConnection = DriverManager.getConnection(url, conProps);
{code}

but by this way (use jdbc's api get connect),it's ok

{code}
try {
    URL jdbcDriverURL = new File("d:\\mysql_connector_5.1.15_bin.jar").toURL();
    URL[] urls = new URL[1];
    urls[0] = jdbcDriverURL;
    URLClassLoader urlclassLoader = new URLClassLoader(urls,ClassLoader.getSystemClassLoader());
    try {
        java.sql.Driver driverd = (java.sql.Driver)             urlclassLoader.loadClass(driver).newInstance();
        System.out.println(driverd.toString());
        Properties props = new Properties();
        props.setProperty("user", theUser);
        props.setProperty("password", thePw);
        try {
            c = driverd.connect(dbUrl, props);
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    } catch (InstantiationException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
} catch (IllegalAccessException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}//

} catch (MalformedURLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
{code}

is this a bug or my useing falut?

  was:
By this way(use Dbutil get connect),it will say:No suitable driver found for jdbc:mysql://127.0.0.1:3306/xxx

urls = new URL[1];
urls[0] = new File("d:\mysql_connector_5.1.15_bin.jar").toURL();
URLClassLoader urlClassLoader= new URLClassLoader(urls,ClassLoader.getSystemClassLoader())		
DbUtils.loadDriver(urlClassLoader,driver);
Properties conProps = new Properties(); 
conProps.put("user", user); 
conProps.put("password", pwd); 
conProps.put("defaultRowPrefetch", "20"); 
scanedConnection = DriverManager.getConnection(url, conProps);


but by this way (use jdbc's api get connect),it's ok

try {
URL jdbcDriverURL = new File("d:\\mysql_connector_5.1.15_bin.jar").toURL();
URL[] urls = new URL[1];
urls[0] = jdbcDriverURL;
URLClassLoader urlclassLoader = new URLClassLoader(urls,ClassLoader.getSystemClassLoader());
try {
java.sql.Driver driverd = (java.sql.Driver) urlclassLoader.loadClass(driver).newInstance();
System.out.println(driverd.toString());
Properties props = new Properties();
props.setProperty("user", theUser);
props.setProperty("password", thePw);
try {
c = driverd.connect(dbUrl, props);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}//

} catch (MalformedURLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}




is this a bug or my useing falut?

    
> dynamic load jdbc jars use Dbutils,it say  No suitable driver found for jdbc
> ----------------------------------------------------------------------------
>
>                 Key: DBUTILS-96
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-96
>             Project: Commons DbUtils
>          Issue Type: Bug
>         Environment: jdk 1.6
>            Reporter: yuyf
>
> By this way(use Dbutil get connect),it will say: {{No suitable driver found for jdbc:mysql://127.0.0.1:3306/xxx}}
> {code}
> urls = new URL[1];
> urls[0] = new File("d:\mysql_connector_5.1.15_bin.jar").toURL();
> URLClassLoader urlClassLoader= new URLClassLoader(urls,ClassLoader.getSystemClassLoader())		
> DbUtils.loadDriver(urlClassLoader,driver);
> Properties conProps = new Properties(); 
> conProps.put("user", user); 
> conProps.put("password", pwd); 
> conProps.put("defaultRowPrefetch", "20");
> scanedConnection = DriverManager.getConnection(url, conProps);
> {code}
> but by this way (use jdbc's api get connect),it's ok
> {code}
> try {
>     URL jdbcDriverURL = new File("d:\\mysql_connector_5.1.15_bin.jar").toURL();
>     URL[] urls = new URL[1];
>     urls[0] = jdbcDriverURL;
>     URLClassLoader urlclassLoader = new URLClassLoader(urls,ClassLoader.getSystemClassLoader());
>     try {
>         java.sql.Driver driverd = (java.sql.Driver)             urlclassLoader.loadClass(driver).newInstance();
>         System.out.println(driverd.toString());
>         Properties props = new Properties();
>         props.setProperty("user", theUser);
>         props.setProperty("password", thePw);
>         try {
>             c = driverd.connect(dbUrl, props);
>         } catch (SQLException e) {
>             // TODO Auto-generated catch block
>             e.printStackTrace();
>         }
>     } catch (InstantiationException e) {
>         // TODO Auto-generated catch block
>         e.printStackTrace();
> } catch (IllegalAccessException e) {
>     // TODO Auto-generated catch block
>     e.printStackTrace();
> }//
> } catch (MalformedURLException e1) {
> // TODO Auto-generated catch block
> e1.printStackTrace();
> }
> {code}
> is this a bug or my useing falut?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Comment Edited] (DBUTILS-96) dynamic load jdbc jars use Dbutils,it say No suitable driver found for jdbc

Posted by "yuyf (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DBUTILS-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13423112#comment-13423112 ] 

yuyf edited comment on DBUTILS-96 at 7/26/12 2:40 PM:
------------------------------------------------------

I'm sorry for d:\mysql_connector_5.1.15_bin.jar。In my real program,there are all "d:\\\mysql...jar",so it is not this reason.
                
      was (Author: yyflyons):
    I'm sorry for d:\mysql_connector_5.1.15_bin.jar。In my real program,there are all "d:\\\\mysql...jar",so it is not this reason.
                  
> dynamic load jdbc jars use Dbutils,it say  No suitable driver found for jdbc
> ----------------------------------------------------------------------------
>
>                 Key: DBUTILS-96
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-96
>             Project: Commons DbUtils
>          Issue Type: Bug
>         Environment: jdk 1.6
>            Reporter: yuyf
>
> By this way(use Dbutil get connect),it will say:No suitable driver found for jdbc:mysql://127.0.0.1:3306/xxx
> urls = new URL[1];
> urls[0] = new File("d:\mysql_connector_5.1.15_bin.jar").toURL();
> URLClassLoader urlClassLoader= new URLClassLoader(urls,ClassLoader.getSystemClassLoader())		
> DbUtils.loadDriver(urlClassLoader,driver);
> Properties conProps = new Properties(); 
> conProps.put("user", user); 
> conProps.put("password", pwd); 
> conProps.put("defaultRowPrefetch", "20"); 
> scanedConnection = DriverManager.getConnection(url, conProps);
> but by this way (use jdbc's api get connect),it's ok
> try {
> URL jdbcDriverURL = new File("d:\\mysql_connector_5.1.15_bin.jar").toURL();
> URL[] urls = new URL[1];
> urls[0] = jdbcDriverURL;
> URLClassLoader urlclassLoader = new URLClassLoader(urls,ClassLoader.getSystemClassLoader());
> try {
> java.sql.Driver driverd = (java.sql.Driver) urlclassLoader.loadClass(driver).newInstance();
> System.out.println(driverd.toString());
> Properties props = new Properties();
> props.setProperty("user", theUser);
> props.setProperty("password", thePw);
> try {
> c = driverd.connect(dbUrl, props);
> } catch (SQLException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
> } catch (InstantiationException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> } catch (IllegalAccessException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }//
> } catch (MalformedURLException e1) {
> // TODO Auto-generated catch block
> e1.printStackTrace();
> }
> is this a bug or my useing falut?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (DBUTILS-96) dynamic load jdbc jars use Dbutils,it say No suitable driver found for jdbc

Posted by "Simone Tripodi (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DBUTILS-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13427930#comment-13427930 ] 

Simone Tripodi commented on DBUTILS-96:
---------------------------------------

We will make it available on DbUtils ASAP, making it completely transparent to users :)
                
> dynamic load jdbc jars use Dbutils,it say  No suitable driver found for jdbc
> ----------------------------------------------------------------------------
>
>                 Key: DBUTILS-96
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-96
>             Project: Commons DbUtils
>          Issue Type: Bug
>         Environment: jdk 1.6
>            Reporter: yuyf
>         Attachments: DBUTILS-96.patch, dbutils-96.tar.gz, dynamicloadjar.zip, mysql.properties
>
>
> By this way(use Dbutil get connect),it will say: {{No suitable driver found for jdbc:mysql://127.0.0.1:3306/xxx}}
> {code}
> urls = new URL[1];
> urls[0] = new File("d:\mysql_connector_5.1.15_bin.jar").toURL();
> URLClassLoader urlClassLoader= new URLClassLoader(urls, ClassLoader.getSystemClassLoader())		
> DbUtils.loadDriver(urlClassLoader, driver);
> Properties conProps = new Properties(); 
> conProps.put("user", user); 
> conProps.put("password", pwd); 
> conProps.put("defaultRowPrefetch", "20");
> scanedConnection = DriverManager.getConnection(url, conProps);
> {code}
> but by this way (use jdbc's api get connect),it's ok
> {code}
> try {
>     URL jdbcDriverURL = new File("d:\\mysql_connector_5.1.15_bin.jar").toURL();
>     URL[] urls = new URL[1];
>     urls[0] = jdbcDriverURL;
>     URLClassLoader urlclassLoader = new URLClassLoader(urls, ClassLoader.getSystemClassLoader());
>     try {
>         java.sql.Driver driverd = (java.sql.Driver) urlclassLoader.loadClass(driver).newInstance();
>         System.out.println(driverd.toString());
>         Properties props = new Properties();
>         props.setProperty("user", theUser);
>         props.setProperty("password", thePw);
>         try {
>             c = driverd.connect(dbUrl, props);
>         } catch (SQLException e) {
>             // TODO Auto-generated catch block
>             e.printStackTrace();
>         }
>     } catch (InstantiationException e) {
>         // TODO Auto-generated catch block
>         e.printStackTrace();
>     } catch (IllegalAccessException e) {
>         // TODO Auto-generated catch block
>         e.printStackTrace();
>     }
> } catch (MalformedURLException e1) {
>     // TODO Auto-generated catch block
>     e1.printStackTrace();
> }
> {code}
> is this a bug or my useing falut?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (DBUTILS-96) DbUtils#loadDriver(ClassLoader,String) makes DriverManager throwing "No suitable driver found for jdbc" if ClassLoader is not the System's one

Posted by "Simone Tripodi (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DBUTILS-96?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Simone Tripodi updated DBUTILS-96:
----------------------------------

    Summary: DbUtils#loadDriver(ClassLoader,String) makes DriverManager throwing "No suitable driver found for jdbc" if ClassLoader is not the System's one  (was: dynamic load jdbc jars use Dbutils,it say  No suitable driver found for jdbc)
    
> DbUtils#loadDriver(ClassLoader,String) makes DriverManager throwing "No suitable driver found for jdbc" if ClassLoader is not the System's one
> ----------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DBUTILS-96
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-96
>             Project: Commons DbUtils
>          Issue Type: Bug
>         Environment: jdk 1.6
>            Reporter: yuyf
>            Assignee: Simone Tripodi
>         Attachments: DBUTILS-96.patch, DBUTILS-96_v2.patch, DBUTILS-96_v3.patch, dbutils-96.tar.gz, dynamicloadjar.zip, mysql.properties
>
>
> By this way(use Dbutil get connect),it will say: {{No suitable driver found for jdbc:mysql://127.0.0.1:3306/xxx}}
> {code}
> urls = new URL[1];
> urls[0] = new File("d:\mysql_connector_5.1.15_bin.jar").toURL();
> URLClassLoader urlClassLoader= new URLClassLoader(urls, ClassLoader.getSystemClassLoader())		
> DbUtils.loadDriver(urlClassLoader, driver);
> Properties conProps = new Properties(); 
> conProps.put("user", user); 
> conProps.put("password", pwd); 
> conProps.put("defaultRowPrefetch", "20");
> scanedConnection = DriverManager.getConnection(url, conProps);
> {code}
> but by this way (use jdbc's api get connect),it's ok
> {code}
> try {
>     URL jdbcDriverURL = new File("d:\\mysql_connector_5.1.15_bin.jar").toURL();
>     URL[] urls = new URL[1];
>     urls[0] = jdbcDriverURL;
>     URLClassLoader urlclassLoader = new URLClassLoader(urls, ClassLoader.getSystemClassLoader());
>     try {
>         java.sql.Driver driverd = (java.sql.Driver) urlclassLoader.loadClass(driver).newInstance();
>         System.out.println(driverd.toString());
>         Properties props = new Properties();
>         props.setProperty("user", theUser);
>         props.setProperty("password", thePw);
>         try {
>             c = driverd.connect(dbUrl, props);
>         } catch (SQLException e) {
>             // TODO Auto-generated catch block
>             e.printStackTrace();
>         }
>     } catch (InstantiationException e) {
>         // TODO Auto-generated catch block
>         e.printStackTrace();
>     } catch (IllegalAccessException e) {
>         // TODO Auto-generated catch block
>         e.printStackTrace();
>     }
> } catch (MalformedURLException e1) {
>     // TODO Auto-generated catch block
>     e1.printStackTrace();
> }
> {code}
> is this a bug or my useing falut?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (DBUTILS-96) dynamic load jdbc jars use Dbutils,it say No suitable driver found for jdbc

Posted by "yuyf (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DBUTILS-96?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

yuyf updated DBUTILS-96:
------------------------

    Description: 
By this way(use Dbutil get connect),it will say:No suitable driver found for jdbc:mysql://127.0.0.1:3306/xxx

urls = new URL[1];
urls[0] = new File("d:\\mysql_connector_5.1.15_bin.jar").toURL();
URLClassLoader urlClassLoader= new URLClassLoader(urls,ClassLoader.getSystemClassLoader())		
DbUtils.loadDriver(urlClassLoader,driver);
Properties conProps = new Properties(); 
conProps.put("user", user); 
conProps.put("password", pwd); 
conProps.put("defaultRowPrefetch", "20"); 
scanedConnection = DriverManager.getConnection(url, conProps);


but by this way (use jdbc's api get connect),it's ok

try {
URL jdbcDriverURL = new File("d:\\mysql_connector_5.1.15_bin.jar").toURL();
URL[] urls = new URL[1];
urls[0] = jdbcDriverURL;
URLClassLoader urlclassLoader = new URLClassLoader(urls,ClassLoader.getSystemClassLoader());
try {
java.sql.Driver driverd = (java.sql.Driver) urlclassLoader.loadClass(driver).newInstance();
System.out.println(driverd.toString());
Properties props = new Properties();
props.setProperty("user", theUser);
props.setProperty("password", thePw);
try {
c = driverd.connect(dbUrl, props);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}//

} catch (MalformedURLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}




is this a bug or my useing falut?

  was:
By this way(use Dbutil get connect),it will say:No suitable driver found for jdbc:mysql://127.0.0.1:3306/xxx

urls = new URL[1];
urls[0] = new File("d:\\mysql_connector_5.1.15_bin.jar").toURL();		
DbUtils.loadDriver(urlClassLoader,driver);
Properties conProps = new Properties(); 
conProps.put("user", user); 
conProps.put("password", pwd); 
conProps.put("defaultRowPrefetch", "20"); 
scanedConnection = DriverManager.getConnection(url, conProps);


but by this way (use jdbc's api get connect),it's ok

try {
URL jdbcDriverURL = new File("d:\\mysql_connector_5.1.15_bin.jar").toURL();
URL[] urls = new URL[1];
urls[0] = jdbcDriverURL;
URLClassLoader urlclassLoader = new URLClassLoader(urls,ClassLoader.getSystemClassLoader());
try {
java.sql.Driver driverd = (java.sql.Driver) urlclassLoader.loadClass(driver).newInstance();
System.out.println(driverd.toString());
Properties props = new Properties();
props.setProperty("user", theUser);
props.setProperty("password", thePw);
try {
c = driverd.connect(dbUrl, props);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}//

} catch (MalformedURLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}




is this a bug or my useing falut?

    
> dynamic load jdbc jars use Dbutils,it say  No suitable driver found for jdbc
> ----------------------------------------------------------------------------
>
>                 Key: DBUTILS-96
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-96
>             Project: Commons DbUtils
>          Issue Type: Bug
>         Environment: jdk 1.6
>            Reporter: yuyf
>
> By this way(use Dbutil get connect),it will say:No suitable driver found for jdbc:mysql://127.0.0.1:3306/xxx
> urls = new URL[1];
> urls[0] = new File("d:\\mysql_connector_5.1.15_bin.jar").toURL();
> URLClassLoader urlClassLoader= new URLClassLoader(urls,ClassLoader.getSystemClassLoader())		
> DbUtils.loadDriver(urlClassLoader,driver);
> Properties conProps = new Properties(); 
> conProps.put("user", user); 
> conProps.put("password", pwd); 
> conProps.put("defaultRowPrefetch", "20"); 
> scanedConnection = DriverManager.getConnection(url, conProps);
> but by this way (use jdbc's api get connect),it's ok
> try {
> URL jdbcDriverURL = new File("d:\\mysql_connector_5.1.15_bin.jar").toURL();
> URL[] urls = new URL[1];
> urls[0] = jdbcDriverURL;
> URLClassLoader urlclassLoader = new URLClassLoader(urls,ClassLoader.getSystemClassLoader());
> try {
> java.sql.Driver driverd = (java.sql.Driver) urlclassLoader.loadClass(driver).newInstance();
> System.out.println(driverd.toString());
> Properties props = new Properties();
> props.setProperty("user", theUser);
> props.setProperty("password", thePw);
> try {
> c = driverd.connect(dbUrl, props);
> } catch (SQLException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
> } catch (InstantiationException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> } catch (IllegalAccessException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }//
> } catch (MalformedURLException e1) {
> // TODO Auto-generated catch block
> e1.printStackTrace();
> }
> is this a bug or my useing falut?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (DBUTILS-96) dynamic load jdbc jars use Dbutils,it say No suitable driver found for jdbc

Posted by "yuyf (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DBUTILS-96?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

yuyf updated DBUTILS-96:
------------------------

    Description: 
By this way(use Dbutil get connect),it will say:No suitable driver found for jdbc:mysql://127.0.0.1:3306/xxx

urls = new URL[1];
urls[0] = new File("d:\mysql_connector_5.1.15_bin.jar").toURL();
URLClassLoader urlClassLoader= new URLClassLoader(urls,ClassLoader.getSystemClassLoader())		
DbUtils.loadDriver(urlClassLoader,driver);
Properties conProps = new Properties(); 
conProps.put("user", user); 
conProps.put("password", pwd); 
conProps.put("defaultRowPrefetch", "20"); 
scanedConnection = DriverManager.getConnection(url, conProps);


but by this way (use jdbc's api get connect),it's ok

try {
URL jdbcDriverURL = new File("d:\\mysql_connector_5.1.15_bin.jar").toURL();
URL[] urls = new URL[1];
urls[0] = jdbcDriverURL;
URLClassLoader urlclassLoader = new URLClassLoader(urls,ClassLoader.getSystemClassLoader());
try {
java.sql.Driver driverd = (java.sql.Driver) urlclassLoader.loadClass(driver).newInstance();
System.out.println(driverd.toString());
Properties props = new Properties();
props.setProperty("user", theUser);
props.setProperty("password", thePw);
try {
c = driverd.connect(dbUrl, props);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}//

} catch (MalformedURLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}




is this a bug or my useing falut?

  was:
By this way(use Dbutil get connect),it will say:No suitable driver found for jdbc:mysql://127.0.0.1:3306/xxx

urls = new URL[1];
urls[0] = new File("d:\\mysql_connector_5.1.15_bin.jar").toURL();
URLClassLoader urlClassLoader= new URLClassLoader(urls,ClassLoader.getSystemClassLoader())		
DbUtils.loadDriver(urlClassLoader,driver);
Properties conProps = new Properties(); 
conProps.put("user", user); 
conProps.put("password", pwd); 
conProps.put("defaultRowPrefetch", "20"); 
scanedConnection = DriverManager.getConnection(url, conProps);


but by this way (use jdbc's api get connect),it's ok

try {
URL jdbcDriverURL = new File("d:\\mysql_connector_5.1.15_bin.jar").toURL();
URL[] urls = new URL[1];
urls[0] = jdbcDriverURL;
URLClassLoader urlclassLoader = new URLClassLoader(urls,ClassLoader.getSystemClassLoader());
try {
java.sql.Driver driverd = (java.sql.Driver) urlclassLoader.loadClass(driver).newInstance();
System.out.println(driverd.toString());
Properties props = new Properties();
props.setProperty("user", theUser);
props.setProperty("password", thePw);
try {
c = driverd.connect(dbUrl, props);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}//

} catch (MalformedURLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}




is this a bug or my useing falut?

    
> dynamic load jdbc jars use Dbutils,it say  No suitable driver found for jdbc
> ----------------------------------------------------------------------------
>
>                 Key: DBUTILS-96
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-96
>             Project: Commons DbUtils
>          Issue Type: Bug
>         Environment: jdk 1.6
>            Reporter: yuyf
>
> By this way(use Dbutil get connect),it will say:No suitable driver found for jdbc:mysql://127.0.0.1:3306/xxx
> urls = new URL[1];
> urls[0] = new File("d:\mysql_connector_5.1.15_bin.jar").toURL();
> URLClassLoader urlClassLoader= new URLClassLoader(urls,ClassLoader.getSystemClassLoader())		
> DbUtils.loadDriver(urlClassLoader,driver);
> Properties conProps = new Properties(); 
> conProps.put("user", user); 
> conProps.put("password", pwd); 
> conProps.put("defaultRowPrefetch", "20"); 
> scanedConnection = DriverManager.getConnection(url, conProps);
> but by this way (use jdbc's api get connect),it's ok
> try {
> URL jdbcDriverURL = new File("d:\\mysql_connector_5.1.15_bin.jar").toURL();
> URL[] urls = new URL[1];
> urls[0] = jdbcDriverURL;
> URLClassLoader urlclassLoader = new URLClassLoader(urls,ClassLoader.getSystemClassLoader());
> try {
> java.sql.Driver driverd = (java.sql.Driver) urlclassLoader.loadClass(driver).newInstance();
> System.out.println(driverd.toString());
> Properties props = new Properties();
> props.setProperty("user", theUser);
> props.setProperty("password", thePw);
> try {
> c = driverd.connect(dbUrl, props);
> } catch (SQLException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
> } catch (InstantiationException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> } catch (IllegalAccessException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }//
> } catch (MalformedURLException e1) {
> // TODO Auto-generated catch block
> e1.printStackTrace();
> }
> is this a bug or my useing falut?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (DBUTILS-96) dynamic load jdbc jars use Dbutils,it say No suitable driver found for jdbc

Posted by "yuyf (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DBUTILS-96?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

yuyf updated DBUTILS-96:
------------------------

    Summary: dynamic load jdbc jars use Dbutils,it say  No suitable driver found for jdbc  (was:  No suitable driver found for jdbc)
    
> dynamic load jdbc jars use Dbutils,it say  No suitable driver found for jdbc
> ----------------------------------------------------------------------------
>
>                 Key: DBUTILS-96
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-96
>             Project: Commons DbUtils
>          Issue Type: Bug
>         Environment: jdk 1.6
>            Reporter: yuyf
>
> By this way(use Dbutil get connect),it will say:No suitable driver found for jdbc:mysql://127.0.0.1:3306/xxx
> urls = new URL[1];
> urls[0] = new File("d:\\mysql_connector_5.1.15_bin.jar").toURL();		
> DbUtils.loadDriver(urlClassLoader,driver);
> Properties conProps = new Properties(); 
> conProps.put("user", user); 
> conProps.put("password", pwd); 
> conProps.put("defaultRowPrefetch", "20"); 
> scanedConnection = DriverManager.getConnection(url, conProps);
> but by this way (use jdbc's api get connect),it's ok
> try {
> URL jdbcDriverURL = new File("d:\\mysql_connector_5.1.15_bin.jar").toURL();
> URL[] urls = new URL[1];
> urls[0] = jdbcDriverURL;
> URLClassLoader urlclassLoader = new URLClassLoader(urls,ClassLoader.getSystemClassLoader());
> try {
> java.sql.Driver driverd = (java.sql.Driver) urlclassLoader.loadClass(driver).newInstance();
> System.out.println(driverd.toString());
> Properties props = new Properties();
> props.setProperty("user", theUser);
> props.setProperty("password", thePw);
> try {
> c = driverd.connect(dbUrl, props);
> } catch (SQLException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
> } catch (InstantiationException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> } catch (IllegalAccessException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }//
> } catch (MalformedURLException e1) {
> // TODO Auto-generated catch block
> e1.printStackTrace();
> }
> is this a bug or my useing falut?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (DBUTILS-96) DbUtils#loadDriver(ClassLoader,String) makes DriverManager throwing "No suitable driver found for jdbc" if ClassLoader is not the System's one

Posted by "Simone Tripodi (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DBUTILS-96?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Simone Tripodi resolved DBUTILS-96.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 1.6

Patch applied, see r1369963

Thanks Bill for your feedback!
                
> DbUtils#loadDriver(ClassLoader,String) makes DriverManager throwing "No suitable driver found for jdbc" if ClassLoader is not the System's one
> ----------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DBUTILS-96
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-96
>             Project: Commons DbUtils
>          Issue Type: Bug
>         Environment: jdk 1.6
>            Reporter: yuyf
>            Assignee: Simone Tripodi
>             Fix For: 1.6
>
>         Attachments: DBUTILS-96.patch, DBUTILS-96_v2.patch, DBUTILS-96_v3.patch, dbutils-96.tar.gz, dynamicloadjar.zip, mysql.properties
>
>
> By this way(use Dbutil get connect),it will say: {{No suitable driver found for jdbc:mysql://127.0.0.1:3306/xxx}}
> {code}
> urls = new URL[1];
> urls[0] = new File("d:\mysql_connector_5.1.15_bin.jar").toURL();
> URLClassLoader urlClassLoader= new URLClassLoader(urls, ClassLoader.getSystemClassLoader())		
> DbUtils.loadDriver(urlClassLoader, driver);
> Properties conProps = new Properties(); 
> conProps.put("user", user); 
> conProps.put("password", pwd); 
> conProps.put("defaultRowPrefetch", "20");
> scanedConnection = DriverManager.getConnection(url, conProps);
> {code}
> but by this way (use jdbc's api get connect),it's ok
> {code}
> try {
>     URL jdbcDriverURL = new File("d:\\mysql_connector_5.1.15_bin.jar").toURL();
>     URL[] urls = new URL[1];
>     urls[0] = jdbcDriverURL;
>     URLClassLoader urlclassLoader = new URLClassLoader(urls, ClassLoader.getSystemClassLoader());
>     try {
>         java.sql.Driver driverd = (java.sql.Driver) urlclassLoader.loadClass(driver).newInstance();
>         System.out.println(driverd.toString());
>         Properties props = new Properties();
>         props.setProperty("user", theUser);
>         props.setProperty("password", thePw);
>         try {
>             c = driverd.connect(dbUrl, props);
>         } catch (SQLException e) {
>             // TODO Auto-generated catch block
>             e.printStackTrace();
>         }
>     } catch (InstantiationException e) {
>         // TODO Auto-generated catch block
>         e.printStackTrace();
>     } catch (IllegalAccessException e) {
>         // TODO Auto-generated catch block
>         e.printStackTrace();
>     }
> } catch (MalformedURLException e1) {
>     // TODO Auto-generated catch block
>     e1.printStackTrace();
> }
> {code}
> is this a bug or my useing falut?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (DBUTILS-96) dynamic load jdbc jars use Dbutils,it say No suitable driver found for jdbc

Posted by "Simone Tripodi (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DBUTILS-96?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Simone Tripodi updated DBUTILS-96:
----------------------------------

    Description: 
By this way(use Dbutil get connect),it will say: {{No suitable driver found for jdbc:mysql://127.0.0.1:3306/xxx}}

{code}
urls = new URL[1];
urls[0] = new File("d:\mysql_connector_5.1.15_bin.jar").toURL();
URLClassLoader urlClassLoader= new URLClassLoader(urls, ClassLoader.getSystemClassLoader())		
DbUtils.loadDriver(urlClassLoader, driver);

Properties conProps = new Properties(); 
conProps.put("user", user); 
conProps.put("password", pwd); 
conProps.put("defaultRowPrefetch", "20");

scanedConnection = DriverManager.getConnection(url, conProps);
{code}

but by this way (use jdbc's api get connect),it's ok

{code}
try {
    URL jdbcDriverURL = new File("d:\\mysql_connector_5.1.15_bin.jar").toURL();
    URL[] urls = new URL[1];
    urls[0] = jdbcDriverURL;
    URLClassLoader urlclassLoader = new URLClassLoader(urls, ClassLoader.getSystemClassLoader());
    try {
        java.sql.Driver driverd = (java.sql.Driver) urlclassLoader.loadClass(driver).newInstance();
        System.out.println(driverd.toString());
        Properties props = new Properties();
        props.setProperty("user", theUser);
        props.setProperty("password", thePw);
        try {
            c = driverd.connect(dbUrl, props);
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    } catch (InstantiationException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
} catch (IllegalAccessException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}//

} catch (MalformedURLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
{code}

is this a bug or my useing falut?

  was:
By this way(use Dbutil get connect),it will say: {{No suitable driver found for jdbc:mysql://127.0.0.1:3306/xxx}}

{code}
urls = new URL[1];
urls[0] = new File("d:\mysql_connector_5.1.15_bin.jar").toURL();
URLClassLoader urlClassLoader= new URLClassLoader(urls,ClassLoader.getSystemClassLoader())		
DbUtils.loadDriver(urlClassLoader, driver);

Properties conProps = new Properties(); 
conProps.put("user", user); 
conProps.put("password", pwd); 
conProps.put("defaultRowPrefetch", "20");

scanedConnection = DriverManager.getConnection(url, conProps);
{code}

but by this way (use jdbc's api get connect),it's ok

{code}
try {
    URL jdbcDriverURL = new File("d:\\mysql_connector_5.1.15_bin.jar").toURL();
    URL[] urls = new URL[1];
    urls[0] = jdbcDriverURL;
    URLClassLoader urlclassLoader = new URLClassLoader(urls, ClassLoader.getSystemClassLoader());
    try {
        java.sql.Driver driverd = (java.sql.Driver) urlclassLoader.loadClass(driver).newInstance();
        System.out.println(driverd.toString());
        Properties props = new Properties();
        props.setProperty("user", theUser);
        props.setProperty("password", thePw);
        try {
            c = driverd.connect(dbUrl, props);
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    } catch (InstantiationException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
} catch (IllegalAccessException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}//

} catch (MalformedURLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
{code}

is this a bug or my useing falut?

    
> dynamic load jdbc jars use Dbutils,it say  No suitable driver found for jdbc
> ----------------------------------------------------------------------------
>
>                 Key: DBUTILS-96
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-96
>             Project: Commons DbUtils
>          Issue Type: Bug
>         Environment: jdk 1.6
>            Reporter: yuyf
>
> By this way(use Dbutil get connect),it will say: {{No suitable driver found for jdbc:mysql://127.0.0.1:3306/xxx}}
> {code}
> urls = new URL[1];
> urls[0] = new File("d:\mysql_connector_5.1.15_bin.jar").toURL();
> URLClassLoader urlClassLoader= new URLClassLoader(urls, ClassLoader.getSystemClassLoader())		
> DbUtils.loadDriver(urlClassLoader, driver);
> Properties conProps = new Properties(); 
> conProps.put("user", user); 
> conProps.put("password", pwd); 
> conProps.put("defaultRowPrefetch", "20");
> scanedConnection = DriverManager.getConnection(url, conProps);
> {code}
> but by this way (use jdbc's api get connect),it's ok
> {code}
> try {
>     URL jdbcDriverURL = new File("d:\\mysql_connector_5.1.15_bin.jar").toURL();
>     URL[] urls = new URL[1];
>     urls[0] = jdbcDriverURL;
>     URLClassLoader urlclassLoader = new URLClassLoader(urls, ClassLoader.getSystemClassLoader());
>     try {
>         java.sql.Driver driverd = (java.sql.Driver) urlclassLoader.loadClass(driver).newInstance();
>         System.out.println(driverd.toString());
>         Properties props = new Properties();
>         props.setProperty("user", theUser);
>         props.setProperty("password", thePw);
>         try {
>             c = driverd.connect(dbUrl, props);
>         } catch (SQLException e) {
>             // TODO Auto-generated catch block
>             e.printStackTrace();
>         }
>     } catch (InstantiationException e) {
>         // TODO Auto-generated catch block
>         e.printStackTrace();
> } catch (IllegalAccessException e) {
>     // TODO Auto-generated catch block
>     e.printStackTrace();
> }//
> } catch (MalformedURLException e1) {
> // TODO Auto-generated catch block
> e1.printStackTrace();
> }
> {code}
> is this a bug or my useing falut?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (DBUTILS-96) dynamic load jdbc jars use Dbutils,it say No suitable driver found for jdbc

Posted by "Simone Tripodi (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DBUTILS-96?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Simone Tripodi updated DBUTILS-96:
----------------------------------

    Attachment: dbutils-96.tar.gz
                DBUTILS-96.patch

The DBUTILS-96.patch provides the required work around to fix the issue.

Once applied in your local copy of {{commons-dbutils}} (and installed in your local mvn repo), you can run the attached test to verify that the method {{DbUtils#loadDriver(ClassLoader, String)}} also registers the adapter in the DriverManager.

I am in trouble when {{IllegalAccessException}} exception happens... any suggestion?

TIA!
                
> dynamic load jdbc jars use Dbutils,it say  No suitable driver found for jdbc
> ----------------------------------------------------------------------------
>
>                 Key: DBUTILS-96
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-96
>             Project: Commons DbUtils
>          Issue Type: Bug
>         Environment: jdk 1.6
>            Reporter: yuyf
>         Attachments: DBUTILS-96.patch, dbutils-96.tar.gz, dynamicloadjar.zip, mysql.properties
>
>
> By this way(use Dbutil get connect),it will say: {{No suitable driver found for jdbc:mysql://127.0.0.1:3306/xxx}}
> {code}
> urls = new URL[1];
> urls[0] = new File("d:\mysql_connector_5.1.15_bin.jar").toURL();
> URLClassLoader urlClassLoader= new URLClassLoader(urls, ClassLoader.getSystemClassLoader())		
> DbUtils.loadDriver(urlClassLoader, driver);
> Properties conProps = new Properties(); 
> conProps.put("user", user); 
> conProps.put("password", pwd); 
> conProps.put("defaultRowPrefetch", "20");
> scanedConnection = DriverManager.getConnection(url, conProps);
> {code}
> but by this way (use jdbc's api get connect),it's ok
> {code}
> try {
>     URL jdbcDriverURL = new File("d:\\mysql_connector_5.1.15_bin.jar").toURL();
>     URL[] urls = new URL[1];
>     urls[0] = jdbcDriverURL;
>     URLClassLoader urlclassLoader = new URLClassLoader(urls, ClassLoader.getSystemClassLoader());
>     try {
>         java.sql.Driver driverd = (java.sql.Driver) urlclassLoader.loadClass(driver).newInstance();
>         System.out.println(driverd.toString());
>         Properties props = new Properties();
>         props.setProperty("user", theUser);
>         props.setProperty("password", thePw);
>         try {
>             c = driverd.connect(dbUrl, props);
>         } catch (SQLException e) {
>             // TODO Auto-generated catch block
>             e.printStackTrace();
>         }
>     } catch (InstantiationException e) {
>         // TODO Auto-generated catch block
>         e.printStackTrace();
>     } catch (IllegalAccessException e) {
>         // TODO Auto-generated catch block
>         e.printStackTrace();
>     }
> } catch (MalformedURLException e1) {
>     // TODO Auto-generated catch block
>     e1.printStackTrace();
> }
> {code}
> is this a bug or my useing falut?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira