Results 1 to 3 of 3
Thread: how to run java app on 32bit OS
- 04-22-2011, 07:30 PM #1
Member
- Join Date
- Feb 2011
- Posts
- 64
- Rep Power
- 0
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:
As i mentioned above, the code works fine on other, non 64 bit/windows 7 machines. the error i get is: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); }
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
- 04-24-2011, 12:16 AM #2
Member
- Join Date
- Feb 2011
- Posts
- 64
- Rep Power
- 0
anyone have any ideas?
- 04-26-2011, 06:55 PM #3
Member
- Join Date
- Feb 2011
- Posts
- 64
- Rep Power
- 0
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
-
NetworkInterface class behaviour for 32bit vs 64bit java
By CitizenErased in forum Advanced JavaReplies: 0Last Post: 12-09-2010, 02:25 PM -
help: jodbc 32bit in 64bit env
By tom987456 in forum JDBCReplies: 0Last Post: 09-09-2009, 08:06 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks