Tomcat6 MySql JDBC Datasource configuration

Posted by Bob on Stack Overflow See other posts from Stack Overflow or by Bob
Published on 2010-03-20T22:19:17Z Indexed on 2010/03/20 22:21 UTC
Read the original article Hit count: 409

Filed under:
|
|
|

Hi,

I've always used Spring's dependency injection to get datasource objects and use them in my DAOs, but now, I have to write an app without that.

With Spring I can write something like this:

<bean id="dataSource"
    class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    <property name="driverClassName" value="com.mysql.jdbc.Driver" />
    <property name="url" value="jdbc:mysql://127.0.0.1/app?characterEncoding=UTF-8" />
    <property name="username" value="u" />
    <property name="password" value="p" />
</bean>

But how can I use datasource in my DAOs without Spring or anything? I'm using servlets and JSPs only. Performance is very important factor.

Thanks in advance!

© Stack Overflow or respective owner

Related posts about tomcat

Related posts about jdbc