Jump to content

Recommended Posts

Posted

Greetings!

 

Created my first ever SQL database for my heliohost control panel and got number of questions(probably due to lack of enough knowledge or so).

 

  • I can access my database from my control panels phpMyAdmin. But, is there any other method to do so? using any GUI, or Prompt, or anything of that sort! I simply dont wanna use phpMyAdmin.
  • I rarely use PHP and use JDBC and ADO.NET to connect to my databases.
  • Both JDBC and ADO.NET use a connection string of database configured with some user and password. - user: I have created and assigned to DB along with passwords! no problems here.
  • What will be the connection string for both java JDBC and c# ADO.NET??????????
  • Also, java uses drivers to connect to the databases due to common set of classes. So, is there any need to have this driver to my control panel account?
  • Basically, when using Apache Tomcat server with java, Driver files are placed in "lib" of the Tomcat(locally). WHAT IS THE PROCEDURE FOR Cpanel.

 

Please help me through it asap.

Even i would love if someone speaks more on the topic, beyond the points I mentioned 'cz I might have missed something!!!

 

 

Also, I have read the documentations on MySQL but am unable to find any particularly satisfying solution or support!

 

Please support! Thank you!

Posted
  • can access my database from my control panels phpMyAdmin. But, is there any other method to do so? using any GUI, or Prompt, or anything of that sort! I simply dont wanna use phpMyAdmin.

I can't answer the C# ADO.NET and JDBC questions (not familiar with either language, and honestly, there's not many people here who are), but I can answer this one.

 

You can enable Remote MySQL in cPanel by adding your PC's public IP address, then use MySQL WorkBench or a similar program from your PC to manage your database content if you wish. Even the MySQL command line tools should work if you want.

Posted

I can access my database from my control panels phpMyAdmin. But, is there any other method to do so? using any GUI, or Prompt, or anything of that sort! I simply dont wanna use phpMyAdmin.

My preferred way to access databases is on the command line. If you enabled remote access you can type something like this on your home pc

mysql --host=tommy.heliohost.org --user=username --database=username_db -p
It will then prompt you for the password, and you'll get a mysql> prompt where you can run commands like show tables; describe tablename; and various other queries.

 

Regarding java connecting to mysql:

 

Download https://krydos.heliohost.org/mysql.jsp/WEB-INF/lib/jstl-1.2.jar

Download https://krydos.heliohost.org/mysql.jsp/WEB-INF/lib/mysql-connector-java-6.0.5.jar

Upload both of those files to public_html/mysql.jsp/WEB-INF/lib

Create public_html/mysql.jsp/index.jsp with the contents:

<%@ page import="java.io.*,java.util.*,java.sql.*"%>
<%@ page import="javax.servlet.http.*,javax.servlet.*" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>JSP MySQL Test</title>
</head>
<body>

<sql:setDataSource var="mysql_test" driver="com.mysql.jdbc.Driver"

     url="jdbc:mysql://localhost/giteshss_db"
     user="giteshss_user"  password="password123"/>

<sql:query dataSource="${mysql_test}" var="result">
SELECT * from java;
</sql:query>

<c:forEach var="row" items="${result.rows}">
<c:out value="${row.data}"/>
</c:forEach>

</body>
</html>
Here is the live example https://krydos.heliohost.org/mysql.jsp
Posted

Boom!!!!

Accessing my SQL Database from my command line!

 

But hey krydos, I have a question...

 

I have turned on the remote access to my database with my public IP. Is it safe????? Spoofing can spoil my stuff!!! Any suggestions?

Not yet implemented the JSP stuff. will give it a try soon. Guide me for the above!!!

 

Thanks A lot.



Hey krydos!!!!!!!!!!!!!!!!!!!!!

 

Not working!!!! showing a lot of errors!!!! that i cant even resolve with the help of google.

tried a lot, but still they persist.

 

have added pom.xml with some contents i found on stack overflow, web.xml with some contents from stackoverflow!!! but no way out!

 

Guide! will do so.

 

 

 

The error:

HTTP Status 500 - The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application

type Exception report

message The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application

description The server encountered an internal error that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application
	org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:55)
	org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:293)
	org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:80)
	org.apache.jasper.compiler.TagLibraryInfoImpl.generateTldResourcePath(TagLibraryInfoImpl.java:251)
	org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:122)
	org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:434)
	org.apache.jasper.compiler.Parser.parseDirective(Parser.java:492)
	org.apache.jasper.compiler.Parser.parseElements(Parser.java:1448)
	org.apache.jasper.compiler.Parser.parse(Parser.java:145)
	org.apache.jasper.compiler.ParserController.doParse(ParserController.java:244)
	org.apache.jasper.compiler.ParserController.parse(ParserController.java:105)
	org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:201)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:372)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:349)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:333)
	org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:600)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:368)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:385)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:329)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
note The full stack trace of the root cause is available in the Apache Tomcat/8.5.4 logs.

Apache Tomcat/8.5.4



Also guide me through for c# too, if possible.

Posted

I have turned on the remote access to my database with my public IP. Is it safe????? Spoofing can spoil my stuff!!! Any suggestions?

Just make sure you have a strong password and it's reasonably safe. It's not like you're storing top secret national espionage in your database or anything. Take regular backups, and if someone manages to get in you can just drop the database, change the password, and import your latest backup.

 

Regarding the mysql.jsp:

 

When you put .jar files in your WEB-INF/lib/ directory Tomcat has to be restarted before it will find the files. Just ask me to restart it for you. After restarting Tomcat the errors went away, and it just showed a blank page since your query was looking for a column called data which your database didn't have. I updated your index.jsp for you so it looks like this now to match the columns you had entered

<sql:setDataSource var="mysql_test" driver="com.mysql.jdbc.Driver"

     url="jdbc:mysql://localhost/giteshss_db"
     user="giteshss_user"  password="password123"/>

<sql:query dataSource="${mysql_test}" var="result">
SELECT * from java;
</sql:query>

<table>
<tr><th>Name</th><th>Age</th><th>City</th></tr>
<c:forEach var="row" items="${result.rows}">
<tr>
<td><c:out value="${row.name}"/></td>
<td><c:out value="${row.age}"/></td>
<td><c:out value="${row.city}"/></td>
</tr>
</c:forEach>
</table>
Here is the working test http://giteshsshroti.heliohost.org/mysql.jsp

 

By the way, your .htaccess file was redirecting all requests to your .tk domain resulting in 404 errors so I renamed it .htaccess-old so I could actually see the /mysql.jsp/ directory.

Posted

Just make sure you have a strong password and it's reasonably safe.

 

Sure!! Thanks.

 

 

Regarding the mysql.jsp:

 

When you put .jar files in your WEB-INF/lib/ directory Tomcat has to be restarted before it will find the files.

I usually keep on updating my stuff frequently. as i am learning from my errors and experiments, I make changes to my directory. DO I ALWAYS HAVE TO ""Post"" to restart my TOMCAT server? IS there no way? Direct?

 

 

By the way, your .htaccess file was redirecting all requests to your .tk domain resulting in 404 errors so I renamed it .htaccess-old so I could actually see the /mysql.jsp/ directory.

 

I did so because i am having my alias secured with SSL. I heed it to happen (redirection). is there any way i can use redirection as well as use the above prototype?

mysql.jsp is a folder inside public_html directory hence my alias pointing to the public_html must access that!

Is it not so? Am I going on a wrong track? Help!

 

Just ask me to restart it for you.

 

Will do! but is there no way i can use to restart my tomcat manually? It might be link-braking to POST and get it done. And that too always!!!!!!!!!

 

Hey krydos. i know I am not hosting a professional site. But this is for learning purpose! I hope you understand WHAT and WHY i am talking!!!!!!!!!!!!!!

Posted

Will do! but is there no way i can use to restart my tomcat manually?

You only have to restart it if you add a new .jar file. Just changing the code will update on it's own. How often are you going to add new .jars?

 

I did so because i am having my alias secured with SSL. I heed it to happen (redirection). is there any way i can use redirection as well as use the above prototype?

Right now you have any url being rewritten to giteshssroti.tk. Try this .htaccess code which should only redirect non-ssl http://giteshsshroti.tk/ to https://giteshsshroti.tk/ which is what I think you're trying to do, but it will leave http://giteshsshroti.heliohost.org/ alone:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^giteshsshroti\.tk [NC]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI}

Also guide me through for c# too, if possible.

Regarding aspx connection to mysql:

 

Create a new file such as mysql.aspx with the contents:

<%@ Page Language="C#" %>
<%@ Assembly Name="MySql.Data" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="MySql.Data.MySqlClient" %>

<script RunAt="server">

