• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error when Creating DataSource by java Code

 
Vo Hien
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I use java code to create a Datasource as below:

Properties props = new Properties();
props.setProperty("hibernate.connection.driver_class", "net.sourceforge.jtds.jdbc.Driver");
props.setProperty("hibernate.connection.url", "jdbc:jtds:sqlserver://hienvo:1433;databaseName=SkillPortMaster");
props.setProperty("hibernate.connection.username", "sa");
props.setProperty("hibernate.connection.password", "VoHi!");
props.setProperty("hibernate.connection.pool_size", "2");

DataSource myDataSource = BasicDataSourceFactory.createDataSource(props);

where BasicDataSourceFactory is the class that I import from
import org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory; (naming-factory-dbcp.jar)

But I get an error as below:

org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:780)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)
at com.skillsoft.mgs.email.queued.EmailDispatcher.<init>(EmailDispatcher.java:52)



Do you have any idea for this error ?
Regards,
Hien
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic