Basicdatasource data source configuration and Data

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 the configuration of common database data sources and corresponding JDBC driver packages.

1. Data source configuration format in spring

<Bean id = "datasource" class = "org. Apache. commons. DBCP. basicdatasource" Destroy-method = "close">

<Property name = "driverclassname" value = ""/>

<Property name = "url" value = ""/>

<Property name = "username" value = ""/>

<Property name = "password" value = ""/>

</Bean>

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 Driver URL Username Password
Oracle Oracle. JDBC. Driver. oracledriver JDBC: oracle: thin: @ localhost: 1521: orcl Scott Tiger
DB2 Com. IBM. db2.jdbc. App. db2driver JDBC: DB2: // localhost: 5000/testdb Root Admin
SQL Server

Com. Microsoft. JDBC. sqlserver

. Sqlserverdriver

JDBC. Microsoft: sqlserver: // localhost: 1433;

Databasename = testdb

Root Admin
Sybase Com. Sybase. JDBC. sybdriver JDBC: Sybase: TDS: localhost: 5007/testdb
Informix Com. Informix. JDBC. ifxdriver

JDBC: informixsqli: // 123.45.67.89: 1533/mydb:

Informixserver = myserver

MySQL Com. MySQL. JDBC. Driver JDBC: mysql: // localhost: 3306/testdb
PostgreSQL Org. PostgreSQL. Driver JDBC: PostgreSQL: // localhost/testdb
HSQLDB Org. HSQLDB. jdbcdriver JDBC: HSQLDB: hsql: // llocalhost: 9902

For the rest of the work, you only need to import the corresponding database driver.

Basicdatasource data source configuration and Data

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.