Note that there are some explanatory texts on larger screens.

plurals
  1. POcannot load jdbc driver (ClassNotFoundException)
    primarykey
    data
    text
    <p>I'm trying to load the JDBC driver to make some SQL calls to my AS400. I've tried running the connection on a computer which has JDBC installed on it and the URL and SQL calls work fine.</p> <p>I need to develop an app (currently for Android, though we're looking to expand to desktop application) which doesn't have the drivers installed. I am testing the code on an actual android device, not the emulator, so it has full internet permissions.</p> <p>jt400 has drivers located in com.ibm.as400.access.AS400JDBCDriver as <a href="http://publib.boulder.ibm.com/pubs/html/as400/v4r4/ic2924/info/java/rzahh/toolbox.htm" rel="nofollow">noted by IBM</a>.</p> <p>This is my code:</p> <pre class="lang-java prettyprint-override"><code> try { Class.forName("com.ibm.as400.access.AS400JDBCDriver").newInstance(); Connection conn = DriverManager.getConnection( url + schema + ";naming=sql;errors=full", uname, psswrd); // do SQL query stuff rs.close(); stmt.close(); conn.close(); } catch (ClassNotFoundException e) { this.basicOutput.setText("Class not found: " + e.getMessage()); System.out.println(e.getStackTrace()); } //catch (SQLException e) catch (Exception e) //need generic to catch all errors thrown { this.basicOutput.setText(e.getMessage()); System.out.println(e.getStackTrace()); } </code></pre> <p>I get a "Class not found: com.ibm.as400.access.AS400JDBCDriver" when I run this.</p> <p>I've done some research and it suggests that Class.forName isn't a good way to go. So I tried this as well:</p> <pre class="lang-java prettyprint-override"><code> DriverManager.registerDriver(new com.ibm.as400.access.AS400JDBCDriver()); </code></pre> <p>But this also yields the same error.</p> <p>The class is there. The compiled code doesn't throw any syntax errors, but for some reason, runtime can't find it.</p> <p>What am I missing?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload