Spring configures JDBC Connection orcale, MYSQL, SQL Server

Source: Internet
Author: User

Read the guide: This article focuses on how to configure the JDBC connection in the spring framework to connect to Oracle, MYSQL, SQL Server.

The principle is as follows:

First, the Guide package

The jar package required to connect the oracle11g: Ojdbc6.jar
The jar package required to connect the mysql5.1: Mysql-connector-java-5.1.12-bin.jar
The jar package required to connect the sqlserver2008: Sqljdbc4.jar

Note: The jar package version corresponds to the software version

Data source Configuration Required Package: Tomcat-jdbc-7.0.61.jar
Tomcat-juli-7.0.61.jar
The tomcat version used here is 7.0.61

Second, properties and configuration files

Jdbc.properties

MySQL database jdbc.driver=com.mysql.jdbc.driverjdbc.url=jdbc:mysql://localhost:3306/testjdbc.username= Rootjdbc.password=root#oracle Database jdbc.driver=oracle.jdbc.driver.oracledriverjdbc.url=jdbc:oracle:thin:@ Localhost:1521/orcl#jdbc.url=jdbc:oracle:thin: @localhost: 1521:orcljdbc.username=rootjdbc.password=oracle# SQL Server Database jdbc.driver=com.microsoft.sqlserver.jdbc.sqlserverdriverjdbc.url=jdbc:microsoft.sqlserver:// 127.0.0.1:1433;databasename=zhidaojdbc.username=rootjdbc.password=oracle

Applicationcontext.xml

<!--data source configuration, using the Tomcat JDBC Pool -    <BeanID= "DataSource"class= "Org.apache.tomcat.jdbc.pool.DataSource"Destroy-method= "Close">        <!--Connection Info -    < Propertyname= "Driverclassname"value= "${jdbc.driver}"/>    < Propertyname= "url"value= "${jdbc.url}"/>    < Propertyname= "username"value= "${jdbc.username}"/>    < Propertyname= "Password"value= "${jdbc.password}"/></Bean>

You can see the followingarticle: 52957968

Spring configures JDBC Connection orcale, MYSQL, SQL Server

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.