Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem with Castor JDO

 
suresh sampath kumar
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

For the first time iam trying to use Castor JDO for accessing database, i just tryed with a small example, but iam facing some problem which are as follows

This is the bean iam using in my example

public class Shop {
private String id;
private String _Name;
private String _Address;

public String getId() {
return id;
}
public void setId(String _id) {
this.id = _id;
}
public String get_Name() {
return _Name;
}
public void set_Name(String _Name) {
this._Name = _Name;
}
public String get_Address() {
return _Address;
}
public void set_Address(String _Address) {
this._Address = _Address;
}
}

My Mapping file contains

<jdo-conf>
<database name="ora" engine="oracle">
<driver class-name="oracle.jdbc.driver.OracleDriver" url="******">
<param name="user" value="****" />
<param name="password" value="****" />
</driver>
<mapping href="mapping.xml" />
</database>
<transaction-demarcation mode="local" /> //Step1
</jdo-conf>

My Test Class
import org.exolab.castor.jdo.Database;
import org.exolab.castor.jdo.JDOManager;

public class Shoptest {

public static void main(String[] args) {
Shop _shop = new Shop();
_shop.setId("0000001");
_shop.set_Name("Testshop");
_shop.set_Address("india");
// load database config
System.out.println("starting");
try {
JDOManager jdo;
JDOManager.loadConfiguration("/jdo-conf.xml");
jdo = JDOManager.createInstance("ora");
Database db = jdo.getDatabase();
db.begin();
db.create(_shop);
db.commit();
}
}
}

Intially i was not using the step1(commented (refer above code)) in my Mapping.xml, i wast getting NullPointer exception, then i introduced the Step1(commented(refer above))

iam getting...
"org.exolab.castor.mapping.MappingException: Can not load class oracle.jdbc.driver.OracleDriver"


I will be really greatfull if any one can help me.


Regards
Suresh.S
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!