Results 1 to 3 of 3
  1. #1
    jasonwucinski is offline Member
    Join Date
    Feb 2011
    Posts
    64
    Rep Power
    0

    Default how to run java app on 32bit OS

    Hello all,
    I am having issues connecting to my database on a 64 bit OS (windows 7). I have run and compiled this code on other machines and it works fine but my 64bit OS will not connect. I do have Access/Office installed, but when I check the 64bit DSN the drivers are not installed (and there are not drivers available to install them) but in the 32bit DSN they are. Also, I know the path to the DB is correct. I'd rather not create a OS specific program, as that kind of defeats the purpose of programming in java but i dont know what else to do. Interestingly, though, I dont have this problem when i program in Visual Studio. Anyway, here's the code I'm using to connect:
    Java Code:
     public Connection connectToDatabase(String dbName) throws Exception {
            if (conn != null) {
                return conn;
            }
            String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
            if (System.getProperty("java.vendor").equals("Microsoft Corp.")) {
                //Microsoft VM users
                driver = "com.ms.jdbc.odbc.JdbcOdbcDriver";
            }
            String curDir = System.getProperty("user.dir");
           
            
            String url = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ="
                    + curDir
                    + "\\"
                    + dbName;
    
            String username = "";
            String password = "";
            Class.forName(driver);
            System.out.print(url);
            
            return DriverManager.getConnection(url, username, password);
        }
    As i mentioned above, the code works fine on other, non 64 bit/windows 7 machines. the error i get is:
    run:
    java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

    and my connection string, when printed out, looks like this:

    jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=C:\Users\Delerium\Documents\NetBeans Projects\MyDatabaseProgram\MyClients.accdb

    Any help would be great. This problem has left me dead in the water and I am unable to complete my work.

    thanks
    jason

  2. #2
    jasonwucinski is offline Member
    Join Date
    Feb 2011
    Posts
    64
    Rep Power
    0

    Default

    anyone have any ideas?

  3. #3
    jasonwucinski is offline Member
    Join Date
    Feb 2011
    Posts
    64
    Rep Power
    0

    Default

    well, in the event that someone else has this problem, here's how i fixed it. It seems as though windows 7 64bit OS has driver issues and is incompatible with the 64bit JRE and JDK. So, after uninstalling all java and net-beans installations I reinstalled with their 32 bit versions. I'm not sure what this will mean if a user runs my app on a system that's running the 64bit JRE. if anyone has any experience with that, let me know. so much for write once run anywhere :(

Similar Threads

  1. NetworkInterface class behaviour for 32bit vs 64bit java
    By CitizenErased in forum Advanced Java
    Replies: 0
    Last Post: 12-09-2010, 02:25 PM
  2. help: jodbc 32bit in 64bit env
    By tom987456 in forum JDBC
    Replies: 0
    Last Post: 09-09-2009, 08:06 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •