数据库连接GWT的属性文件

时间:2021-11-02 03:58:02

Hi is it possible to use a properties file in GWT that contains database details and then just change it anytime if for example, your database details change? This file would be read by java.sql.Connection so that the system could connect to the database. Thanks

您是否可以在GWT中使用包含数据库详细信息的属性文件,然后随时更改它,例如,您的数据库详细信息更改? java.sql.Connection将读取此文件,以便系统可以连接到数据库。谢谢

2 个解决方案

#1


0  

It is possible to use files to configure GWT. Every GWT "module" has a definition xml file, and you can always define constants in your Java code too.

可以使用文件来配置GWT。每个GWT“模块”都有一个定义xml文件,您也可以始终在Java代码中定义常量。

On the server side, you can use all of the Java tools you're used to, as long as your server supports them! GWT does not place any additional constraints on your server code.

在服务器端,只要您的服务器支持它们,您就可以使用您习惯使用的所有Java工具! GWT不会对您的服务器代码施加任何其他限制。

#2


0  

I suggest you to try with an ORM (object-relational mapping) in order to handle your database communication. In this case you will naturally use a configuration-property file.

我建议您尝试使用ORM(对象关系映射)来处理数据库通信。在这种情况下,您自然会使用配置属性文件。

There is a good article that provides some info about using GWT with Hibernate.

有一篇很好的文章提供了有关在Hibernate中使用GWT的一些信息。

#1


0  

It is possible to use files to configure GWT. Every GWT "module" has a definition xml file, and you can always define constants in your Java code too.

可以使用文件来配置GWT。每个GWT“模块”都有一个定义xml文件,您也可以始终在Java代码中定义常量。

On the server side, you can use all of the Java tools you're used to, as long as your server supports them! GWT does not place any additional constraints on your server code.

在服务器端,只要您的服务器支持它们,您就可以使用您习惯使用的所有Java工具! GWT不会对您的服务器代码施加任何其他限制。

#2


0  

I suggest you to try with an ORM (object-relational mapping) in order to handle your database communication. In this case you will naturally use a configuration-property file.

我建议您尝试使用ORM(对象关系映射)来处理数据库通信。在这种情况下,您自然会使用配置属性文件。

There is a good article that provides some info about using GWT with Hibernate.

有一篇很好的文章提供了有关在Hibernate中使用GWT的一些信息。