简体   繁体   English

Java从服务器获取数据库连接

[英]Java get database connection from the server

I have one project database connection change from client program to located in Server. 我有一个项目数据库连接更改,从客户端程序更改为位于Server中。

There is Client Program made by java(Awt and Swing) and database connection is exposed as configuration file. 有一个由java(Awt和Swing)制作的客户端程序,数据库连接作为配置文件公开。

For security purpose we have to hide database connection information. 为了安全起见,我们必须隐藏数据库连接信息。

First I tried encrypt and decrypt in the files id and password information. 首先,我尝试对文件ID和密码信息进行加密和解密。 However, it is also denied because mainly they don't want to put any database information in the local. 但是,它也被拒绝,因为主要是他们不想将任何数据库信息放在本地。

So They want me to setup database connection in the server, 所以他们要我在服务器上设置数据库连接,

Do you guys have any idea and guide me how to setup that? 你们有什么主意并指导我如何进行设置吗?

I don't want to make big affect, Just want to get Connection object from server and using that connection in the client side. 我不想产生重大影响,只想从服务器获取Connection对象并在客户端使用该连接。

Thank you! 谢谢!

You can't do that. 你不能那样做。 You either have to establish the JDBC connection from your client or write a piece of server software that does the connection and gives you the results in some other form, eg via REST service. 您要么必须从客户端建立JDBC连接,要么编写一段服务器软件来执行该连接并以其他某种形式(例如通过REST服务)为您提供结果。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在Java中获取数据库连接 - get a database connection in java 如何从java.sql.Connection获取数据库URL? - How to get database url from java.sql.Connection? 如何从MongoClient获取连接字符串中指定的Mongo数据库,Java - How to get the Mongo database specified in connection string from MongoClient, Java 连接池到java中没有应用程序服务器的数据库 - Connection pool to database without application server in java 使用Java / Hibernate的MS SQL Server数据库连接 - MS SQL Server Database Connection with Java/Hibernate 从连接池获取数据库连接 - Get database connection from a connection pool 使用JDBC获取和设置数据库服务器连接变量 - Get and SET Database Server Connection Variable with JDBC 如何动态连接到Java中的mysql数据库并显示来自所选数据库的属性表? - How to get dynamic connection to mysql database in java and display tables,attributes from the selected database? java-Tomcat数据库连接池未在websocket服务器端点中提供连接 - java - Tomcat database connection pool not giving connection in websocket server endpoint 如何从独立的Java应用程序连接到Weblogic服务器的数据库连接池 - How to connect to database connection pools of weblogic server from a standalone java application
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM