连接到Grails应用程序数据库

编程入门 行业动态 更新时间:2024-10-24 13:26:57
本文介绍了连接到Grails应用程序数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我是一名Python开发人员,但我也有一些Java经验(主要是使用struts)。在工作中,我递了一个Grails应用程序来安装,这没问题,但应用程序的所有者没有提供任何凭据,并且该应用程序加载到登录页面。

<我解开了这场战争的包装,但我认为数据库配置已经被打包到某个地方了,因为我似乎找不到任何连接URL。我在部署应用程序后创建了一个h2 db文件,所以我想知道:

如何像SQLite或mysql一样连接到数据库客户端,浏览表,并创建一个管理员用户,所以我可以登录?

解决方案

去反编译。您不仅需要用户和密码,还需要至少一个数据库。这可能包括DBMS名称,主机,端口,数据库名称 - 具体取决于Java驱动程序。然后按照您通常使用Python或其他方式进行连接,或使用 DBVisualizer 进行连接。

但是,如果数据库在H2 / hsql中(URL类似于 jdbc:h2:mem:XXX ),您遇到了一个问题:它是一个Java在线DBMS。为了获得外部访问权限,您需要更改已反编译的代码,然后使用一些附加内容。希望这不是你的情况。

hsql / H2的另一个方法是查找和反编译数据库引导代码 - 因为它是一个进程内数据库,它应该在每次应用程序启动时填充,所以在那里应该是创建该超级用户的代码。

I am a python developer by day, but I have some java experience as well (mostly with struts). At work I was handed a grails app to install, which was ok, but the owners of the app didn't supply any credentials, and the app loads to a login page.

I unpacked the war, but I think the DB config has been packaged into a jar somewhere, because I can't seem to find any connection URL. There's an h2 db file that's been created after I deployed the App, so I'm wondering:

how can I connect to the db like you normally would with SQLite or mysql client, browse tables, and create an admin user so I can login?

解决方案

Go with decompilation. You need not only a user and password, but at least a database JDBC URL. That may include DBMS name, host, port, database name - depending on Java driver specifics. Then connect as you would normally in Python or whatever, or with DBVisualizer.

But if the database is in H2/hsql (URL is like jdbc:h2:mem:XXX), you've got a problem: it is a Java in-process DBMS. In order to gain external access to it, you'll need to change the decompiled code, compile and pack it back with some additions. Hope it's not your case.

Another way in hsql/H2 case is to find and decompile database bootstrap code - as it's an in-process DB, it should be filled at every application startup, so there should be a code creating that superuser.

更多推荐

连接到Grails应用程序数据库

本文发布于:2023-10-23 13:46:28,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1520994.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:连接到   应用程序   数据库   Grails

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!