连接到Grails应用程序数据库 [英] connecting to a grails app database

查看:98
本文介绍了连接到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应用程序数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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