void Page_Load(object sender, EventArgs e) {

MySql.Data.MySqlClient.MySqlConnection conn;
conn = new MySqlConnection("Database=giteshss_db; Data Source=localhost; User Id=giteshss_user; Password=password123;");
conn.Open();
MySql.Data.MySqlClient.MySqlDataAdapter myDataAdapter;
myDataAdapter = new MySqlDataAdapter("select * from aspx", conn);
System.Data.DataSet myDataSet;
myDataSet = new DataSet();
myDataAdapter.Fill(myDataSet, "aspx");
string text = myDataSet.Tables[0].Rows[0]["data"].ToString();
myLabel.Text = text;
conn.Close();
}

</script>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[url=http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd[/url]">
<html xmlns="[url=http://www.w3.org/1999/xhtml]http://www.w3.org/1999/xhtml[/url]" >
<head RunAt="server">
<title>ASPX MySQL Test</title>
</head>
<body>
<form id="form1" RunAt="server">
<div>
<asp:Label id="myLabel" RunAt="server"/>
</div>
</form>
</body>
</html>
Working example is located at https://krydos.heliohost.org/mysql.aspx
Posted

I did so because i am having my alias secured with SSL. I heed it to happen (redirection). is there any way i can use redirection as well as use the above prototype?

Right now you have any url being rewritten to giteshssroti.tk. Try this .htaccess code which should only redirect non-ssl http://giteshsshroti.tk/ to https://giteshsshroti.tk/ which is what I think you're trying to do, but it will leave http://giteshsshroti.heliohost.org/ alone:

 

Actually no.

 

I have my alias pointing to my public_html because i wanted to have a "main domain" address in my address bar.

When I searched google for search results and page rank, it suggested me to not have sub domains as my main domain address.

 

That was the reason i had the domain alias for giteshsshroti.heliohost.org.

 

Also, redirecting BOTH of them to secure https://giteshsshroti.tk was 'cz: WHEN I TYPE https://giteshsshroti.heliohost.tk IN MY BROWSER'S ADDRESS BAR, CHROME SHOWS ME SECURITY RISKS. while for https://giteshsshroti.tk, it doesn't.

 

To avoid that risk from flashing on the browser screen, i did so.

I know I should have Another SSL for my main domain or a single certificate with all domains mentioned, AND:

  • I have one certificate with main domain name.
  • and another with giteshsshroti.tk mentioned.

BUT UNFORTUNATELY I AM NOT ABLE TO USE BOTH OF THEM AT ONCE. even though they point to separate domains! SO, I did this........adjustment.........SORRY!

 

 

 

 

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

 

 

If there is some professional solution to this, guide me through!

 

 

Will do! but is there no way i can use to restart my tomcat manually?

You only have to restart it if you add a new .jar file. Just changing the code will update on it's own. How often are you going to add new .jars?

 

I cannot predict how often. As I try out something new every now and then, I might need to do so. But can't predict. Sorry for that.

And actually, prior to this post, I even posted many times that my pages aren't working. Did not mentioned exact errors then, but they were resolved once I asked you to resolve them.

Probably, they were related to the same I guess. and I waited for days or two until someone escalated my issue to you.

 

However thanks for your help.

Giving c# a try. will report if something weird happens.

 

Please help me with the previous(above) issue.

Thanks krydos!!

 

 

have added pom.xml with some contents i found on stack overflow, web.xml with some contents from stackoverflow!!! but no way out!

 

 

 

 

 

 

 

 

 

 

 

HEY!!!!!!!

Actually I have read many posts over this topic to resolve the error myself and found some "masters" suggesting this. However it didn't work.

 

Is it really necessary to have a web.xml and a pom.xml? and some others too like content.xml!!!!!!!!!!!!

 

Or it isn't?

 

Regardless of their necessity, please tell me when and why do we actually need them. (For learning purpose).

 

Thanks!

 

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

KRYDOS! Permission for - Dropping you a personal mail to ensure HelioHost's services' privacy by publicly avoiding the topic............. Is it OK? Shall i do?...............if it isn't OK I won't do so!!....reply to this too. Once you do, I will edit the post to remove this part.

Posted

Is it really necessary to have a web.xml and a pom.xml? and some others too like content.xml!!!!!!!!!!!!

https://cloud.google.com/appengine/docs/java/config/webxml

 

KRYDOS! Permission for - Dropping you a personal mail to ensure HelioHost's services' privacy by publicly avoiding the topic............. Is it OK? Shall i do?...............if it isn't OK I won't do so!!....reply to this too. Once you do, I will edit the post to remove this part.

What do you think you need to email to me?
Posted

I don't think i had asked for permission if I were to mention it here.

 

Also I don't wanna get reported for dropping mails to admin! Especially YOU! not because you are a higher authority but because I too know that you don't want frustrating content flashing your inbox. UNWANTED rather. UNEXPECTED!

I know krydos my matter isn't that big but still I think if i post it here, someone can even misuse the information. EVEN if it isnt worth doing so, I don't wanna drop it here! THANKS for understanding the scenario.

 

ITS ALL RELATED TO THE TOPIC. nothing beyond that. If you think what i shared wasn't worth, sorry for that. Would avoid posting senseless stuff hereafter!.



 

I have my alias pointing to my public_html because i wanted to have a "main domain" address in my address bar.

When I searched google for search results and page rank, it suggested me to not have sub domains as my main domain address.

 

That was the reason i had the domain alias for giteshsshroti.heliohost.org.

 

Also, redirecting BOTH of them to secure https://giteshsshroti.tk was 'cz: WHEN I TYPE https://giteshsshroti.heliohost.tk IN MY BROWSER'S ADDRESS BAR, CHROME SHOWS ME SECURITY RISKS. while for https://giteshsshroti.tk, it doesn't.

 

To avoid that risk from flashing on the browser screen, i did so.

I know I should have Another SSL for my main domain or a single certificate with all domains mentioned, AND:

  • I have one certificate with main domain name.
  • and another with giteshsshroti.tk mentioned.

BUT UNFORTUNATELY I AM NOT ABLE TO USE BOTH OF THEM AT ONCE. even though they point to separate domains! SO, I did this........adjustment.........SORRY!

 

 

Any new stuff for this?

Posted

I don't think i had asked for permission if I were to mention it here.

 

Also I don't wanna get reported for dropping mails to admin! Especially YOU! not because you are a higher authority but because I too know that you don't want frustrating content flashing your inbox. UNWANTED rather. UNEXPECTED!

I know krydos my matter isn't that big but still I think if i post it here, someone can even misuse the information. EVEN if it isnt worth doing so, I don't wanna drop it here! THANKS for understanding the scenario.

 

ITS ALL RELATED TO THE TOPIC. nothing beyond that. If you think what i shared wasn't worth, sorry for that. Would avoid posting senseless stuff hereafter!.

 

 

I have my alias pointing to my public_html because i wanted to have a "main domain" address in my address bar.

When I searched google for search results and page rank, it suggested me to not have sub domains as my main domain address.

 

That was the reason i had the domain alias for giteshsshroti.heliohost.org.

 

Also, redirecting BOTH of them to secure https://giteshsshroti.tk was 'cz: WHEN I TYPE https://giteshsshroti.heliohost.tk IN MY BROWSER'S ADDRESS BAR, CHROME SHOWS ME SECURITY RISKS. while for https://giteshsshroti.tk, it doesn't.

 

To avoid that risk from flashing on the browser screen, i did so.

I know I should have Another SSL for my main domain or a single certificate with all domains mentioned, AND:

 

 

 

Any new stuff for this?

What else do you want to know? You know the correct solution already...you should get a certificate with both domains listed and get rid of the redirect. Having a redirect first thing on a domain is almost as bad as just leaving the security warnings in terms of search indexing anyway.

 

The alternative is to just turn off SSL on the subdomain and allow the insecure connections.

 

I don't think i had asked for permission if I were to mention it here.

 

Also I don't wanna get reported for dropping mails to admin! Especially YOU! not because you are a higher authority but because I too know that you don't want frustrating content flashing your inbox. UNWANTED rather. UNEXPECTED!

I know krydos my matter isn't that big but still I think if i post it here, someone can even misuse the information. EVEN if it isnt worth doing so, I don't wanna drop it here! THANKS for understanding the scenario.

 

As long as you don't post passwords (obvious reasons) or email addresses (spam), you're perfectly fine. Posting usernames and domains isn't going to hurt anything, and in fact will get the site seen by places like Google faster (they'll find it when they index our board). Thousands of others post this info.

 

When people PM me usernames/domains, the first thing I do is post it in the topic for them anyway or ask them to start a topic if they don't have one...it's impossible for all of us to work on your issue if only one admin has the information.

Posted

When people PM me usernames/domains, the first thing I do is post it in the topic for them anyway or ask them to start a topic if they don't have one...it's impossible for all of us to work on your issue if only one admin has the information.

 

 

Its obvious! I don't want anyone to work on my issue. I post, cz m in trouble! many times I waited even days before asking for help to drag someone to the topic!

I can wait obviously for times! Unless my work is interrupted!

 

And I am not opposing what you are doing. I asked for the mailing permission that was the biggest mistake I did I guess. AS MY TOPIC IS THERE ASIDE AND DISCUSSION GOES DOWN TO MAILING!

Actually, I wanted to share a content on a site that i found "insecure" being a HELIOHOST user. DEDICATED user rather!

It was like I thought it would be better if I avoid posting it publicly because Someone can use it to do what he is not intended to do.

 

SORRY FOR THE SINCERITY! Simply admins are hitting posts to.... LET IT BE.

 

However, I have a new question - RELATED TO THE POST.

HENCE NOT CREATING A NEW TOPIC.

 

In my prior post into this topic, I asked about restarting TOMCAT. Kyrdos said I will have to ask for it by posting.

