<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="https://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Could not find file
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="https://community.jboss.org/people/mp_108">m p</a> in <i>Datasource Configuration</i> - <a href="https://community.jboss.org/message/820693#820693">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>Background: </p><p>I am developing in Eclipse and using Struts 2 framework to build and deploy .war file to <a class="jive-link-external-small" href="http://www.coderanch.com/forums/f-63/JBoss" rel="nofollow" target="_new">JBoss</a>. 4.2.3GA</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>There is an action class that I am using to insert a user into a database table - pretty simple stuff <a href="http://cache-www.coderanch.com/images/smilies/3b63d1616c5dfcf29f8a7a031aaa7cad.gif"><span> http://cache-www.coderanch.com/images/smilies/3b63d1616c5dfcf29f8a7a031aaa7cad.gif </span></a> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I get the following exception for executeUpdate() method. </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="font-family: courier new,courier;">DEBUG com.opensymphony.xwork2.DefaultActionInvocation.debug:68 - Executing action method = execute </span></p><p><span style="font-family: courier new,courier;"><span>[STDOUT] &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;insert into catNav.USERS values('mm', 'pp', 88, </span><a class="jive-link-email-small" href="mailto:'mm.pp@yahoo.com" rel="nofollow" target="_blank">'mm.pp@yahoo.com</a><span>'); </span></span></p><p><span style="font-family: courier new,courier;">[STDOUT] <a class="jive-link-external-small" href="http://docs.oracle.com/javase/7/docs/api/java/sql/SQLException.html" rel="nofollow" target="_new">java.sql.SQLException</a>: [Microsoft][ODBC Microsoft Access Driver] Could not find file <span style="color: #ff0000;"><strong>'C:\java\jboss-4.2.3.GA\bin\catNav.mdb'</strong>.</span> </span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><strong>I am provide the full path to the database .mdb file but the exception is referring to file in jboss folder, which is does no exist.&#160; I am struggling to find a solution to resolve this.&#160; </strong>The path, using either \\ or / file separators is validated as an exception occurs if invalid path is defined.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>The code is below; I have the same code in a standalone Java program that executes successfully (I verify row was added)&#160; .... <span style="color: #ff0000;"><strong>but fails when running on JBoss</strong></span> <span> :( </span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="font-family: courier new,courier;"> public String execute() throws Exception {</span><br/><span style="font-family: courier new,courier;">&#160;&#160; </span><br/><span style="font-family: courier new,courier;">&#160; //call Service class to store personBean's state in database</span><br/><span style="font-family: courier new,courier;">&#160; final String dbName = "catNav";</span></p><p><span style="font-family: courier new,courier;">&#160; Connection con = null; // The connection to the database.</span><br/><span style="font-family: courier new,courier;">&#160; </span><br/><span style="font-family: courier new,courier;">&#160; Statement stmt = null;</span><br/><span style="font-family: courier new,courier;">&#160; </span><br/><span style="font-family: courier new,courier;">&#160; // The following code can throw errors, so they must be caught.</span><br/><span style="font-family: courier new,courier;">&#160; try{</span></p><p><span style="font-family: courier new,courier;">&#160;&#160; // First, tell Java what driver to use and where to find it.</span><br/><span style="font-family: courier new,courier;">&#160;&#160; Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");</span></p><p><span style="font-family: courier new,courier;">&#160;&#160; </span><br/><span style="font-family: courier new,courier;">&#160;&#160; // Next, create a connection to your data source.</span><br/><span style="font-family: courier new,courier;">&#160;&#160; // Specify that you are using the ODBC-JDBC Bridge.</span><br/><span style="font-family: courier new,courier;">&#160;&#160; // And specify the data source name from ODBC.</span><br/><span style="font-family: courier new,courier;">&#160;&#160; String database = </span><br/><span style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=C:/Users/mp/Documents/Work/JDBC/catNav.mdb;";</span><br/><span style="font-family: courier new,courier;">&#160;&#160; </span><br/><span style="font-family: courier new,courier;">&#160;&#160; con = DriverManager.getConnection(database, "", "");</span></p><p><span style="font-family: courier new,courier;">&#160;&#160; /* also tried:</span><br/><span style="font-family: courier new,courier;">&#160;&#160; con = DriverManager.getConnection("jdbc:odbc:catNavDB");</span><br/><span style="font-family: courier new,courier;">&#160;&#160; */</span><br/><span style="font-family: courier new,courier;">&#160;&#160; </span><br/><span style="font-family: courier new,courier;">&#160;&#160; // Create an SQL statement.</span><br/><span style="font-family: courier new,courier;">&#160;&#160; stmt = con.createStatement();</span><br/><span style="font-family: courier new,courier;">&#160; </span><br/><span style="font-family: courier new,courier;">&#160;&#160; // Execute some SQL to create a table in your database.</span><br/><span style="font-family: courier new,courier;">&#160;&#160; // If the table already exists, an exception is thrown!</span><br/><span style="font-family: courier new,courier;">&#160;&#160; String sqlSt = "insert into " + dbName +</span><br/><span style="font-family: courier new,courier;">&#160;&#160;&#160;&#160; ".USERS " +</span><br/><span style="font-family: courier new,courier;">&#160;&#160;&#160;&#160; "values('" + personBean.getFirstName() + "', " +&#160; // FIRST_NAME</span><br/><span style="font-family: courier new,courier;">&#160;&#160;&#160;&#160; "'" + personBean.getLastName() + "', " +&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // LAST_NAME</span><br/><span style="font-family: courier new,courier;">&#160;&#160;&#160;&#160; personBean.getAge() + ", " +&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // AGE</span><br/><span style="font-family: courier new,courier;">&#160;&#160;&#160;&#160; "'" + personBean.getEmail() + "'); "&#160; ;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // EMAIL</span><br/><span style="font-family: courier new,courier;">&#160;&#160; </span><br/><span style="font-family: courier new,courier;">&#160;&#160; // display SQL statment</span><br/><span style="font-family: courier new,courier;">&#160;&#160; System.out.println ("&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;" + sqlSt );</span><br/><span style="font-family: courier new,courier;">&#160;&#160; </span><br/><span style="font-family: courier new,courier;">&#160;&#160; stmt.executeUpdate( sqlSt);</span><span style="font-family: courier new,courier;">&#160; </span><br/><span style="font-family: courier new,courier;">&#160;&#160; </span><br/><span style="font-family: courier new,courier;">&#160;&#160; }</span><br/><span style="font-family: courier new,courier;">&#160;&#160; // Catch any exceptions that are thrown.</span><br/><span style="font-family: courier new,courier;">&#160;&#160; etc.</span><br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="https://community.jboss.org/message/820693#820693">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in Datasource Configuration at <a href="https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2077">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>