I am trying to create a connection to a 32 bit Microsoft access 2010 database using Java and 64 bit eclipse eclipse in windows 7.
I created a 32 bit system dns by reading this link . The program to create the 32 bit dns is located at:
c:\windows\sysWOW64\odbcad32.exe
In an attempt to configure eclipse to run the java class as 32-bit, I selected Run as... Run Configurations --> (Arguments tab) and entered -d32 in the VM Arguments box, then clicked run. However, trying to run the program resulted in a dialog box saying:
"Could not create the java virtual machine"
Here is the code for the class I am using to test a connection to the system dns:
public class SoftwareDeveloper {
public static void main(String[] args){
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn = DriverManager.getConnection("jdbc:odbc:MYDSNCONNECTION");
Statement st = conn.createStatement();
ResultSet rest = st.executeQuery("SELECT * FROM myTable");
while(rest.next()){
System.out.println(rest.getString(1));
System.out.println(rest.getString(2));
}
}
catch (ClassNotFoundException cnfe){cnfe.printStackTrace();}
catch (SQLException e) {e.printStackTrace();}
}
}
I am guessing this means I created a 32 bit system dns successfully, but that eclipse is not able to find a 32 bit jdk. I want to keep using 64 bit jdk with eclipse, but is there some way to configure eclipse so that it can switch from a default 64 bit jdk to a 32 bit jdk when -d32 is given in the run configurations? Or is there another solution?
NOTE: Installing 64 bit version of MS Access or deleting Access and downloading an Access database engine from Microsoft are not options for unrelated reasons.
Download and install a 32-bit JRE (or JDK) on your system.
Find your Launch Configuration (Run As-> Run Configurations...) under Java Application branch.
Go to the JRE tab and select Alternate JRE. Click on Installed JREs... button, add your 32-bit JRE and select it.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.