Spring Boot: Is it possible to have an h2console connect directly to a MySQL DB?











up vote
-1
down vote

favorite












I am intending to have a console on my web app so I can run queries directly from my browser. I can only find guides on how to connect the h2console to an in-memory DB instance. Is this possible? Security isn't an issue, this is strictly for testing purposes, only my ip address will be allowed to connect to the site (for now).










share|improve this question






















  • If down-voting, please provide feedback as to why. I read stackoverflow.com/questions/45924233/… but I am not going to attempt to try this if it will not work. It may be a dumb question but I am brand new to spring boot (and web dev in general).
    – Leo Scarano
    Nov 18 at 14:40










  • I suggest you use PhpMyAdmin to access MySQL. Alternatively you will have to drop relevant JDBC drivers in your classpath and configure to work with H2Console. You might find this answer useful: stackoverflow.com/questions/3217656/…
    – JSS
    Nov 18 at 14:45












  • @JSS Is it possible to route a php admin page to apache tomcat? I know I can easily use phpmyadmin but I need to be able to write queries directly on the website.
    – Leo Scarano
    Nov 18 at 14:57










  • Not sure what you mean. PHPMyAdmin is written in PHP and can't be natively executed in Tomcat.
    – JSS
    Nov 18 at 15:13










  • @JSS I see. I just need a way to execute queries directly on my website while still being able to use spring boot
    – Leo Scarano
    Nov 18 at 15:15















up vote
-1
down vote

favorite












I am intending to have a console on my web app so I can run queries directly from my browser. I can only find guides on how to connect the h2console to an in-memory DB instance. Is this possible? Security isn't an issue, this is strictly for testing purposes, only my ip address will be allowed to connect to the site (for now).










share|improve this question






















  • If down-voting, please provide feedback as to why. I read stackoverflow.com/questions/45924233/… but I am not going to attempt to try this if it will not work. It may be a dumb question but I am brand new to spring boot (and web dev in general).
    – Leo Scarano
    Nov 18 at 14:40










  • I suggest you use PhpMyAdmin to access MySQL. Alternatively you will have to drop relevant JDBC drivers in your classpath and configure to work with H2Console. You might find this answer useful: stackoverflow.com/questions/3217656/…
    – JSS
    Nov 18 at 14:45












  • @JSS Is it possible to route a php admin page to apache tomcat? I know I can easily use phpmyadmin but I need to be able to write queries directly on the website.
    – Leo Scarano
    Nov 18 at 14:57










  • Not sure what you mean. PHPMyAdmin is written in PHP and can't be natively executed in Tomcat.
    – JSS
    Nov 18 at 15:13










  • @JSS I see. I just need a way to execute queries directly on my website while still being able to use spring boot
    – Leo Scarano
    Nov 18 at 15:15













up vote
-1
down vote

favorite









up vote
-1
down vote

favorite











I am intending to have a console on my web app so I can run queries directly from my browser. I can only find guides on how to connect the h2console to an in-memory DB instance. Is this possible? Security isn't an issue, this is strictly for testing purposes, only my ip address will be allowed to connect to the site (for now).










share|improve this question













I am intending to have a console on my web app so I can run queries directly from my browser. I can only find guides on how to connect the h2console to an in-memory DB instance. Is this possible? Security isn't an issue, this is strictly for testing purposes, only my ip address will be allowed to connect to the site (for now).







java mysql spring spring-boot






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 18 at 14:21









Leo Scarano

367




367












  • If down-voting, please provide feedback as to why. I read stackoverflow.com/questions/45924233/… but I am not going to attempt to try this if it will not work. It may be a dumb question but I am brand new to spring boot (and web dev in general).
    – Leo Scarano
    Nov 18 at 14:40










  • I suggest you use PhpMyAdmin to access MySQL. Alternatively you will have to drop relevant JDBC drivers in your classpath and configure to work with H2Console. You might find this answer useful: stackoverflow.com/questions/3217656/…
    – JSS
    Nov 18 at 14:45












  • @JSS Is it possible to route a php admin page to apache tomcat? I know I can easily use phpmyadmin but I need to be able to write queries directly on the website.
    – Leo Scarano
    Nov 18 at 14:57










  • Not sure what you mean. PHPMyAdmin is written in PHP and can't be natively executed in Tomcat.
    – JSS
    Nov 18 at 15:13










  • @JSS I see. I just need a way to execute queries directly on my website while still being able to use spring boot
    – Leo Scarano
    Nov 18 at 15:15


















  • If down-voting, please provide feedback as to why. I read stackoverflow.com/questions/45924233/… but I am not going to attempt to try this if it will not work. It may be a dumb question but I am brand new to spring boot (and web dev in general).
    – Leo Scarano
    Nov 18 at 14:40










  • I suggest you use PhpMyAdmin to access MySQL. Alternatively you will have to drop relevant JDBC drivers in your classpath and configure to work with H2Console. You might find this answer useful: stackoverflow.com/questions/3217656/…
    – JSS
    Nov 18 at 14:45












  • @JSS Is it possible to route a php admin page to apache tomcat? I know I can easily use phpmyadmin but I need to be able to write queries directly on the website.
    – Leo Scarano
    Nov 18 at 14:57










  • Not sure what you mean. PHPMyAdmin is written in PHP and can't be natively executed in Tomcat.
    – JSS
    Nov 18 at 15:13










  • @JSS I see. I just need a way to execute queries directly on my website while still being able to use spring boot
    – Leo Scarano
    Nov 18 at 15:15
















If down-voting, please provide feedback as to why. I read stackoverflow.com/questions/45924233/… but I am not going to attempt to try this if it will not work. It may be a dumb question but I am brand new to spring boot (and web dev in general).
– Leo Scarano
Nov 18 at 14:40




If down-voting, please provide feedback as to why. I read stackoverflow.com/questions/45924233/… but I am not going to attempt to try this if it will not work. It may be a dumb question but I am brand new to spring boot (and web dev in general).
– Leo Scarano
Nov 18 at 14:40












I suggest you use PhpMyAdmin to access MySQL. Alternatively you will have to drop relevant JDBC drivers in your classpath and configure to work with H2Console. You might find this answer useful: stackoverflow.com/questions/3217656/…
– JSS
Nov 18 at 14:45






I suggest you use PhpMyAdmin to access MySQL. Alternatively you will have to drop relevant JDBC drivers in your classpath and configure to work with H2Console. You might find this answer useful: stackoverflow.com/questions/3217656/…
– JSS
Nov 18 at 14:45














@JSS Is it possible to route a php admin page to apache tomcat? I know I can easily use phpmyadmin but I need to be able to write queries directly on the website.
– Leo Scarano
Nov 18 at 14:57




@JSS Is it possible to route a php admin page to apache tomcat? I know I can easily use phpmyadmin but I need to be able to write queries directly on the website.
– Leo Scarano
Nov 18 at 14:57












Not sure what you mean. PHPMyAdmin is written in PHP and can't be natively executed in Tomcat.
– JSS
Nov 18 at 15:13




Not sure what you mean. PHPMyAdmin is written in PHP and can't be natively executed in Tomcat.
– JSS
Nov 18 at 15:13












@JSS I see. I just need a way to execute queries directly on my website while still being able to use spring boot
– Leo Scarano
Nov 18 at 15:15




@JSS I see. I just need a way to execute queries directly on my website while still being able to use spring boot
– Leo Scarano
Nov 18 at 15:15












1 Answer
1






active

oldest

votes

















up vote
1
down vote



accepted










I think you are confusing some things here: h2 is an in-memory-database. There is NO persistent storage. MySQL is a proper RDBMS. I would not expect you to be able to connect to mysql through that interface.



If you just need to be able to execute queries from your web application, and it is not going to go public, simply create a page with a textarea, send that to the backend using JDBC. If I have misunderstood your question, please add additional details to it so we cn provide a better answer.






