• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Remote connection to Access using RmiJdbc driver

 
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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)
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
A tiny monkey bit me and I got tiny ads:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic