5 Replies Latest reply on May 13, 2002 5:29 AM by Darrin Addams

    MS Access via Sun's JDBC/ODBC Bridge

    Darrin Addams Newbie

      I'm using 2.4.4 with Catalina and I'm accessing a MS Access database using an entity bean almost identical to the Account example from the book "Mastering EJB - 2nd Edition".

      Everything works OK but when my bean has released its resources, after accessing the database successfully, I get a Dr Watson application for JBOSS and I have to restart the application server. I didn't have a problem until I changed my bean's directoy name. I then changed it back hoping it'd be OK and it wasn't. Even if I delete the jar from the deploy directory and redeploy, it still fails.

      Any ideas? Is it some problem with the way I'm using MS Access? Would I be better using the Hypersonic db provided with JBoss?

      It'd be nice to continue using Access as it's part of a demo I'm putting together to demonstrate some of the options we have for our next project.

      Thanks in anticipation,

      Darrin

        • 1. Re: MS Access via Sun's JDBC/ODBC Bridge
          Adrian Brock Master

          I wouldn't use the JDBC/ODBC bridge.
          It is not threadsafe.

          You want to search the web for a proper MS Access jdbc
          driver. This might be a starting point
          http://industry.java.sun.com/products/jdbc/drivers

          Also, MS Access should be ok for a demo, but you'll
          hit performance problems for a large amount of data.

          Regards,
          Adrian

          • 2. Re: MS Access via Sun's JDBC/ODBC Bridge
            Darrin Addams Newbie

            Thanks for your reply and your interest Adrian.

            When you say it's not thread safe, are you saying I definitely shouldn't use it to test a BMP entity bean?

            When I said in my post that it "would be nice to use Access", it was actually my manager that said it :) Just that ODBC is so easy to configure and it's more of a jaw dropper in a demo if you show Java working quite happily with MS technology and, as ever, I have no budget for this demo.

            I just don't understand why it suddenly stopped working when I made a minor change and now it still doesn't work despite rolling back my code changes.

            • 3. Re: MS Access via Sun's JDBC/ODBC Bridge
              Adrian Brock Master

              Hi,

              I would only use it if you have to. Try to find
              either a pure jdbc driver or an alternate bridge.

              In the long term don't use Access anyway.

              It's weird it worked before. Maybe you have more data
              in the database, making the error more likely? Just
              a guess ;-)

              Regards,
              Adrian

              • 4. Re: MS Access via Sun's JDBC/ODBC Bridge
                Darrin Addams Newbie

                Came back to this today and fixed it. The problem seemed to be nothing more than an error in my SQL syntax in my entity BMP bean's findByPrimaryKey() method, specifically the way I was preparing my statement. Rusty SQL skills y'see :)

                Nevertheless, thanks for the insights into using the bridge, I'll be looking into using an alternative now.




                • 5. Re: MS Access via Sun's JDBC/ODBC Bridge
                  Darrin Addams Newbie

                  Additional to my possible code error I did find one other problem. The ODBC Access driver I was using is apparently incompatible with the JDBC-ODBC bridge. I only found this out because I rebuilt my NT 4.0 Server due to a hard disk problem, used the latest MDAC from MS and then couln't get my entity bean to work correctly. Calling a finder method would always cause a Dr Watson on java.exe and kill JBoss. Another fresh install of NT Server and installation of the data access components from Office 97 Standard edition cured the problem. So, it seems like, for the JDBC-ODBC bridge, the latest MDAC is not recommended on NT 4.0 even with SP 6.0a.