File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Murach's Java Servlets and JSP this week in the Servlets 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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
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