简体   繁体   English

托管在Internet上运行的Java Web应用程序

[英]Hosting java web application running on internet

I created a web application which used mySQL data connectivity on my local computer.When i host this application on internet i am not able to get the internet host provided database to bind with my application. 我创建了一个在本地计算机上使用mySQL数据连接的Web应用程序。当我在Internet上托管此应用程序时,我无法获得Internet主机提供的数据库来与我的应用程序绑定。

The internet host provides with a database which is not MySQL but SQL. 互联网主机提供的数据库不是MySQL,而是SQL。

If anyone knows a free hosting website where i can find and bind MySQL database with my server please tell the procedure to do it. 如果有人知道一个免费的托管网站,我可以在其中找到MySQL数据库并将其与我的服务器绑定,请告知执行此操作的过程。 and what changes do i have to make in source code to get this going. 以及我必须对源代码进行哪些更改才能实现此目的。

My ultimate goal is to run this web application on a internet host as good as it runs on my localhost.Please suggest some other internet host.My application only uses jsp's,javascripts,html,java classes and MySQL database.Any other Ideas are also welcome which fulfills my goal. 我的最终目标是在与本地主机上一样好的Internet主机上运行此Web应用程序。建议使用其他Internet主机。我的应用程序仅使用jsp,javascript,html,java类和MySQL数据库。实现我的目标的欢迎。

Right now my data base connectivity for localhost is: 现在,我对本地主机的数据库连接是:

package datalayer;

import java.sql.Connection;
import java.sql.DriverManager;


public class DBConnection {
public static Connection getConnection()
{
Connection con=null;
    try
    {
        Class.forName("com.mysql.jdbc.Driver");
        con=DriverManager.getConnection("jdbc:mysql:///tpcell","root","root");
    }
    catch(Exception e)
    {
        System.out.println("getConnection()"+e);
    }
    return con;
}


}

You have two options: an IaaS or a PaaS. 您有两个选择:IaaS或PaaS。

  • On an IaaS you will choose the OS that you would like and you will need to install Tomcat, MySQL,... from scratch in a similar way you'd do locally. 在IaaS上,您将选择所需的操作系统,并且需要以与本地相同的方式从头安装Tomcat,MySQL等。 Sometimes they provide a free tier where you can test how everything is going. 有时,他们提供了免费服务,您可以在其中测试一切。 Here you have Amazon EC2, Digital Ocean,... 在这里,您有Amazon EC2,Digital Ocean,...

  • A PaaS where you can easily, just a click of your mouse, enable services. 一个PaaS,您只需单击鼠标即可轻松地启用服务。 It means that you could have something like Tomcat as a service or MySQL as a Service without taking care of the installation or the configuration process. 这意味着您无需维护安装或配置过程就可以拥有类似于Tomcat作为服务或MySQL即服务之类的东西。 They usually provide a free tier where you can deploy your application and also create the database and do the binding. 它们通常提供免费层,您可以在其中部署应用程序,还可以创建数据库并进行绑定。

You have this example which shows you how to do it using JNDI on a specific provider. 您有一个示例,向您展示了如何在特定提供程序上使用JNDI进行操作。 However, there are some of them, you can always look for the most suitable to your needs. 但是,其中有一些,您随时可以寻找最适合您的需求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM