Method and system for C / C++ application program accessing database on ARM platform
By deploying proxy clients and servers on the ARM platform, the process of converting the ODBC interface into a JDBC interface is realized, which solves the complexity problem of C/C++ applications accessing non-ARM platform databases on the ARM platform, reduces development difficulty and improves flexibility.
Patent Information
- Application Number
- CN202011347050.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-26
- Publication Date
- 2024-10-11
- Estimated Expiration
- 2040-11-26
AI Technical Summary
In the existing technology, connecting ODBC to JDBC through JNI is difficult to implement and poses high problems to the stability and debugging complexity of C/C++ applications, especially when accessing non-ARM platform databases on the ARM platform.
Deploy the proxy client and proxy server on the ARM platform. The proxy client converts the database access request into an ODBC data type, and the proxy server parses and calls the target JDBC client to access the target database, thereby converting the ODBC interface into a JDBC interface. process, reducing development difficulty and improving flexibility.
There is no need to develop a program to convert the ODBC interface into a JDBC interface for each C/C++ application, which simplifies the development process. JDBC clients of multiple database types are deployed on the proxy server to achieve flexible connections with different types of databases.
Smart Images

Figure CN112364087B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of software development, and in particular relates to a method and system for a C / C++ application program of an ARM platform to access a database. Background Art
[0002] With the development and application of servers based on ARM architecture, servers based on ARM architecture are gradually replacing servers based on X86 architecture.
[0003] In the basic software development environment provided by the ARM architecture, application systems with source code and major open source system components can be recompiled and ported to the ARM architecture. In large-scale enterprise IT application environments, applications are ported from the X86 architecture to the ARM architecture. Since it takes a long time to migrate the database connected to other databases before the application is ported, if the C / C++ application is ported from the X86 platform to the ARM platform first, the problem of the ARM platform C / C++ application accessing the non-ARM platform database must be solved.
[0004] The current solution is to use the Open Database Connectivity (ODBC) interface in C / C++ applications, and use the Java Native Interface (JNI) to bridge ODBC to the Java Database Connectivity (JDBC) to achieve direct database connection. Compared with JDBC, the ODBC interface definition is more fine-grained, and the interface mapping and implementation are difficult; moreover, it affects the stability of the original C / C++ application, and the program debugging is more complicated, requiring high debugging skills of the debugger. Summary of the invention
[0005] In view of this, the purpose of the present invention is to provide a method and system for C / C++ application programs on an ARM platform to access a database, so as to solve the technical problem that the traditional solution is difficult to connect ODBC to JDBC through JNI and has an impact on C / C++ applications. The specific technical solution is as follows:
[0006] On the one hand, the present invention provides a method for a C / C++ application of an ARM platform to access a database, wherein a proxy client is deployed in the C / C++ application of the ARM platform, and a proxy server is deployed on a server based on the ARM platform, and the method comprises:
[0007] The C / C++ application generates a database access request, and calls a proxy client deployed in the C / C++ application to send the database access request;
[0008] The proxy client sends the database access request to the proxy server;
[0009] The proxy server parses the database access request and calls a target JDBC client to access a target type database to obtain a corresponding database execution result, wherein the target type database is a database requested to be accessed by the C / C++ application program, and the target JDBC client is a JDBC client corresponding to the target type database;
[0010] The proxy server returns the obtained database execution result to the proxy client, and the proxy client returns the database execution result to the C / C++ application.
[0011] Optionally, calling a proxy client deployed in a C / C++ application to send the database access request includes:
[0012] The C / C++ application calls the proxy ODBC driver module deployed in the C / C++ application to convert the database data type in the generated database access request into the corresponding ODBC data type;
[0013] The proxy ODBC driver module calls the proxy client through a library connection, and forwards the database access request converted into an ODBC data type to the proxy client.
[0014] Optionally, a proxy server, a JDBC backend function proxy module and a JDBC client are deployed in the proxy server;
[0015] The proxy server parses the database access request and calls the target JDBC client to access the target type database to obtain the corresponding database execution result, including:
[0016] The proxy server parses the database access request to obtain a target type database that the C / C++ application program requires to access;
[0017] The proxy server calls a JDBC backend function proxy module deployed in the proxy server and corresponding to the target type database to pre-process the database access request;
[0018] The JDBC backend function proxy module calls the JDBC client corresponding to the target type database to parse the preprocessed database access request;
[0019] The JDBC client accesses the target type database according to the parsing result and obtains the corresponding database execution result.
[0020] Optionally, the proxy server calls a JDBC backend function proxy module deployed in the proxy server and corresponding to the target type database to pre-process the database access request, including:
[0021] The JDBC backend function proxy module parses the interface operation and request parameters in the database access request;
[0022] The JDBC backend function proxy module converts the database access request into a corresponding JDBC operation according to the interface operation and the request parameter.
[0023] Optionally, the proxy server returns the obtained database execution result to the proxy client, including:
[0024] The JDBC client receives the database execution result returned by the target type database, and calls the JDBC backend function proxy module to interpret the database execution result;
[0025] The JDBC backend function proxy module returns the parsing result to the proxy server;
[0026] The proxy server sends the parsing result of the database execution result to the proxy client.
[0027] On the other hand, the present invention also provides a system for a C / C++ application program on an ARM platform to access a database, comprising: a C / C++ application program deployed on the ARM platform, and a proxy server deployed on the ARM platform, wherein a proxy client is deployed in the C / C++ application program;
[0028] The C / C++ application is used to generate a database access request, and call a proxy client deployed in the C / C++ application to send the database access request, and the proxy client sends the database access request to the proxy server;
[0029] The proxy server is used to parse the database access request, call the target JDBC client deployed in the proxy server to access the target type database, obtain the corresponding database execution result, and return the database execution result to the proxy client, and the proxy client returns the database execution result to the C / C++ application;
[0030] The target type database is a database that the C / C++ application requests to access, and the target JDBC client is a JDBC client corresponding to the target type database.
[0031] Optionally, when the C / C++ application program calls a proxy client deployed in the C / C++ application program to send the database access request, it is specifically used to:
[0032] The C / C++ application calls the proxy ODBC driver module deployed in the C / C++ application to convert the database data type in the generated database access request into the corresponding ODBC data type;
[0033] The proxy ODBC driver module calls the proxy client through a library connection, and forwards the database access request converted into an ODBC data type to the proxy client.
[0034] Optionally, a proxy server, a JDBC backend function proxy module and a JDBC client are deployed in the proxy server;
[0035] The proxy server is used to parse the database access request and call the target JDBC client to access the target type database, and obtain the corresponding database execution result, specifically used to:
[0036] The proxy server parses the database access request to obtain a target type database that the C / C++ application program requires to access;
[0037] The proxy server calls a JDBC backend function proxy module deployed in the proxy server and corresponding to the target type database to pre-process the database access request;
[0038] The JDBC backend function proxy module calls the JDBC client corresponding to the target type database to parse the preprocessed database access request;
[0039] The JDBC client accesses the target type database according to the parsing result and obtains the corresponding database execution result.
[0040] Optionally, the proxy server calls a JDBC backend function proxy module deployed in the proxy server and corresponding to the target type database to pre-process the database access request, specifically for:
[0041] The JDBC backend function proxy module parses the interface operation and request parameters in the database access request;
[0042] The JDBC backend function proxy module converts the database access request into a corresponding JDBC operation according to the interface operation and the request parameter.
[0043] Optionally, when the proxy server returns the obtained database execution result to the proxy client, it is specifically used to:
[0044] The JDBC client receives the database execution result returned by the target type database, and calls the JDBC backend function proxy module to interpret the database execution result;
[0045] The JDBC backend function proxy module returns the parsing result to the proxy server;
[0046] The proxy server sends the parsing result of the database execution result to the proxy client.
[0047] The method for accessing a database by a C / C++ application of an ARM platform provided by the present invention deploys a proxy client in the C / C++ application, and the proxy client sends a database access request generated by the C / C++ application to a proxy server, and the proxy server is deployed on a server based on the ARM platform. The C / C++ application uses an ODBC interface, and the C / C++ application needs to use a JDBC client corresponding to the corresponding database that is independent of the platform to access the database, and the proxy server completes the process of converting the ODBC interface to the JDBC interface. Using this solution, there is no need to develop a corresponding ODBC interface to JDBC interface program for each C / C++ application, thereby reducing the difficulty of development, and JDBC clients corresponding to a variety of different database types can be deployed on the proxy server to achieve connection with different types of databases, thereby improving flexibility. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0049] Figure 1 It is a schematic diagram showing the structure of a system for a C / C++ application program on an ARM platform to access a database provided by an embodiment of the present invention;
[0050] Figure 2 It is a signaling diagram of a method for a C / C++ application program on an ARM platform to access a database provided by an embodiment of the present invention;
[0051] Figure 3 The present invention provides a flowchart of a proxy server converting a database access request into an operation based on a JDBC interface. DETAILED DESCRIPTION
[0052] There are usually two ways for a C / C++ application to access a database: one is that the C / C++ application directly calls the C / C++ client interface library provided by the database to access the database; the other is that the C / C++ application calls the ODBC driver provided by the database through the ODBC interface, and the ODBC driver then calls the C / C++ client interface library provided by the database to access the database. Both of these methods require the database to provide a C / C++ client interface library, and if the database does not provide a C / C++ client interface library, the C / C++ application cannot access the database. In order to solve this technical problem, the present invention provides an access method and system for a C / C++ application to access a database, and the function of converting the ODBC interface to a JDBC interface is deployed on the proxy server.
[0053] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0054] See also Figure 1 , shows a schematic diagram of the structure of a system for a C / C++ application program on an ARM platform to access a database provided by an embodiment of the present invention.
[0055] like Figure 1 As shown, the system includes a C / C++ application 1 and a proxy server 2. The C / C++ application 1 is deployed on an ARM platform, and the proxy server 2 is built based on an ARM architecture.
[0056] A proxy client is deployed on the C / C++ application 1. The C / C++ application 1 generates a database access request and calls the proxy client to send the database access request to the proxy server.
[0057] The proxy server 2 is used to parse the database access request, and call the target JDBC client deployed in the proxy server to access the target type database, obtain the corresponding database execution result, and return the database execution result to the proxy client, and the proxy client returns the database execution result to the C / C++ application.
[0058] The target type database is a database that the C / C++ application requests to access, and the target JDBC client is a JDBC client corresponding to the target type database.
[0059] Deploy the proxy client and proxy ODBC modules in C / C++ applications.
[0060] After the C / C++ application generates a database access request, it calls the proxy ODBC driver, and the proxy ODBC driver calls the proxy client to send the database access request to the proxy server.
[0061] In addition, ODBC / OCI Template Library (OTL) and unixODBC interface are also deployed in C / C++ applications.
[0062] The C / C++ application calls the proxy client through the OTL, unixODBC interface and the proxy ODBC driver module layer by layer, that is, forwards the database access request generated by the C / C++ application to the proxy client.
[0063] The proxy server deployed in the proxy server 2 is mainly used to realize the function of converting the ODBC interface into the JDBC interface. The proxy server 2 also has a JDBC back-end function proxy module and a JDBC client deployed therein.
[0064] The proxy client and the proxy server communicate using the TCP / IP network protocol. After receiving the database access request (request based on the ODBC interface) sent by the proxy client, the proxy server calls the JDBC backend functional proxy module corresponding to the database type to be accessed to preprocess the database access request; the JDBC backend functional proxy module calls the JDBC client corresponding to the target type database to parse the preprocessed database access request. The JDBC client accesses the target type database based on the parsing result and obtains the corresponding database execution result.
[0065] In one embodiment of the present application, the proxy server calls the JDBC backend function proxy module deployed in the proxy server 2 and corresponding to the target type database to pre-process the database access request, specifically for:
[0066] The JDBC backend function proxy module parses the interface operation and request parameters in the database access request;
[0067] The JDBC back-end function proxy module converts the database access request into a corresponding JDBC operation according to the interface operation and the request parameter.
[0068] In another embodiment of the present application, when the proxy server returns the obtained database execution result to the proxy client, it is specifically used to:
[0069] The JDBC client receives the database execution result returned by the target type database, and calls the JDBC backend function proxy module to interpret the database execution result.
[0070] The JDBC backend function proxy module returns the parsing result to the proxy server.
[0071] The proxy server sends the parsing result of the database execution result to the proxy client.
[0072] The system provided in this embodiment does not need to develop a corresponding ODBC interface to JDBC interface program for each C / C++ application, thereby reducing the development difficulty. Moreover, JDBC clients corresponding to various database types can be deployed on the proxy server to achieve connections with different types of databases, thereby improving flexibility.
[0073] See also Figure 2 , shows a signaling diagram of a method for a C / C++ application on an ARM platform to access a non-ARM platform database provided by an embodiment of the present invention, the method is applied to Figure 1 In the system shown. Figure 2 As shown, the method mainly includes the following steps:
[0074] S110, the C / C++ application generates a database access request, and calls a proxy client deployed in the C / C++ application to send the database access request.
[0075] like Figure 1 As shown, a proxy client is deployed in the C / C++ application. In addition, OTL, unixODBC interface and proxy ODBC driver modules are deployed in the C / C++ application.
[0076] based on Figure 1 The system shown in S110 can be implemented by the following steps:
[0077] The C / C++ application accesses the database based on the interface provided by OTL, and selects ODBC as the connection method; OTL calls the standard unixODBC interface, and the unixODBC interface calls the proxy ODBC driver module; the proxy ODBC driver module calls the proxy client through the library connection.
[0078] In one embodiment of the present invention, the proxy ODBC driver module implements a standard ODBC API interface, and the specific interface is defined by the ODBC interface specification.
[0079] The proxy ODBC driver module is mainly used to call the proxy client to implement the ODBC interface function. Moreover, the proxy ODBC driver module performs type adaptation and conversion on the database type in the database access request before calling the proxy client. In addition, after the proxy client returns the corresponding database execution result, the proxy ODBC driver module performs type adaptation and conversion on the database execution result.
[0080] For example, taking the Oracle database as an example, the ODBC driver module supports the following mapping relationships between ODBC data types and Oracle data types as shown in Table 1:
[0081] Table 1
[0082] ODBC Data Type Oracle Data Type SQL_BIGINT NUMBER(19,0) SQL_BINARY BLOB SQL_CHAR CHAR SQL_DATE DATE SQL_DECIMAL(p,s) NUMBER(p,s) SQL_DOUBLE FLOAT(49) SQL_FLOAT FLOAT(49) SQL_INTEGER NUMBER(10) SQL_LONGVARBINARY BLOB SQL_LONGVARCHAR CLOB SQL_NUMERIC(p,s) NUMBER(p,s) SQL_REAL FLOAT(23) SQL_SMALLINT NUMBER(5) SQL_TIME DATE SQL_TIMESTAMP TIMESTAMP SQL_TINYINT NUMBER(3) SQL_VARCHAR VARCHAR2
[0083] The C / C++ application calls the proxy client layer by layer through OTL, unixODBC interface and proxy ODBC driver module. The C / C++ application forwards the database access request to the proxy server by calling the proxy client.
[0084] S120, the proxy client sends a database access request to the proxy server.
[0085] The proxy client sends the database access request to the proxy server through the TCP / IP network protocol. The proxy server is a Java program that can run on a server based on the ARM architecture.
[0086] A session-based stateful remote procedure call (RPC) structure is implemented between the proxy client and the proxy server to implement proxy forwarding of ODBC requests (ie, database access requests).
[0087] The proxy client can be implemented based on the mature RPC framework ApacheThrift C / C++. The proxy server can be implemented using the mature RPC framework ApacheThrift Java. The RPC interface definition is shown in Table 2:
[0088] Table 2
[0089] RPC interface definition package Package Contents odbcrpc.idl Total client request / server response message packet definition odbcrpc_datatypes.idl Data Type Definition odbcrpc_connection.idl Connection and session definitions odbcrpc_crud.idl Basic SQL operation interface definition odbcrpc_procedure.idl Stored procedure and function operation interface definition odbcrpc_prepared.idl Prepared Statement Interface Definition odbcrpc_resultset.idl Result set operation interface definition odbcrpc_schema.idl Metadata Operation Interface Definition
[0090] S130, the proxy server parses the database access request, and calls the target JDBC client to access the target type database, and obtains the corresponding database execution result.
[0091] The target type database is the database that the C / C++ application requests to access. Different types of databases correspond to different JDBC clients, and the target JDBC client is the JDBC client corresponding to the target type database. In one embodiment of the present application, Figure 1 As shown, a proxy server, a JDBC back-end function proxy module and a JDBC client are deployed in the proxy server. The proxy server calls the JDBC back-end function proxy module corresponding to the target type database to preprocess the database access request; the JDBC back-end function proxy module calls the JDBC client corresponding to the target type database to process the preprocessed database access request to complete the operation on the target type database.
[0092] S140, the proxy server returns the obtained database execution result to the proxy client, and the proxy client returns the database execution result to the C / C++ application.
[0093] Furthermore, after receiving the execution result returned by the database, the JDBC client calls the JDBC back-end function proxy module to parse the execution result. Then, the JDBC back-end function proxy module returns the parsed result to the proxy server. The proxy server then returns the database execution result to the proxy client, and the proxy client returns it to the C / C++ application.
[0094] The method provided in this embodiment for a C / C++ application of an ARM platform to access a non-ARM platform database is to deploy a proxy client in the C / C++ application, and to send the database access request generated by the C / C++ application to the proxy server through the proxy client. The proxy server is deployed in a server based on the ARM platform. The C / C++ application implements the ODBC interface by calling the proxy client. The proxy server completes the process of converting the ODBC interface to the JDBC interface. Using this solution, there is no need to develop a corresponding ODBC interface to JDBC interface program for each C / C++ application, thereby reducing the difficulty of development. Moreover, JDBC clients corresponding to a variety of different database types can be deployed on the proxy server to achieve connections with different types of databases, thereby improving the flexibility of the method.
[0095] In one embodiment of the present invention, a proxy server is deployed with a proxy server, a JDBC backend function proxy module, and a JDBC client. Figure 3 As shown, S130 includes the following steps:
[0096] S131, the proxy server parses the database access request and obtains the target type database that the C / C++ application program requires to access.
[0097] The proxy server parses the database access request to obtain the database type that the C / C++ application wants to access. The database of this type is the target type database.
[0098] S132, the proxy server calls a JDBC backend function proxy module deployed in the proxy server and corresponding to the target type database to pre-process the database access request.
[0099] Different types of databases correspond to different JDBC backend function proxy modules. For example, Oracle database corresponds to OracleJDBC backend function proxy module.
[0100] The proxy server calls the JDBC backend function proxy module corresponding to the target type database to perform the following preprocessing process on the received database access request:
[0101] The JDBC backend function proxy module parses the interface operations and request parameters in the database access request, and converts the database access request sent by the proxy client into the corresponding JDBC operation according to the interface operations and request parameters.
[0102] S133, the JDBC backend function proxy module calls the JDBC client corresponding to the target type database to process the preprocessed database access request.
[0103] The JDBC backend proxy module calls the JDBC client corresponding to the target type database to complete the access operation to the target type database.
[0104] For example, taking Oracle database as an example, the JDBC backend function proxy module parses the database access request and converts the database access request into a corresponding JDBC operation, and then the JDBC backend function proxy module calls the OracleJDBC client to complete the access to the Oracle database.
[0105] Still taking Oracle database as an example, the JDBC backend function proxy module can simultaneously implement the following key database access features for Oracle database:
[0106] 1) Support backend database prepared statements (PreparedStatement);
[0107] 2) Support backend database connection pool;
[0108] 3) Support variable-length character encoding (8-bit Unicode Transformation Format, UTF-8) character set for Unicode, as well as the adaptation and conversion between UTF-8 character set and different character sets;
[0109] 4) Complete support and adaptation for Oracle data types;
[0110] 5) Full support for Oracle stored procedure calling methods;
[0111] 6) Full support for Oracle cursor functions.
[0112] S134, the JDBC client parses the preprocessed database access request, and accesses the target type database according to the parsing result to obtain the corresponding database execution result.
[0113] The JDBC backend function proxy module calls the JDBC client to parse the JDBC operation. Then, the JDBC client completes the access to the database according to the JDBC operation and obtains the execution result returned by the database.
[0114] The proxy server provided in this embodiment converts ODBC-based operations into JDBC operations. Through the JDBC back-end function proxy module, it can adapt to the differences between different types of back-end database interfaces and usages, thereby expanding the range of databases that the method can adapt to, that is, improving the scope of application of the method.
[0115] The present application provides a terminal device, which includes a processor and a memory, wherein the memory stores a program that can be run on the processor. When the processor runs the program stored in the memory, the steps executed by the C / C++ application in any of the above-mentioned ARM platform C / C++ application access database method embodiments are implemented. The terminal device in this article can be a PC, a PAD, a mobile phone, etc.
[0116] The embodiment of the present invention provides a device, the device includes a processor, a memory and a program stored in the memory and can be run on the processor, and when the processor executes the program, the steps executed by the proxy server in the embodiment of the method for accessing a database by a C / C++ application program on the ARM platform are implemented. The proxy server in this article can be a server based on the ARM architecture.
[0117] The present application also provides a storage medium executable by a computing device, in which a program is stored. When the program is executed by the computing device, the method for a C / C++ application of an ARM platform to access a non-ARM platform database is implemented.
[0118] For the above-mentioned method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should know that the present invention is not limited by the order of the actions described, because according to the present invention, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.
[0119] It should be noted that each embodiment in this specification is described in a progressive manner, and the technical features in each embodiment can be combined and replaced with each other, and the same and similar parts between the embodiments can be referred to each other. For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0120] The steps in the methods of the embodiments of the present application can be adjusted in order, combined, and deleted according to actual needs.
[0121] The modules and sub-modules in the devices and terminals in the embodiments of the present application can be combined, divided and deleted according to actual needs.
[0122] In the several embodiments provided in the present application, it should be understood that the disclosed terminals, devices and methods can be implemented in other ways. For example, the terminal embodiments described above are only schematic, for example, the division of modules or submodules is only a logical function division, and there may be other division methods in actual implementation, for example, multiple submodules or modules can be combined or integrated into another module, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or modules, which can be electrical, mechanical or other forms.
[0123] The modules or submodules described as separate components may or may not be physically separated, and the components of the modules or submodules may or may not be physical modules or submodules, that is, they may be located in one place, or they may be distributed on multiple network modules or submodules. Some or all of the modules or submodules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0124] In addition, each functional module or submodule in each embodiment of the present application may be integrated into one processing module, or each module or submodule may exist physically separately, or two or more modules or submodules may be integrated into one module. The above-mentioned integrated modules or submodules may be implemented in the form of hardware or in the form of software functional modules or submodules.
[0125] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0126] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
[0127] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A method for a C / C++ application on an ARM platform to access a database. It is characterized in that A proxy client is deployed in a C / C++ application on an ARM platform, and a proxy server is deployed on a proxy server based on the ARM platform. The method includes: The C / C++ application generates a database access request, and calls a proxy client deployed in the C / C++ application to send the database access request; The proxy client sends the database access request to the proxy server; The proxy server parses the database access request and calls a target JDBC client to access a target type database to obtain a corresponding database execution result, wherein the target type database is a database requested to be accessed by the C / C++ application program, and the target JDBC client is a JDBC client corresponding to the target type database; The proxy server returns the obtained database execution result to the proxy client, and the proxy client returns the database execution result to the C / C++ application; The step of calling the proxy client deployed in the C / C++ application to send the database access request includes: The C / C++ application calls the proxy ODBC driver module deployed in the C / C++ application to convert the database data type in the generated database access request into the corresponding ODBC data type; The proxy ODBC driver module calls the proxy client through a library connection, and forwards the database access request converted into an ODBC data type to the proxy client.
2. A method for a C / C++ application on an ARM platform to access a database. It is characterized in that A proxy client is deployed in a C / C++ application on an ARM platform, and a proxy server is deployed on a proxy server based on the ARM platform. The method includes: The C / C++ application generates a database access request, and calls a proxy client deployed in the C / C++ application to send the database access request; The proxy client sends the database access request to the proxy server; The proxy server parses the database access request and calls a target JDBC client to access a target type database to obtain a corresponding database execution result, wherein the target type database is a database requested to be accessed by the C / C++ application program, and the target JDBC client is a JDBC client corresponding to the target type database; The proxy server returns the obtained database execution result to the proxy client, and the proxy client returns the database execution result to the C / C++ application; Among them, the proxy server is deployed with a proxy server, a JDBC backend function proxy module and a JDBC client; The proxy server parses the database access request and calls the target JDBC client to access the target type database to obtain the corresponding database execution result, including: The proxy server parses the database access request to obtain a target type database that the C / C++ application program requires to access; The proxy server calls a JDBC backend function proxy module deployed in the proxy server and corresponding to the target type database to pre-process the database access request; The JDBC backend function proxy module calls the JDBC client corresponding to the target type database to parse the preprocessed database access request; The JDBC client accesses the target type database according to the parsing result and obtains the corresponding database execution result.
3. The method according to claim 2, It is characterized in that The proxy server calls a JDBC backend function proxy module deployed in the proxy server and corresponding to the target type database to pre-process the database access request, including: The JDBC backend function proxy module parses the interface operation and request parameters in the database access request; The JDBC backend function proxy module converts the database access request into a corresponding JDBC operation according to the interface operation and the request parameter.
4. The method according to claim 3, It is characterized in that The proxy server returns the obtained database execution result to the proxy client, including: The JDBC client receives the database execution result returned by the target type database, and calls the JDBC backend function proxy module to parse the database execution result; The JDBC backend function proxy module returns the parsing result to the proxy server; The proxy server sends the parsing result of the database execution result to the proxy client.
5. A system for C / C++ applications on ARM platform to access databases. It is characterized in that include: A C / C++ application program deployed on an ARM platform, and a proxy server deployed on an ARM platform, wherein a proxy client is deployed in the C / C++ application program; The C / C++ application is used to generate a database access request, and call a proxy client deployed in the C / C++ application to send the database access request, and the proxy client sends the database access request to the proxy server; The proxy server is used to parse the database access request, call the target JDBC client deployed in the proxy server to access the target type database, obtain the corresponding database execution result, and return the database execution result to the proxy client, and the proxy client returns the database execution result to the C / C++ application; Wherein, the target type database is the database that the C / C++ application requests to access, and the target JDBC client is the JDBC client corresponding to the target type database; When the C / C++ application program calls the proxy client deployed in the C / C++ application program to send the database access request, it is specifically used to: The C / C++ application calls the proxy ODBC driver module deployed in the C / C++ application to convert the database data type in the generated database access request into the corresponding ODBC data type; The proxy ODBC driver module calls the proxy client through a library connection, and forwards the database access request converted into an ODBC data type to the proxy client.
6. A system for C / C++ applications on ARM platform to access databases. It is characterized in that include: A C / C++ application program deployed on an ARM platform, and a proxy server deployed on an ARM platform, wherein a proxy client is deployed in the C / C++ application program; The C / C++ application is used to generate a database access request, and call a proxy client deployed in the C / C++ application to send the database access request, and the proxy client sends the database access request to the proxy server; The proxy server is used to parse the database access request, call the target JDBC client deployed in the proxy server to access the target type database, obtain the corresponding database execution result, and return the database execution result to the proxy client, and the proxy client returns the database execution result to the C / C++ application; Wherein, the target type database is the database that the C / C++ application requests to access, and the target JDBC client is the JDBC client corresponding to the target type database; Among them, the proxy server is deployed with a proxy server, a JDBC backend function proxy module and a JDBC client; The proxy server is used to parse the database access request and call the target JDBC client to access the target type database, and obtain the corresponding database execution result, specifically used to: The proxy server parses the database access request to obtain a target type database that the C / C++ application program requires to access; The proxy server calls a JDBC backend function proxy module deployed in the proxy server and corresponding to the target type database to pre-process the database access request; The JDBC backend function proxy module calls the JDBC client corresponding to the target type database to parse the preprocessed database access request; The JDBC client accesses the target type database according to the parsing result and obtains the corresponding database execution result.
7. The system according to claim 6, It is characterized in that The proxy server calls the JDBC backend function proxy module deployed in the proxy server and corresponding to the target type database to pre-process the database access request, specifically for: The JDBC backend function proxy module parses the interface operation and request parameters in the database access request; The JDBC backend function proxy module converts the database access request into a corresponding JDBC operation according to the interface operation and the request parameter.
8. The system according to claim 7, It is characterized in that When the proxy server returns the obtained database execution result to the proxy client, it is specifically used to: The JDBC client receives the database execution result returned by the target type database, and calls the JDBC backend function proxy module to parse the database execution result; The JDBC backend function proxy module returns the parsing result to the proxy server; The proxy server sends the parsing result of the database execution result to the proxy client.
