File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Remote connection to Access using RmiJdbc driver Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Remote connection to Access using RmiJdbc driver" Watch "Remote connection to Access using RmiJdbc driver" New topic
Author

Remote connection to Access using RmiJdbc driver

vikram nalagampalli
Ranch Hand

Joined: Oct 08, 2001
Posts: 91
Hi,
I am trying to connect to Access DB remotely, but for some reason i am getting Class not found exception. RmiJdbc.zip i downloaded is included int he class path.
I will really appreicate, if some one can lead me through this prolem. MY code is as follows

protected final Connection getMSConnection() throws DBNotFoundException,DBException {

try{
Class.forName("RmiJdbc.RJDriver").newInstance();
System.out.println("Getting connection to Access...");
con = DriverManager.getConnection("jdbc:rmi:"
+ "//10.41.27.27/ " + A_PHONEDIR_URL,A_PHONEDIR_USERNAME,A_PHONEDIR_PASSWORD);

if (con == null){
throw new DBNotFoundException("Could not connect to DB", logger);
}
System.out.println("Sucessful connection to Access......");
}catch (ClassNotFoundException cnfe){
System.out.println("Error Loading Access Driver..../n");
cnfe.printStackTrace();
}
catch (SQLException sqle) {
sqle.printStackTrace();
}
catch (Exception e){
e.printStackTrace();
}
return con;
}

ERROR IS AS FOLLOWS
R java.lang.ClassNotFoundException: RmiJdbc.RJDriver
[11/11/03 15:13:53:115 EST] 6e140f76 SystemErr R at com.ibm.ws.classloader.CompoundClassLoader.findClass(CompoundClassLoader.java(Compiled Code))
[11/11/03 15:13:53:115 EST] 6e140f76 SystemErr R at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java(Compiled Code))
[11/11/03 15:13:53:135 EST] 6e140f76 SystemErr R at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))
[11/11/03 15:13:53:135 EST] 6e140f76 SystemErr R at java.lang.Class.forName1(Native Method)
[11/11/03 15:13:53:135 EST] 6e140f76 SystemErr R at java.lang.Class.forName(Class.java(Compiled Code))
[11/11/03 15:13:53:135 EST] 6e140f76 SystemErr R at com.strykercorp.howost.persistence.DBAbstractFactory.getMSConnection(DBAbstractFactory.java:75)
[11/11/03 15:13:53:135 EST] 6e140f76 SystemErr R at com.strykercorp.howost.persistence.phonelist.PhoneListDataServiceImpl.searchByLastName(PhoneListDataServiceImpl.java:63)
[11/11/03 15:13:53:135 EST] 6e140f76 SystemErr R at com.strykercorp.howost.portlet.general.phonelist.PhoneList.processView(PhoneList.java:95)
[11/11/03 15:13:53:135 EST] 6e140f76 SystemErr R at com.strykercorp.howost.portlet.base.StrykerPortletAdapter.doView(StrykerPortletAdapter.java:29)
[11/11/03 15:13:53:135 EST] 6e140f76 SystemErr R at org.apache.jetspeed.portlet.PortletAdapter.service(PortletAdapter.java:154)
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

When you say "it's on the classpath", you mean it's on the system classpath?
In a web application, the file needs to be in the EAR or WAR classpath, which is almost completely different to the system classpath. This allows the application server to have a different classpath for each application.
If you just use the connections in the web app, put the zip file in the web-inf/lib directory. You may need to either rename the file to .jar (.zips are not loaded automatically like .jars are) or unzip the code to the web-inf/classes directory.
Dave
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Remote connection to Access using RmiJdbc driver