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!