BlazeDS4 添加MSSQL/MySQL数据源

时间:2023-01-26 17:14:00

首先下载MSSQL的驱动:http://sourceforge.net/projects/jtds/files/

解压下载文件后,将jtds-1.2.5.jar复制到tomcat/lib下.

给spring/infrastructure-config配置文件添加bean:

<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName" value="net.sourceforge.jtds.jdbc.Driver"/>
        <property name="url" value="jdbc:jtds:sqlserver://192.168.1.100:1433/test"/>
        <property name="username" value="sa" />
        <property name="password" value="admin123456" />
</bean>

其他数据源类似:

spring mysql (MYSQL驱动下载:http://dev.mysql.com/downloads/connector/j/)

<bean id="dataSource3" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
        <property name="url" value="jdbc:mysql://192.168.1.100:3306/test"/>
        <property name="username" value="root" />
        <property name="password" value="admin123456" />
    </bean>

spring oracle

<bean id="datasource" class="org.apache.commons.dbcp.BasicDataSource">
    <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
    <property name="url" value="jdbc:oracle:thin:@192.168.1.100:1521:test"/>
    <property name="username" value="sa"/>
    <property name="password" value="admin123456"/>
</bean>

BlazeDS4的官方Demo中,使用的数据库是HyperSQL,数据源配置如下:

<jdbc:embedded-database id="dataSource" type="HSQL" />

关于HSQL的资料可参看其官网:http://hsqldb.org/

 

spring-flex-testdrive-1.0.3-v1的DEMO中则将HSQL换成了H2.

<jdbc:embedded-database id="dataSource" type="H2" />

关于H2数据库的资料可参看其官网:http://www.h2database.com