wood burning stoves 2.0*
The moose likes JDBC and the fly likes Error when Creating DataSource by java Code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Error when Creating DataSource by java Code" Watch "Error when Creating DataSource by java Code" New topic
Author

Error when Creating DataSource by java Code

Vo Hien
Greenhorn

Joined: Mar 27, 2007
Posts: 15
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error when Creating DataSource by java Code
 
Similar Threads
Webservices in java
logging in threads by using log4j
How to embed image (relative path) in an HTML e-mail?
Help me! About DataSourceFactory
SMTPSendFailedException Occurs