Connect to a remote database (Application and database separation)

Source: Internet
Author: User


Connect to a remote database (Application and database separation). If you are a database veteran, ignore this... If you are a beginner in the database, continue... Www.2cto.com is working on a project recently. The problem is to physically separate the database from the application...
So, find the information on the Internet and make a summary. Scenario, lan, are all XP systems: PC name IP address environment configuration PC1 192.168.0.2 application PC2 192.168.0.3 database 1. PC2 install mysql, basic configuration... Please install ide such as myeclipse on Baidu; user name root, password root... PC1, basic configuration... Run mysql.exe and grant all privileges on *. * TO 'root' @ '192. 168.0.3 'identified by 'root' with grant option; meaning: allow the user root to connect to the mysql server from the host whose ip address is 192.168.0.3 (if you change the ip address of the command line to %, and use root as the password. Remember to flush privileges; 4. configure dbcp of pc1. properties. My configuration is as follows: www.2cto.com driverClassName = com. mysql. jdbc. driverurl = jdbc \: mysql \: // 192.168.0.3 \: 3306/myfirstremotedb? CharacterEncoding \ = UTF-8 & character \ = convertToNullusername = rootpassword = rootinitialSize = 5 maxActive = 10 maxIdle = 10 minIdle = 0 maxWait = 60000 connectionProperties = defaultAutoCommit = true, the word "Yellow background" is in the same line )... 5. coding... Run! That's it!

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.