将java应用程序与在线托管的mysql数据库连接 [英] connecting java application with online hosted mysql database

查看:93
本文介绍了将java应用程序与在线托管的mysql数据库连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我已经在java中构建了一个应用程序,应用程序是一个并将在3个不同的系统上使用,因此该应用程序的数据库必须在线,以便为所有3个应用程序保留最新的数据库。 ..



在开始时,我开发了基于localhost(wampserver)的应用程序,并在PhpMyAdmin中使用了数据库,希望应用程序完全开发并准备好运行..但是问题是在线数据库连接!
我已经在PhpMyAdmin的



希望,您的托管服务提供商应具有相同类型的cpanel,以便为远程连接配置MySQL数据库。



I have build an application in java, application is one and will be used on 3 different systems,
And therefore the database of that application must be online to keep all 3 applications with up to date database...

In starting I developed my application based on localhost (wampserver) and used database in "PhpMyAdmin", and hopefully application is fully developed and ready to run.. but the problem is online database connectivity! I have uploaded my database on a Site in PhpMyAdmin and they provided below information:

and the for connecting my app to this DB is:

String url = "jdbc:mysql://fdb12.biz.nf:3306/";
String dbName = "1738412_wstore";

String driver = "com.mysql.jdbc.Driver";
String userName = "1738412_wstore"; 
String password = "Password";  

Class.forName(driver).newInstance();
    Connection conn = DriverManager.getConnection(url+dbName,userName,password);

now when I run my application it shows below error:

I dont know what the problem is there, please help me out through this..

解决方案

I faced the same issue and the following helped me to solve.

http://support.hostgator.com/articles/cpanel/how-to-connect-to-the-mysql-database-remotely

Hopefully, your hosting provider should have same type of cpanel to configure MySQL database for remote connections.

这篇关于将java应用程序与在线托管的mysql数据库连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