share|improve this answer





















  • So use jdbcTemplate.query(<input_string>)? And then just output each line? Is it that simple?
    – Leo Scarano
    Nov 18 at 19:01










  • I would think so. i gather that jdbcTemplate is your jdbc connection object?
    – JoSSte
    Nov 18 at 19:03










  • void query(PreparedStatementCreator psc, RowCallbackHandler rch) Query using a prepared statement, reading the ResultSet on a per-row basis with a RowCallbackHandler. from: docs.spring.io/spring/docs/3.0.x/javadoc-api/org/… looks like it just might be that simple. Thanks for your help!
    – Leo Scarano
    Nov 18 at 19:11










  • Great stuff. Don't forget that if you put this into production (serve it up on the web for everyone to see), you need to secure your application properly. Sanitize your inputs, don't allow people to run arbitrary commands, etc.
    – JoSSte
    Nov 18 at 19:15










  • Have a few guides bookmarked. Thanks again!
    – Leo Scarano
    Nov 18 at 20:21











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53361894%2fspring-boot-is-it-possible-to-have-an-h2console-connect-directly-to-a-mysql-db%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
1
down vote



accepted










I think you are confusing some things here: h2 is an in-memory-database. There is NO persistent storage. MySQL is a proper RDBMS. I would not expect you to be able to connect to mysql through that interface.



If you just need to be able to execute queries from your web application, and it is not going to go public, simply create a page with a textarea, send that to the backend using JDBC. If I have misunderstood your question, please add additional details to it so we cn provide a better answer.






share|improve this answer





















  • So use jdbcTemplate.query(<input_string>)? And then just output each line? Is it that simple?
    – Leo Scarano
    Nov 18 at 19:01










  • I would think so. i gather that jdbcTemplate is your jdbc connection object?
    – JoSSte
    Nov 18 at 19:03










  • void query(PreparedStatementCreator psc, RowCallbackHandler rch) Query using a prepared statement, reading the ResultSet on a per-row basis with a RowCallbackHandler. from: docs.spring.io/spring/docs/3.0.x/javadoc-api/org/… looks like it just might be that simple. Thanks for your help!
    – Leo Scarano
    Nov 18 at 19:11










  • Great stuff. Don't forget that if you put this into production (serve it up on the web for everyone to see), you need to secure your application properly. Sanitize your inputs, don't allow people to run arbitrary commands, etc.
    – JoSSte
    Nov 18 at 19:15










  • Have a few guides bookmarked. Thanks again!
    – Leo Scarano
    Nov 18 at 20:21















up vote
1
down vote



accepted










I think you are confusing some things here: h2 is an in-memory-database. There is NO persistent storage. MySQL is a proper RDBMS. I would not expect you to be able to connect to mysql through that interface.



If you just need to be able to execute queries from your web application, and it is not going to go public, simply create a page with a textarea, send that to the backend using JDBC. If I have misunderstood your question, please add additional details to it so we cn provide a better answer.






share|improve this answer





















  • So use jdbcTemplate.query(<input_string>)? And then just output each line? Is it that simple?
    – Leo Scarano
    Nov 18 at 19:01










  • I would think so. i gather that jdbcTemplate is your jdbc connection object?
    – JoSSte
    Nov 18 at 19:03










  • void query(PreparedStatementCreator psc, RowCallbackHandler rch) Query using a prepared statement, reading the ResultSet on a per-row basis with a RowCallbackHandler. from: docs.spring.io/spring/docs/3.0.x/javadoc-api/org/… looks like it just might be that simple. Thanks for your help!
    – Leo Scarano
    Nov 18 at 19:11










  • Great stuff. Don't forget that if you put this into production (serve it up on the web for everyone to see), you need to secure your application properly. Sanitize your inputs, don't allow people to run arbitrary commands, etc.
    – JoSSte
    Nov 18 at 19:15










  • Have a few guides bookmarked. Thanks again!
    – Leo Scarano
    Nov 18 at 20:21













up vote
1
down vote



accepted







up vote
1
down vote



accepted






I think you are confusing some things here: h2 is an in-memory-database. There is NO persistent storage. MySQL is a proper RDBMS. I would not expect you to be able to connect to mysql through that interface.



If you just need to be able to execute queries from your web application, and it is not going to go public, simply create a page with a textarea, send that to the backend using JDBC. If I have misunderstood your question, please add additional details to it so we cn provide a better answer.






share|improve this answer












I think you are confusing some things here: h2 is an in-memory-database. There is NO persistent storage. MySQL is a proper RDBMS. I would not expect you to be able to connect to mysql through that interface.



If you just need to be able to execute queries from your web application, and it is not going to go public, simply create a page with a textarea, send that to the backend using JDBC. If I have misunderstood your question, please add additional details to it so we cn provide a better answer.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 18 at 17:28









JoSSte

75711031




75711031












  • So use jdbcTemplate.query(<input_string>)? And then just output each line? Is it that simple?
    – Leo Scarano
    Nov 18 at 19:01










  • I would think so. i gather that jdbcTemplate is your jdbc connection object?
    – JoSSte
    Nov 18 at 19:03










  • void query(PreparedStatementCreator psc, RowCallbackHandler rch) Query using a prepared statement, reading the ResultSet on a per-row basis with a RowCallbackHandler. from: docs.spring.io/spring/docs/3.0.x/javadoc-api/org/… looks like it just might be that simple. Thanks for your help!
    – Leo Scarano
    Nov 18 at 19:11










  • Great stuff. Don't forget that if you put this into production (serve it up on the web for everyone to see), you need to secure your application properly. Sanitize your inputs, don't allow people to run arbitrary commands, etc.
    – JoSSte
    Nov 18 at 19:15










  • Have a few guides bookmarked. Thanks again!
    – Leo Scarano
    Nov 18 at 20:21


















  • So use jdbcTemplate.query(<input_string>)? And then just output each line? Is it that simple?
    – Leo Scarano
    Nov 18 at 19:01










  • I would think so. i gather that jdbcTemplate is your jdbc connection object?
    – JoSSte
    Nov 18 at 19:03










  • void query(PreparedStatementCreator psc, RowCallbackHandler rch) Query using a prepared statement, reading the ResultSet on a per-row basis with a RowCallbackHandler. from: docs.spring.io/spring/docs/3.0.x/javadoc-api/org/… looks like it just might be that simple. Thanks for your help!
    – Leo Scarano
    Nov 18 at 19:11










  • Great stuff. Don't forget that if you put this into production (serve it up on the web for everyone to see), you need to secure your application properly. Sanitize your inputs, don't allow people to run arbitrary commands, etc.
    – JoSSte
    Nov 18 at 19:15










  • Have a few guides bookmarked. Thanks again!
    – Leo Scarano
    Nov 18 at 20:21
















So use jdbcTemplate.query(<input_string>)? And then just output each line? Is it that simple?
– Leo Scarano
Nov 18 at 19:01




So use jdbcTemplate.query(<input_string>)? And then just output each line? Is it that simple?
– Leo Scarano
Nov 18 at 19:01












I would think so. i gather that jdbcTemplate is your jdbc connection object?
– JoSSte
Nov 18 at 19:03




I would think so. i gather that jdbcTemplate is your jdbc connection object?
– JoSSte
Nov 18 at 19:03












void query(PreparedStatementCreator psc, RowCallbackHandler rch) Query using a prepared statement, reading the ResultSet on a per-row basis with a RowCallbackHandler. from: docs.spring.io/spring/docs/3.0.x/javadoc-api/org/… looks like it just might be that simple. Thanks for your help!
– Leo Scarano
Nov 18 at 19:11




void query(PreparedStatementCreator psc, RowCallbackHandler rch) Query using a prepared statement, reading the ResultSet on a per-row basis with a RowCallbackHandler. from: docs.spring.io/spring/docs/3.0.x/javadoc-api/org/… looks like it just might be that simple. Thanks for your help!
– Leo Scarano
Nov 18 at 19:11












Great stuff. Don't forget that if you put this into production (serve it up on the web for everyone to see), you need to secure your application properly. Sanitize your inputs, don't allow people to run arbitrary commands, etc.
– JoSSte
Nov 18 at 19:15




Great stuff. Don't forget that if you put this into production (serve it up on the web for everyone to see), you need to secure your application properly. Sanitize your inputs, don't allow people to run arbitrary commands, etc.
– JoSSte
Nov 18 at 19:15












Have a few guides bookmarked. Thanks again!
– Leo Scarano
Nov 18 at 20:21




Have a few guides bookmarked. Thanks again!
– Leo Scarano
Nov 18 at 20:21


















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53361894%2fspring-boot-is-it-possible-to-have-an-h2console-connect-directly-to-a-mysql-db%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Create new schema in PostgreSQL using DBeaver

Deepest pit of an array with Javascript: test on Codility

Fotorealismo