hi i am developing a web application i have 3 diffrent mysql database one is local and other 2 are place on a another machine. my problem is when i try to insert or get data to or from that 2 databases(which is place on diffrent machine) it will take lots of time. some cases i am using PreparedStatement more then one because of PreparedStatement my performance down? please help me to inhance performance.
PreparedStatements normally only have positive effects on performance*.
No sense in trying to optimize anything without fully understanding what the problem is. So, first step: work out where your bottleneck is. Are the queries run against these three instances identical (or as near to identical as makes no difference)? If they are not then I'd look at the queries first - can you generate execution plans for them or profile them? (not sure MysQL has tools for this, but if it does, use them). If they are, check the data in the three instances - do the slow ones have significantly more data? If they do, consider creating indices. If your data already has indices, check their statistics are up to date (if they are not, it could be your indices are not being used). And most simple of all, check your database servers are comparable - perhaps the remote ones are running on slow systems, or running out of resources?
If you have the same (or simmilar) queries running against the same (or simmilar) data, on the same (or simmilar) physical hardware, with all indices etc. up to date, then it sounds like it may be the network. See if you can prove this. Write a test case that runs the same SQL against the same database and run them locally and remotely (ideally using the same SQL that demonstrates the performance problem in you application). Is there a huge performance difference? If there is, speak to your network administrator about bandwidth.
(* there are exceptions to this rule, but they are not very common)