Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic