Configuration of data sources in Spring for various databases (oracle, mysql, sqlserver, and so on)

Source: Internet
Author: User
When developing a database-based application system, you must configure the data source in the project to connect to the database for database operations. The methods for configuring data sources for different databases are basically the same. The difference is that the JDBC driver classes and connection URLs of different databases and the corresponding database usernames and passwords are different. The following lists

When developing a database-based application system, you must configure the data source in the project to connect to the database for database operations. The methods for configuring data sources in different databases are basically the same. The difference is that the JDBC driver classes and connection URLs of different databases and the corresponding database usernames and passwords are different. The following lists

When developing a database-based application system, you must configure the data source in the project to connect to the database for database operations. The methods for configuring data sources in different databases are basically the same. The difference is that the JDBC driver classes and connection URLs of different databases and the corresponding database usernames and passwords are different. The following lists the configuration of common database data sources and corresponding JDBC driver packages.

1. Data source configuration format in Spring








The data source defined in the implementation solution of the DBCP open source database of Jakarta is used here.



2. configuration parameters for various databases and their data sources

Database Oracle
Oracle. jdbc. driver. OracleDriver
URL jdbc: oracle: thin: @ localhost: 1521: orcl

Database DB2
Driver com. ibm. db2.jdbc. app. DB2Driver
URL jdbc: db2: // localhost: 5000/testDB

Database SQL Server
Driver com. microsoft. jdbc. sqlserver. SQLServerDriver
URL jdbc. microsoft: sqlserver: // localhost: 1433; DatabaseName = testDB

Database Sybase
Driver com. sybase. jdbc. SybDriver
URL jdbc: sybase: Tds: localhost: 5007/testDB

Database Informix
Driver com. informix. jdbc. IfxDriver
URL jdbc: informixsqli: // 123.45.67.89: 1533/myDB: INFORMIXSERVER = myserver

Mysql database
Driver com. musql. jdbc. Driver
URL jdbc: mysql: // localhost: 3306/testDB

Database PostgreSQL
Driver org. postgresql. Driver
URL jdbc: postgresql: // localhost/testDB

Database HSQLDB
Driver org. hsqldb. jdbcDriver
URL jdbc: hsqldb: hsql: // llocalhost: 9902

Http://g.kehou.com/t1018427501.html

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.