从另一个系统连接数据库 [英] Connect Database from another system
本文介绍了从另一个系统连接数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在system1中有我的应用程序。在我的应用程序中它有bin和db。 Db不在SQL服务器中。
这里我需要从System1到System2访问该数据库
任何人都可以帮忙
提前致谢:(
I have my application in system1.Inside my Application it has bin and db. Db is not in SQL sever.
Here I need to access that db from System1 to System2
Can anyone pls help
Thanks in advance :(
推荐答案
You Have to try this code..
try{
Class.forName(DRIVER);
connection = DriverManager.getConnection("jdbc:mysql://localhost/db_name",root,password);
}catch(Exception ex){
JOptionPane.showMessageDialog(null, ex.getMessage(),"Unable to connect",JOptionPane.ERROR_MESSAGE);
}
this code for the client
try{
Class.forName(DRIVER);
connection = DriverManager.getConnection("jdbc:mysql://169.254.214.132",client_name,password);
}catch(Exception ex){
JOptionPane.showMessageDialog(null, ex.getMessage(),"Unable to connect",JOptionPane.ERROR_MESSAGE);
}
这篇关于从另一个系统连接数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文