There, my question was - can we do it ourselves (not for fun but for reason if sometimes we immediately need to do so or some change needs to be reflected immediately...in those cases).

 

So, I found some articles regarding the same.

Do they work on MyDomain? or even, on any domain using Heliohost? and TOMCAT!?

 

 

1.

public void stopRunTomcat(){
    try{
        Socket s = new Socket(server,8005);
        if(s.isConnected()){
            PrintWriter print = new PrintWriter(s.getOutputStream(),true);
            //Stop tomcat if it is already started
            print.println("SHUTDOWN"); 
            print.close();
            s.close();
        }
        //Run tomcat 
        Runtime.getRuntime().exec(System.getProperty("catalina.home")+"\\bin\\startup.sh");
    }catch (Exception ex){
        ex.printStackTrace();
    }
}

Will it work?

 

2.

<target name="tomcat-start">
    <java jar="${tomcat.home}/bin/bootstrap.jar" fork="true">
        <jvmarg value="-Dcatalina.home=${tomcat.home}"/>
    </java>
</target>
 
<target name="tomcat-stop">
    <java jar="${tomcat.home}/bin/bootstrap.jar" fork="true">
        <jvmarg value="-Dcatalina.home=${tomcat.home}"/>
        <arg line="stop"/>
    </java>
</target>



 The Tomcat Reload Ant task can also be used to speed up development time.
One of the advantages of this approach is that you can extend it to start Tomcat for remote debugging:

<target name="tomcat-start-debug">
    <java jar="${tomcat.home}/bin/bootstrap.jar" fork="true">
        <jvmarg value="-Dcatalina.home=${tomcat.home}"/>
        <jvmarg value="-Xdebug"/>
        <jvmarg
value="-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n"/>
    </java>
</target>

Any Suggestions?............

 

What are the credentials required for port number and all!

Posted

You won't have the permissions to use either of those. Only Krydos or Byron can restart Tomcat (it requires root access). If you're going to be doing lots of development in Java, I'd recommend setting up Tomcat on your PC and developing your program there before putting it up here.

 

And I am not opposing what you are doing. I asked for the mailing permission that was the biggest mistake I did I guess. AS MY TOPIC IS THERE ASIDE AND DISCUSSION GOES DOWN TO MAILING!

Actually, I wanted to share a content on a site that i found "insecure" being a HELIOHOST user.

What sort of security issue is it? There aren't many reports we get that aren't safe for the forum. If it's a severe issue, we can always hide/delete the forum post. I accept PMs if you're concerned about whether it's appropriate to be posted on the boards (most things are fine though).

 

We can't fix what we don't know about.

Posted

You won't have the permissions to use either of those. Only Krydos or Byron can restart Tomcat (it requires root access). If you're going to be doing lots of development in Java, I'd recommend setting up Tomcat on your PC and developing your program there before putting it up here.

 

Sure! wanted to know what exactly is related to tomcat. Got my point.

 

 

 

And I am not opposing what you are doing. I asked for the mailing permission that was the biggest mistake I did I guess. AS MY TOPIC IS THERE ASIDE AND DISCUSSION GOES DOWN TO MAILING!

Actually, I wanted to share a content on a site that i found "insecure" being a HELIOHOST user.

What sort of security issue is it? There aren't many reports we get that aren't safe for the forum. If it's a severe issue, we can always hide/delete the forum post. PMs are welcome if you're concerned about whether it's appropriate to be posted on the boards (most things are fine though).

 

We can't fix what we don't know about.

 

Sure! will try posting stuffs rather than asking for PMs! May be, somethings i find insecure, can even be problems of others. which can be resolved by forum posts!

Will take care of what it was! Not posting it here.

THANKS FOR YOUR HELP!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...