Reputation: 1549
i am working in Windows Xp platform and i want to access a another computer database so that database is a mysql and that computer is working on Linux platform ..so problem is i cant not connect with this different two OS (XP to LINUX) ... so please give me some solution...
Upvotes: 0
Views: 917
Reputation: 13728
In java it goes like this. Use your own IP, port, database name, userId and password. MySQL default port is 3306 but it may be a little safer to use another port that is not so well known.
try {
linuxCon = DriverManager.getConnection("jdbc:mysql://191.91.9.19:5900/linuxdb?user=loginID&password=myPassword&useUnicode=true&characterEncoding=UTF-8");
linuxStmt = linuxCon.createStatement();
} catch ...
Upvotes: 1
Reputation: 28561
Java will not care about the OS when connecting to a MySQL server. You simply need to pass the correct connection URL. You'll need to provide more details about how you connect (configuration) and also check that your Linux server accepts connections from outside (firewall/MySQL configuration).
Upvotes: 2