CN104166699A - Data access method based on REST framework - Google Patents
Data access method based on REST framework Download PDFInfo
- Publication number
- CN104166699A CN104166699A CN201410378381.7A CN201410378381A CN104166699A CN 104166699 A CN104166699 A CN 104166699A CN 201410378381 A CN201410378381 A CN 201410378381A CN 104166699 A CN104166699 A CN 104166699A
- Authority
- CN
- China
- Prior art keywords
- jdbc
- database
- restful
- data source
- protocol
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/25—Integrating or interfacing systems involving database management systems
- G06F16/258—Data format conversion from or to a database
Landscapes
- Engineering & Computer Science (AREA)
- Databases & Information Systems (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
本发明涉及计算机应用技术领域,特别涉及到一种基于REST架构的数据访问方法。本发明采用RESTful JDBC协议与数据源进行交互,各个数据源通过RESTful JDBC协议接入到云数据库中来;所述的RESTful JDBC协议将传统的JDBC接口封装成RESTful JDBC接口;RESTful JDBC提供的接口与JDBC接口基本相同,接口的语义也与JDBC保持一致。本发明为数据源与云数据库之间提供了一种基于REST架构的交互方式;可以用于云数据库与异构数据源的交互上。
The invention relates to the field of computer application technology, in particular to a data access method based on the REST architecture. The present invention uses the RESTful JDBC protocol to interact with data sources, and each data source is connected to the cloud database through the RESTful JDBC protocol; the RESTful JDBC protocol encapsulates the traditional JDBC interface into a RESTful JDBC interface; the interface provided by the RESTful JDBC and The JDBC interface is basically the same, and the semantics of the interface are also consistent with JDBC. The invention provides an interaction mode based on the REST architecture between the data source and the cloud database; it can be used for the interaction between the cloud database and the heterogeneous data source.
Description
技术领域technical field
本发明涉及计算机应用技术领域,特别涉及到一种基于REST架构的数据访问方法。The invention relates to the field of computer application technology, in particular to a data access method based on the REST architecture.
背景技术Background technique
在企业信息化建设过程中,由于各业务系统建设和实施数据管理系统的阶段性、技术性以及其它经济和人为因素的影响,导致企业在发展过程中积累了大量采用不同存储方式的业务数据。这些数据采用的数据管理系统大不相同,包括从简单的文件数据库到复杂的网络数据库,构成了企业的异构数据源。这些分散的不同业务的数据管理系统虽然能够满足业务数据存储和管理要求,但在许多情况下,企业领导要做出一项决策,往往需要查询多个基于各种异构数据源的业务系统和外部系统,进行大量数据分析后才能做出决策。In the process of enterprise informatization construction, due to the phased, technical, and other economic and human factors in the construction of various business systems and the implementation of data management systems, enterprises have accumulated a large amount of business data in different storage methods during the development process. The data management systems used for these data are quite different, ranging from simple file databases to complex network databases, which constitute the heterogeneous data sources of enterprises. Although these scattered data management systems of different businesses can meet the requirements of business data storage and management, in many cases, to make a decision, business leaders often need to query multiple business systems based on various heterogeneous data sources and The external system can only make decisions after analyzing a large amount of data.
因此,异构数据源的整合与集成是企业信息化建设过程经常遇到的一个现实问题,也是制约企业各种应用信息系统建设和数据共享程度,以及信息化建设投资重复或负担重的一个重要因素。Therefore, the integration and integration of heterogeneous data sources is a practical problem often encountered in the process of enterprise informatization construction, and it is also an important factor that restricts the construction of various application information systems and data sharing in enterprises, as well as the repeated investment or heavy burden of informatization construction. factor.
云数据库系统是进行异构数据源的整合与集成的重要方法。然而,如何实现云数据库与异构数据源的交互至关重要。Cloud database system is an important method for the integration and integration of heterogeneous data sources. However, how to realize the interaction between cloud database and heterogeneous data sources is very important.
发明内容Contents of the invention
本发明解决的技术问题在于提供一种基于REST架构的数据访问方法,可以有效的解决云数据库与异构数据源的交互问题。The technical problem solved by the present invention is to provide a data access method based on the REST architecture, which can effectively solve the problem of interaction between cloud databases and heterogeneous data sources.
本发明解决上述技术问题的技术方案是:The technical scheme that the present invention solves the problems of the technologies described above is:
采用RESTful JDBC协议与数据源进行交互,各个数据源通过RESTful JDBC协议接入到云数据库中来;所述的RESTful JDBC协议将传统的JDBC接口封装成RESTful JDBC接口;RESTful JDBC提供的接口与JDBC接口基本相同,接口的语义也与JDBC保持一致。The RESTful JDBC protocol is used to interact with data sources, and each data source is connected to the cloud database through the RESTful JDBC protocol; the RESTful JDBC protocol encapsulates the traditional JDBC interface into a RESTful JDBC interface; the interface provided by RESTful JDBC and the JDBC interface Basically the same, the semantics of the interface are also consistent with JDBC.
所述的RESTful JDBC协议有一实现的关键组件DS所述的DS是Wrapper与数据库之间的代理,Wrapper通过DS与数据库进行交互;对Wrapper来说,DS是一个服务端,对数据库而言,DS是一个客户端;Wrapper与DS采用RESTful JDBC协议,DS与数据库采用JDBC协议。The RESTful JDBC protocol has a key implementation component DS The DS It is the agent between Wrapper and database, and Wrapper passes DS Interact with the database; for Wrapper, DS Is a server, for the database, DS is a client; Wrapper and DS Using RESTful JDBC protocol, DS The JDBC protocol is adopted with the database.
实现Wrapper支持RESTful JDBC协议的方法是:The way to implement Wrapper to support RESTful JDBC protocol is:
在Wrapper下面增加一层协议管理器,用于两种协议的选择、切换;Add a layer of protocol manager under the Wrapper for the selection and switching of the two protocols;
或者,or,
为Wrapper增加一个RESTful JDBC版本。Add a RESTful JDBC version to Wrapper.
所述的DS支持专有模式和共享模式两种部署模式;The DS Support two deployment modes: dedicated mode and shared mode;
所述的专有模式,一个数据库独占一个DS此时,一个数据库和一个DS构成一个数据源;In the exclusive mode mentioned above, one database exclusively occupies one DS At this point, a database and a DS constitute a data source;
所述的共享模式,多个数据库共享一个DS此时,多个数据库与一个DS构成一个数据源。In the sharing mode mentioned above, multiple databases share one DS At this time, multiple databases and one DS constitute a data source.
所述的DS采用Jetty作为REST引擎,用Jetty来发布RESTful JDBC;支持对数据库地址及访问凭据的管理、对数据源地址及访问凭据的管理、数据源地址与数据库地址的准确映射、数据源的访问凭据与数据库的访问凭据的准确映射;支持线程池、数据库连接池的操作;前述各支持功能由DS2DB Manager负责实现。The DS Use Jetty as the REST engine, and use Jetty to publish RESTful JDBC; support the management of database addresses and access credentials, the management of data source addresses and access credentials, the accurate mapping of data source addresses and database addresses, and the access credentials of data sources and databases Accurate mapping of access credentials; support thread pool, database connection pool operations; the aforementioned support functions are implemented by DS2DB Manager.
本发明的方法有效的解决云数据库与异构数据源的交互问题;支持多种数据库系统(MySQL、Oracle、SQL Server、DB2)以及文件系统(Excel文件、KV文件)。The method of the present invention effectively solves the problem of interaction between cloud databases and heterogeneous data sources; supports multiple database systems (MySQL, Oracle, SQL Server, DB2) and file systems (Excel files, KV files).
附图说明Description of drawings
下面结合附图对本发明进一步说明:Below in conjunction with accompanying drawing, the present invention is further described:
图1是本发明的逻辑架构图;Fig. 1 is a logical architecture diagram of the present invention;
图2是本发明的部署模式图;Fig. 2 is a deployment mode diagram of the present invention;
图3是本发明的系统实现图。Fig. 3 is a system realization diagram of the present invention.
具体实施方式Detailed ways
数据源的REST化本质上将数据源接入协议的REST化,为数据源提供一种REST形式的访问接口。The RESTfulization of the data source is essentially the RESTfulization of the data source access protocol, providing a RESTful access interface for the data source.
目前,常用的数据源是各种关系数据库,提供JDBC的访问接口,与数据源的交互采用的是JDBC协议。REST化以后,我们将采用“RESTful JDBC协议”与数据源进行交互,各个数据源通过RESTful JDBC协议接入到云数据库中来。At present, commonly used data sources are various relational databases, which provide JDBC access interfaces, and the interaction with data sources uses the JDBC protocol. After REST, we will use the "RESTful JDBC protocol" to interact with data sources, and each data source is connected to the cloud database through the RESTful JDBC protocol.
如附图所示,RESTful JDBC协议将传统的JDBC接口封装成了REST API,即“RESTful JDBC接口”。RESTfulJDBC提供的接口与JDBC接口基本相同,接口的语义也与JDBC保持一致。例如,JDBC中提供了查询接口:As shown in the figure, the RESTful JDBC protocol encapsulates the traditional JDBC interface into a REST API, namely "RESTful JDBC interface". The interface provided by RESTfulJDBC is basically the same as the JDBC interface, and the semantics of the interface are also consistent with JDBC. For example, the query interface is provided in JDBC:
ResultSet executeQuery(String sql)ResultSet executeQuery(String sql)
那么在RESTful JDBC中也应该有一个相同的接口,具备相同的语义。不过,传统JDBC中提供的接口数据太多,这些接口不必在RESTful JDBC协议中一一实现,仅需要实现部分核心的接口即可。Then there should be the same interface in RESTful JDBC, with the same semantics. However, there are too many interface data provided in traditional JDBC, and these interfaces do not need to be implemented one by one in the RESTful JDBC protocol, only some core interfaces need to be implemented.
DS是实现RESTful JDBC协议的关键组件。DS是Wrapper与数据库之间的代理,Wrapper通过DS与数据库进行交互。对Wrapper来说,DS是一个服务端,对数据库而言,DS是一个客户端。Wrapper与DS采用RESTful JDBC协议,DS与数据库采用JDBC协议。DS It is a key component to implement the RESTful JDBC protocol. DS It is the agent between Wrapper and database, and Wrapper passes DS Interact with the database. For Wrapper, DS Is a server, for the database, DS is a client. Wrapper and DS Using RESTful JDBC protocol, DS The JDBC protocol is adopted with the database.
有了RESTful JDBC协议后,每一种数据源都支持两种方式与云数据库进行交互。系统中现有的Wrapper仅支持JDBC协议,无法满足需求。有两种方案可以解决该问题:With the RESTful JDBC protocol, each data source supports two ways to interact with the cloud database. The existing Wrapper in the system only supports the JDBC protocol, which cannot meet the requirements. There are two options to solve this problem:
1.在Wrapper下面增加一层协议管理器,用于两种协议的选择、切换。目前系统中Wrapper的实现紧耦合JDBC协议,这种方案可能会造成对现有Wrapper的实现修改的比较大。1. Add a layer of protocol manager under the Wrapper for the selection and switching of the two protocols. At present, the implementation of Wrapper in the system is tightly coupled with the JDBC protocol. This solution may cause relatively large modifications to the implementation of the existing Wrapper.
2.为Wrapper增加一个RESTful JDBC版本,比如,针对Oracle Wrapper,提供两个版本:JDBC版本和RESTful JDBC版本,JDBC版本通过JDBC协议与Oracle数据库交互,RESTful JDBC版本通过RESTful JDBC协议与Oracle数据库交互。这种方案会造成系统中现有Wrapper数量翻倍,好处是不用对现有的Wrapper的实现进行修改。2. Add a RESTful JDBC version to the Wrapper. For example, for Oracle Wrapper, two versions are provided: JDBC version and RESTful JDBC version. The JDBC version interacts with the Oracle database through the JDBC protocol, and the RESTful JDBC version interacts with the Oracle database through the RESTful JDBC protocol. This solution will double the number of existing Wrappers in the system, and the advantage is that there is no need to modify the implementation of the existing Wrappers.
依据“开闭设计原则”,综合考虑开发成本,采用第二种方案,为Wrapper增加一个RESTful JDBC版本。Based on the "Open and Close Design Principles" and comprehensively considering the development cost, the second solution is adopted to add a RESTful JDBC version to the Wrapper.
DS支持两种部署模式:DS Two deployment modes are supported:
1.专有模式:一个数据库独占一个DS此时,一个数据库和一个DS构成一个数据源。这种模式的好处是DS不会成为性能瓶颈,缺点是可能会造成系统中存在大量的DS实例,增加部署和管理的成本。1. Proprietary mode: one database exclusively occupies one DS At this point, a database and a DS constitute a data source. The benefit of this model is that DS It will not become a performance bottleneck, but the disadvantage is that there may be a large number of DSs in the system Instances increase deployment and management costs.
2.共享模式:多个数据库共享一个DS此时,多个数据库与一个DS构成一个数据源。这种模式的好处是系统中DS的实例比较少,缺点是DS可能会成为访问的性能瓶颈;2. Sharing mode: Multiple databases share one DS At this time, multiple databases and one DS constitute a data source. The advantage of this mode is that the DS in the system There are relatively few instances, and the disadvantage is that DS May become a performance bottleneck for access;
在实践中具体采用哪种部署模式,需要根据应用的需求,以及部署环境的约束来综合考虑。Which deployment mode to use in practice needs to be considered comprehensively according to the requirements of the application and the constraints of the deployment environment.
DS是实现该数据访问协议的核心组件,下面详细给出DS的具体实施方式。DS It is the core component to implement the data access protocol, and the DS is given in detail below specific implementation.
1.Jetty的实现是一款用Java实现、开源、基于标准的,并且具有丰富功能的Http服务器和Web容器,DS的实现采用Jetty作为REST引擎,用Jetty来发布RESTful JDBC。1. The implementation of Jetty is an open-source, standards-based, and rich-featured Http server and Web container implemented in Java. DS The implementation uses Jetty as the REST engine, and uses Jetty to publish RESTful JDBC.
2.支持对数据库地址及访问凭据的管理,例如:2. Support the management of database addresses and access credentials, for example:
a)数据库地址:jdbc:oracle:thin:192.168.1.100:1521:orcl;a) Database address: jdbc:oracle:thin:192.168.1.100:1521:orcl;
b)数据库访问凭据:访问Oracle数据库的用户名和密码;b) Database access credentials: user name and password for accessing the Oracle database;
数据库的地址和访问凭据由数据库的用户自行加以配置,数据库的地址和访问凭据对云数据库是不可见的。数据库的访问凭据需要进行加密存储,以防止在多个数据库共享一个DS的模式时,泄露数据库的用户名和密码;The database address and access credentials are configured by the database users themselves, and the database address and access credentials are invisible to the cloud database. Database access credentials need to be stored encrypted to prevent multiple databases from sharing a DS In the mode, the user name and password of the database are leaked;
3.支持对数据源地址及访问凭据的管理,3. Support the management of data source addresses and access credentials,
a)数据源地址:rest:oracle192.168.1.100:8080/orcl;a) Data source address: rest:oracle192.168.1.100:8080/orcl;
b)数据源的访问凭据:通过RESTful JDBC协议访问数据源的用户名和密码,与访问数据库的用户和密码不同;b) Access credentials of the data source: the user name and password for accessing the data source through the RESTful JDBC protocol are different from the user and password for accessing the database;
数据源的地址和访问凭据由数据库的用户自行加以配置,数据源的地址和访问凭据对云数据库不可见的。数据源的访问凭据需要进行加密存储,以防止在多个数据库共享一个DS的模式时,泄露数据源的用户名和密码;The address and access credentials of the data source are configured by the database user, and the address and access credentials of the data source are invisible to the cloud database. The access credentials of the data source need to be encrypted and stored to prevent multiple databases from sharing a DS In the case of the mode, the user name and password of the data source are leaked;
4.支持数据源地址与数据库地址的准确映射,支持数据源的访问凭据与数据库的访问凭据的准确映射;4. Support accurate mapping of data source address and database address, support accurate mapping of data source access credentials and database access credentials;
5.支持线程池、数据库连接池的操作,以防止DS成为性能瓶颈;DS2DB Manager主要负责实现上述2、3、4项功能。5. Support the operation of thread pool and database connection pool to prevent DS Become a performance bottleneck; DS2DB Manager is mainly responsible for realizing the above 2, 3, and 4 functions.
Claims (6)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201410378381.7A CN104166699B (en) | 2014-08-03 | 2014-08-03 | A kind of data access method based on REST frameworks |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201410378381.7A CN104166699B (en) | 2014-08-03 | 2014-08-03 | A kind of data access method based on REST frameworks |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN104166699A true CN104166699A (en) | 2014-11-26 |
| CN104166699B CN104166699B (en) | 2017-03-15 |
Family
ID=51910512
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201410378381.7A Active CN104166699B (en) | 2014-08-03 | 2014-08-03 | A kind of data access method based on REST frameworks |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN104166699B (en) |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN106789978A (en) * | 2016-12-07 | 2017-05-31 | 高新兴科技集团股份有限公司 | A kind of convergence system and method |
| CN111367199A (en) * | 2018-12-26 | 2020-07-03 | 中国科学院沈阳自动化研究所 | A digital meter configuration method based on REST function encapsulation |
Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20070198482A1 (en) * | 2006-02-21 | 2007-08-23 | International Business Machines Corporation | Dynamic data formatting during transmittal of generalized byte strings, such as XML or large objects, across a network |
| CN103220285A (en) * | 2013-04-10 | 2013-07-24 | 中国科学技术大学苏州研究院 | Access system based on RESTful interface in ubiquitous service environment |
| CN103605698A (en) * | 2013-11-06 | 2014-02-26 | 广东电子工业研究院有限公司 | Cloud database system used for distributed heterogeneous data resource integration |
-
2014
- 2014-08-03 CN CN201410378381.7A patent/CN104166699B/en active Active
Patent Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20070198482A1 (en) * | 2006-02-21 | 2007-08-23 | International Business Machines Corporation | Dynamic data formatting during transmittal of generalized byte strings, such as XML or large objects, across a network |
| CN103220285A (en) * | 2013-04-10 | 2013-07-24 | 中国科学技术大学苏州研究院 | Access system based on RESTful interface in ubiquitous service environment |
| CN103605698A (en) * | 2013-11-06 | 2014-02-26 | 广东电子工业研究院有限公司 | Cloud database system used for distributed heterogeneous data resource integration |
Non-Patent Citations (3)
| Title |
|---|
| VAL HUBER: "RESTify your SQL Data", 《HTTPS://DZONE.COM/ARTICLES/RESTIFY-YOUR-SQL-DATA》 * |
| YI XIE ET AL: "A Simple and Efficient Parallel Approach to Large-Scale Railway Freight Data Analysis", 《2010 12TH IEEE INTERNATIONAL CONFERENCE ON HIGH PERFORMANCE COMPUTING AND COMMUNICATIONS》 * |
| 孟健等: "一种基于REST服务和Mashup的分布式商品信息集成模型", 《现代图书情报技术》 * |
Cited By (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN106789978A (en) * | 2016-12-07 | 2017-05-31 | 高新兴科技集团股份有限公司 | A kind of convergence system and method |
| CN111367199A (en) * | 2018-12-26 | 2020-07-03 | 中国科学院沈阳自动化研究所 | A digital meter configuration method based on REST function encapsulation |
| CN111367199B (en) * | 2018-12-26 | 2021-04-06 | 中国科学院沈阳自动化研究所 | A digital meter configuration method based on REST function encapsulation |
Also Published As
| Publication number | Publication date |
|---|---|
| CN104166699B (en) | 2017-03-15 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US11886429B2 (en) | Persistent metadata catalog | |
| US10019383B2 (en) | Rotatable-key encrypted volumes in a multi-tier disk partition system | |
| CN104160381B (en) | Managing method and system for tenant-specific data sets in a multi-tenant environment | |
| CN107315776B (en) | A data management system based on cloud computing | |
| TWI706259B (en) | Data query method and query device | |
| US9355135B2 (en) | Data movement from a database to a distributed file system | |
| US20170277769A1 (en) | Techniques to manage time-varying cluster configuration information | |
| US20160267155A1 (en) | Virtualization method for large-scale distributed heterogeneous data | |
| CN103605698A (en) | Cloud database system used for distributed heterogeneous data resource integration | |
| US9201700B2 (en) | Provisioning computer resources on a network | |
| WO2016101301A1 (en) | Objectification and virtualization mechanism for mode of relational database table | |
| US9922101B1 (en) | Coordinated configuration, management, and access across multiple data stores | |
| CN103425762A (en) | Telecom operator mass data processing method based on Hadoop platform | |
| US20130159339A1 (en) | Data Container Access in a Database System | |
| CN108268614B (en) | A distributed management method for spatial data of forest resources | |
| US20180032582A1 (en) | Cross object synchronization | |
| CN104239532A (en) | Method and device for self-making user extraction information tool in Hive | |
| CN109063061B (en) | Cross-distributed system data processing method, device, equipment and storage medium | |
| CN104461929B (en) | Distributed data cache method based on blocker | |
| US20180210950A1 (en) | Distributed file system with tenant file system entity | |
| US20160210273A1 (en) | In-memory workspace management | |
| CN104166699B (en) | A kind of data access method based on REST frameworks | |
| Choi et al. | Improving Database System Performance by Applying NoSQL. | |
| CN107408239B (en) | Architecture for massive data management in communication applications through multiple mailboxes | |
| CN107409086B (en) | Mass data management in communication applications through multiple mailboxes |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| C06 | Publication | ||
| PB01 | Publication | ||
| C10 | Entry into substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| C14 | Grant of patent or utility model | ||
| GR01 | Patent grant |