3 Replies Latest reply: May 30, 2013 3:48 AM by 1011133 RSS

    Connect to MS Access using NetBeans, data source name not found!

    1011133

      Hi

      NetBeans IDE 7.3 and OS was Windows 7 (64-bit )

      When I run my program by NetBeans, it complain about the following errors.

      java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

      In fact, the MS Access file had exist the specify path, I can run the jar file (not in IDE environment) and connect to MS Access DB successfully.

      And I had search from network, and found it said "the ODBC source was run by different server", one was C:\Windows\SysWOW64\odbcad32.exe for 32-bit and c:\windows\system32\odbcad32.exe for 64-bit.
      So the question is, why IDE cannot connect to MS Access DB, How to set NetBeans IDE to make it connectable to 32 bits or 64 bits ODBC, like the program run without IDE?

      Thanks!

        • 1. Re: Connect to MS Access using NetBeans, data source name not found!
          gimbal2
          user13005878 wrote:
          java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
          That reads like "your datasource configuration is not good, fix it"
          And I had search from network, and found it said "the ODBC source was run by different server", one was C:\Windows\SysWOW64\odbcad32.exe for 32-bit and c:\windows\system32\odbcad32.exe for 64-bit.
          It would make a whole lot of sense if that was the other way around, don't you think? SysWOW64 for 64 bits and system32 for 32 bits.
          So the question is, why IDE cannot connect to MS Access DB
          Because something is wrong
          How to set NetBeans IDE to make it connectable to 32 bits or 64 bits ODBC, like the program run without IDE?
          By setting the correct connection configuration properties.

          I'm not 100% positive, but I believe that doing ODBC connections from a 64 bits environment is not actually supported in Java. You may be outraged by that - in Java 8 the ODBC-JDBC bridge is going to be completely dropped, no more connecting to Access from Java without third party libraries (which tend to be commercial). In any case for now try to use a 32 bits Java runtime if you're using a 64 bits one.
          • 2. Re: Connect to MS Access using NetBeans, data source name not found!
            1011133
            Hi gimbal2

            Thank your answer!

            The problem was that running the JAR (in project/dist/myprogram.jar) which build by NetBeans IDE can connect to MS Access DB, but failed to connect DB if I clicked the menu item "Run Main Project" in IDE environment.

            Now each time I have to build the project, and then open the dist folder, and run the jar file, I cannot debug my project via IDE or run it in NetBeans IDE.
            • 3. Re: Connect to MS Access using NetBeans, data source name not found!
              1011133
              Hi gimbal2

              thank your answer!

              The problem was that when I click the "Run Main Project" or "F6" on NetBeans IDE, the IDE complained about the above error, but if I run the generated distribution JAR (in project/dist/myproject.jar), it's Ok to connect MS Access, so it's my question, I cannot run or debug it in IDE environment, I have to enter the dist folder each time, and run it to check the result.