JDBC connection configuration inspection method and device, equipment, medium and program product
By analyzing the Java virtual machine environment and database interaction framework, obtaining JDBC URLs, and checking based on preconfiguration policies, the problem of not being able to automatically check JDBC URL configuration in the existing technology is solved, and efficient and automatic configuration check is achieved.
Patent Information
- Application Number
- CN202411953779.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-27
- Publication Date
- 2025-04-01
AI Technical Summary
The existing technology cannot automatically check the effectiveness of JDBC URL configuration, resulting in developers being prone to missing or misscan during code submission and repository scanning, increasing costs and difficulty.
By getting the interactive framework type between the Java virtual machine environment and the database, determine the target framework object and parse it to get the JDBC URL. Then, the JDBC URL is checked based on the preconfigured check policy to generate the connection configuration check result.
Automatic inspection of JDBC URL configuration is implemented, reducing the error rate and cost of manual inspection, and does not need to affect the development process or operation of the program.
Smart Images

Figure CN119739611A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of computer technology, and in particular to a method, apparatus, device, medium and program product for checking a Java database connection JDBC connection configuration. Background Art
[0002] JDBC (Java Database Connectivity) is a key configuration item for Java programs to establish connections with databases. Whether the JDBC connection string is configured properly will affect the performance of the cooperation between the Java program and the database. Since most developers currently lack understanding of the specific parameters of the JDBC connection string, it is easy to miss some important parameters, resulting in production problems.
[0003] In the prior art, the common methods for checking the JDBC connection string are as follows: 1) Setting checking rules when submitting code: By customizing the checking rules when submitting code, when the developer submits the code, the configured Java database connection uniform resource locator JDBC URL connection string is checked. When the JDBC connection string is evaluated to not meet the requirements, submission is not allowed; 2) Scanning the existing version library: Scanning the pushed application version library, when it is found that the JDBC configuration in the version library is incorrect, remind the developer to make corrections.
[0004] The configuration of the JDBC connection string can be scattered in other configuration items of the same configuration file, and will be automatically integrated when the program is running. If only the code level is scanned, there may be omissions or mis-scanning, which will cause the developer to be unable to submit the code due to incorrect scanning. For version library and code submission scanning, the rules that need to be customized are relatively complex. Since different configuration items can be configured in different locations of the same configuration file or in the same URL, they must be customized in combination with various possible configuration items, which leads to high costs. In addition, for externally introduced Java programs, since they do not involve code control, they cannot be managed during the code submission process or through the central version library. If there are problems with the externally introduced Java programs, they cannot be discovered in time. Therefore, the existing JDBC connection configuration inspection method cannot automatically check the validity of the JDBC URL configuration. Summary of the invention
[0005] The present application provides a JDBC connection configuration checking method, apparatus, device, medium and program product, which can realize automatic checking of the validity of JDBC URL configuration.
[0006] In a first aspect, an embodiment of the present application provides a method for checking JDBC connection configuration, the method comprising:
[0007] Obtaining the interaction framework type between the Java virtual machine environment and the database corresponding to the object to be checked, and determining the target framework object according to the interaction framework type;
[0008] Obtain the data source object corresponding to the target framework object, and parse the data source object to obtain the corresponding JDBC URL;
[0009] The JDBC URL is checked based on a preconfigured check strategy to generate a corresponding connection configuration check result.
[0010] In a second aspect, an embodiment of the present application further provides a JDBC connection configuration checking device, the device comprising:
[0011] A framework object parsing module is used to obtain the interaction framework type between the Java virtual machine environment and the database corresponding to the object to be checked, and determine the target framework object according to the interaction framework type;
[0012] A URL parsing module is used to obtain the data source object corresponding to the target framework object, and parse the data source object to obtain the corresponding JDBC URL;
[0013] The URL checking module is used to check the JDBC URL based on a preconfigured checking strategy and generate a corresponding connection configuration checking result.
[0014] In a third aspect, an embodiment of the present application provides an electronic device, including:
[0015] one or more processors;
[0016] a memory for storing one or more programs,
[0017] When the one or more programs are executed by the one or more processors, the one or more processors implement the JDBC connection configuration checking method described in any embodiment of the present application.
[0018] In a fourth aspect, an embodiment of the present application provides a storage medium on which a computer program is stored, and when the program is executed by a processor, the method for checking the JDBC connection configuration described in any embodiment of the present application is implemented.
[0019] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements a method for checking a JDBC connection configuration as described in any one of the embodiments of the present invention.
[0020] The embodiment of the present application proposes a JDBC connection configuration inspection method, device, equipment, medium and program product. First, the target framework object is determined according to the interaction framework type between the Java virtual machine environment and the database, and the target framework object is parsed to obtain the corresponding JDBC URL; then the JDBC URL is checked by the pre-configured inspection strategy to generate the connection configuration inspection result of the object to be inspected. The JDBC URL generated in the Java environment is obtained by parsing the target framework object, and the JDBC URL is read in the virtual machine memory. By using the inspection strategy to inspect and judge it, the automatic inspection of the JDBC URL configuration is realized; and it will not have other effects on the development process and operation of the program. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 A flowchart of a method for checking JDBC connection configuration provided in an embodiment of the present application;
[0022] Figure 2 A flowchart of a method for obtaining a JDBC URL provided in an embodiment of the present application;
[0023] Figure 3 A schematic diagram of a method flow for inspecting a target inspection item provided in an embodiment of the present application;
[0024] Figure 4 A flowchart of a method for sending a target inspection program to an object to be inspected provided in an embodiment of the present application;
[0025] Figure 5 A schematic diagram of a JDBC connection configuration checking device provided in an embodiment of the present application
[0026] Figure 6 A schematic diagram of the structure of an electronic device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0027] The present application will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present application, rather than to limit the present application. It should also be noted that, for ease of description, only the parts related to the present application, rather than all structures, are shown in the accompanying drawings.
[0028] Figure 1 This is a flowchart of a JDBC connection configuration checking method provided in an embodiment of the present application. The method can be executed by a JDBC connection configuration checking device or electronic device. The device or electronic device can be implemented in software and / or hardware. The device or electronic device can be integrated in any smart device with network communication function. Figure 1 As shown, the method for checking the JDBC connection configuration may include the following steps:
[0029] S101, obtaining an interaction framework type between a Java virtual machine environment and a database corresponding to an object to be checked, and determining a target framework object according to the interaction framework type.
[0030] In a specific embodiment of the present application, the object to be inspected may be a deployment server or other intelligent electronic device. For the object to be inspected, the JVM (Java Virtual Machine) environment may be parsed first to check and determine the framework type for establishing a connection between the JVM (Java Virtual Machine) and the database.
[0031] After determining the interaction framework type, the corresponding target framework object can also be captured. The target framework object in the embodiment of the present application refers to a specific component, element or module that interacts with it in a specific software framework or application environment. The target framework object can be applied in a variety of scenarios, such as: Web development, mobile application development, desktop application, automated testing, etc.
[0032] S102: Acquire a data source object corresponding to the target framework object, and parse the data source object to obtain a corresponding JDBC URL.
[0033] Figure 2 The following is a flow chart of a method for obtaining a JDBC URL provided in an embodiment of the present application. Figure 2 As shown, the method for obtaining the JDBC URL may include the following steps:
[0034] S201. Parse the target framework object to obtain a data source object.
[0035] S202: Determine the type of the data source object, and capture the corresponding JDBC URL according to the type of the data source object.
[0036] In a specific embodiment of the present application, after determining the target framework object, the target framework object can be parsed, the data source object in the framework object can be captured, and the type of the data source object can be determined. Different types of data sources can be parsed to determine the corresponding JDBC URL storage location and capture the specific URL therefrom.
[0037] Based on the JDBC URL storage location pre-configured by the data source, the corresponding connection pool can be used to automatically capture the JDBC URL. By managing the JDBC URL and other database connection information through external configuration files or services, applications can easily switch database instances in different environments without recompiling the code. The connection pool can effectively manage and reuse database connections, reduce the overhead caused by frequent creation and closing of connections, and improve the overall performance of the application. By reasonably configuring parameters such as the maximum number of connections, the connection pool can control the application's occupation of database resources and avoid excessive resource consumption.
[0038] The embodiment of the present application captures the corresponding JDBC URL according to the type of data source object, and can manage all database connection information in one place, reducing the possibility of hard coding, making the configuration easier to manage and update, and improving the maintainability of the code; and it can easily adapt to a variety of different types of data sources, and only needs to implement the corresponding logic to parse the specific type of data source and generate the correct JDBC URL. When it is necessary to change the database vendor or version, only the mapping rules related to the new data source need to be adjusted without changing a large amount of existing code. For frequently used data source types, a caching mechanism can also be introduced to store the JDBC URLs that have been parsed to reduce unnecessary computing overhead. In addition, in a distributed system, the optimal data source instance can be dynamically selected according to the load situation, and the most appropriate JDBC URL can be generated to maximize performance.
[0039] S103: Check the JDBC URL based on the pre-configured check strategy and generate a corresponding connection configuration check result.
[0040] Figure 3 A schematic diagram of a method flow for inspecting a target inspection item provided in an embodiment of the present application. Figure 3 As shown in the figure, checking the JDBC URL based on the preconfigured checking policy can include the following steps:
[0041] S301: Obtain a preconfigured inspection strategy, and determine a target inspection item based on the inspection strategy.
[0042] In this step, a pre-configured inspection strategy can be loaded through a corresponding interface, API, management console or directly from a file. The inspection strategy in the embodiment of the present application can ensure the security and performance optimization of the JDBC connection. For the inspection of the JDBC connection configuration, the inspection items in the inspection strategy are specific operation points or verification conditions, which are intended to ensure that each connection configuration meets best practices, security standards and performance requirements.
[0043] The target check items in the embodiment of the present application may include: any one or more of timeout when waiting for connection, connection timeout, read data timeout, and write data timeout. The embodiment of the present application sets the check items to include any one or more of timeout when waiting for connection, connection timeout, read data timeout, and write data timeout, which can significantly improve the robustness and reliability of database operations. For example, by setting a reasonable timeout, it is possible to avoid long-term blocking of the application due to waiting for the database response, ensuring that the system can be restored in time when encountering problems. Appropriate timeout configuration helps to reasonably allocate and release resources, reduce unnecessary waiting time and resource usage, and thus improve overall performance.
[0044] S302: Check the JDBC URL based on the target check items, and obtain the project check results corresponding to each target check item.
[0045] In a specific embodiment of the present application, the JDBC URL is checked to ensure its correctness, security and efficiency. In one embodiment, the specific inspection content may include: 1) Verify the URL format: Syntax correctness: Ensure that the URL follows the correct syntax structure. Regular expressions or dedicated URL parsing libraries can be used for verification. Subprotocol: Confirm that the subprotocol matches the database type used. 2) Host and port: Host name or IP address: Verify that the host name or IP address is reachable and points to the expected database server. Port number: Confirm that the port number is a valid port that the database service is listening on. 3) Database name: Existence and permissions: Ensure that the specified database exists on the target server and that the connecting user has appropriate access rights. 4) Security: Ensure that passwords or other sensitive information are not passed in plain text in the URL. If credentials must be passed via URL, consider using environment variables or encrypted storage in configuration files. 5) Property settings: Check whether there are reasonable connection pool parameters (such as the maximum number of connections, the minimum number of idle connections, timeouts, etc.). These are usually provided as URL query parameters. And ensure that the correct character set and encoding are set to avoid garbled characters during data transmission.
[0046] S303: Generate a connection configuration inspection result according to the inspection results of each item.
[0047] The JDBC URL in the embodiment of the present application can be used to specify the location, name and connection parameters of the database to be connected. In the connection URL, other parameters can also be added to specify the detailed information of the connection, such as user name and password.
[0048] Exemplarily, the user can pre-configure the inspection strategy for the JDBC URL. The inspection strategy may include one or more target inspection items for the JDBC URL. For the captured JDBC URL, the target inspection items therein may be inspected and judged one by one according to the detection strategy, and the project inspection results corresponding to the target inspection items may be obtained, and then the connection configuration inspection results may be generated based on the inspection results. The connection configuration inspection results may include the judgment results of whether the parameter configuration of each target inspection item is reasonable, as well as the corresponding specific data.
[0049] Exemplarily, the target check items may include: any one or more of: socket timeout, connect timeout, read data timeout, write data timeout, and character encoding.
[0050] The inspection result in the embodiment of the present application may be the inspection result of each parameter, for example, whether the socket Timeout parameter configuration is reasonable, whether the character Encoding parameter configuration is reasonable, whether the useSSL parameter configuration is reasonable, etc.
[0051] In one embodiment, checking the JDBC URL based on the target check item and obtaining the project check result corresponding to each target check item may specifically include the following steps:
[0052] S3031. Obtain current data and historical data of the target inspection item.
[0053] In one embodiment, the user can first send the target acquisition program to the server corresponding to the target to be inspected, and then implant the target acquisition program into the corresponding JVM environment. The current data and historical data of the target inspection items can be obtained through the target acquisition program.
[0054] Specifically, the current data of the target check item can be obtained through the following methods: direct connection test, query database status, performance indicator monitoring, log recording, etc. In addition, the historical data of the target check item can be obtained through the following methods: analyzing the application log file, extracting all connection attempt records related to the JDBC URL; by parsing these log entries, historical data such as past connection success rate, failure reasons, average response time, etc. can be obtained. In addition, the JDBC URL check can also be integrated into the existing monitoring system, which usually collects data regularly and saves it for a long time, allowing users to view performance trends and abnormalities over a period of time.
[0055] S3032. Compare the current data with the historical data, and generate a project inspection result based on the data comparison result.
[0056] Specifically, when inspecting the target inspection item, the collected current data can be compared with the historical data of the inspection item, so that it can be judged whether the parameter configuration of the inspection item is reasonable based on the data comparison result. In one embodiment, if the current data is the same as the historical data, it can be judged that the parameter configuration is reasonable. In another embodiment, if the difference between the current data and the historical data is less than a preset threshold, the parameter configuration is judged to be reasonable; or, if the data difference is greater than the preset threshold, it is judged that the parameter configuration is unreasonable. By comparing the current data with the historical data, the embodiment of the present application can quickly identify changes that deviate from the normal range, thereby discovering problems earlier, reducing the need for manual intervention, reducing the risk of human error, and improving overall efficiency.
[0057] The method for checking the JDBC URL based on the preconfigured check policy provided in the embodiment of the present application can automatically verify whether the sensitive parameters (such as user name and password) in the JDBC URL are set correctly to avoid security vulnerabilities caused by human errors; ensure that an encrypted transmission protocol is used to protect the security of data during transmission; for data sources using load balancing, ensure that the JDBC URL configurations of all nodes are consistent and valid to avoid single point failures.
[0058] Figure 4 A flowchart of a method for sending a target inspection program to an object to be inspected provided in an embodiment of the present application. Figure 4 As shown, before obtaining the interaction framework type between the Java virtual machine environment and the database corresponding to the target to be checked, a target checking program may be sent to the target to be checked, which may specifically include the following steps:
[0059] S401. Send a target inspection program to each object to be inspected according to an inspection object form; wherein the inspection object form includes at least one object to be inspected.
[0060] S402: Determine type information of the Java virtual machine environment of the object to be checked in the server of the object to be checked.
[0061] S403: Configure a corresponding target inspection program according to the type information of the Java virtual machine environment, so as to run the target inspection program in the Java virtual machine environment of the object to be inspected.
[0062] In a specific example of the present application, a user can first configure an inspection object form, which may include one or more objects to be inspected. A user can initiate an inspection task for each object to be inspected in the inspection object form, and execute each inspection task. When executing an inspection task, a target inspection program can be first sent to the server of each object to be inspected, and the target inspection program can be used to execute the inspection method of the JDBC connection configuration. After sending the target inspection program to the server of each object to be inspected, you can log in to the corresponding server and determine the corresponding JVM environment type; after determining the JVM environment type, implant the corresponding target inspection program into the JVM environment, and run the inspection method of the JDBC connection configuration.
[0063] For different Java virtual machine environment type information, a corresponding target checker can be configured. In one embodiment, java-version can be used to obtain the Java virtual machine environment. java-version is a command line instruction used to display the version information of the currently installed Java virtual machine (JVM).
[0064] The embodiment of the present application configures the corresponding target checker according to the type information of the Java virtual machine environment, so that all JVM-related configurations and check logic can be concentrated in one place, which is convenient for management and updating, and reduces the complexity and error possibility caused by decentralized configuration; when encountering performance bottlenecks or abnormal behaviors, the checker can be used to quickly determine whether it is related to a specific JVM version or configuration, thereby speeding up problem solving; the security models of different JVM versions may be different, and the checker based on the JVM type configuration can ensure that the application follows the most stringent security standards and promptly patches known vulnerabilities.
[0065] The JDBC connection configuration inspection method proposed in the embodiment of the present application first sends the target inspection program tool to the server that needs to be inspected and runs it; then the target inspection program analyzes the JVM environment on the server and automatically implants the target inspection program into the JVM environment. The target inspection program can analyze the database interaction framework used in the JVM environment and grab the database interaction framework objects that need to be used; then analyze the data source type and grab the data source objects that need to be used, and then grab the URL from the data source object; then the URL can be analyzed according to the user-defined inspection rules and an inspection report can be generated. The URL is read through the JVM memory and automatically inspected, so that the inspection of the application URL will not have any impact on the development process and operation of the program, and automatic inspection without the developer's perception is realized.
[0066] Figure 5 A schematic diagram of the structure of a JDBC connection configuration inspection device provided in an embodiment of the present application.
[0067] like Figure 5 As shown, the device comprises:
[0068] The framework object parsing module 501 is used to obtain the interaction framework type between the Java virtual machine environment and the database corresponding to the object to be checked, and determine the target framework object according to the interaction framework type;
[0069] A URL parsing module 502 is used to obtain a data source object corresponding to the target framework object, and parse the data source object to obtain a corresponding JDBC URL;
[0070] The URL checking module 503 is used to check the JDBC URL based on a pre-configured checking strategy and generate a corresponding connection configuration checking result.
[0071] The JDBC connection configuration checking device can execute the method provided in any embodiment of the present application, and has the corresponding functional modules and beneficial effects of the execution method. For technical details not described in detail in this embodiment, please refer to the JDBC connection configuration checking method provided in any embodiment of the present application.
[0072] An embodiment of the present invention also provides a computer program product.
[0073] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include: being implemented in one or more computer program products, which can include one or more computer programs, which can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor, which can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0074] Figure 6 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention, referring to Figure 6 , Figure 6 The electronic device 12 shown is only an example and should not limit the functions and scope of use of the embodiments of the present application. Figure 6As shown, the electronic device 12 is in the form of a general purpose computing device. The components of the electronic device 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 that connects various system components (including the system memory 28 and the processing unit 16).
[0075] Bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor or a local bus using any of a variety of bus architectures. By way of example, these architectures include, but are not limited to, an Industry Standard Architecture (ISA) bus, a Micro Channel Architecture (MAC) bus, an Enhanced ISA bus, a Video Electronics Standards Association (VESA) local bus, and a Peripheral Component Interconnect (PCI) bus.
[0076] The electronic device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the electronic device 12, including volatile and non-volatile media, removable and non-removable media.
[0077] The system memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. The electronic device 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 34 may be used to read and write non-removable, non-volatile magnetic media ( Figure 6 not shown, usually called a "hard drive"). Although Figure 6 Not shown, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk"), and an optical drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, a DVD-ROM, or other optical medium) may be provided. In these cases, each drive may be connected to the bus 18 via one or more data medium interfaces. The memory 28 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of the various embodiments of the present application.
[0078] A program / utility 40 having a set (at least one) of program modules 46 may be stored, for example, in the memory 28, such program modules 46 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. The program modules 46 generally perform the functions and / or methods of the embodiments described herein.
[0079] The electronic device 12 may also communicate with one or more external devices 14 (e.g., keyboards, pointing devices, displays 24, etc.), may communicate with one or more devices that enable a user to interact with the electronic device 12, and / or may communicate with any device that enables the electronic device 12 to communicate with one or more other computing devices (e.g., a network card, a modem, etc.). Such communication may be performed via an input / output (I / O) interface 22. Furthermore, the electronic device 12 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 20. As shown, the network adapter 20 communicates with other modules of the electronic device 12 via the bus 18. It should be understood that although Figure 6 Not shown, other hardware and / or software modules may be used in conjunction with the electronic device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0080] The processing unit 16 executes various functional applications and data processing by running the program stored in the system memory 28, for example, a JDBC connection configuration inspection method provided in an embodiment of the present invention is implemented: obtaining the interaction framework type between the Java virtual machine environment and the database corresponding to the object to be inspected, and determining the target framework object according to the interaction framework type; obtaining the data source object corresponding to the target framework object, and parsing the data source object to obtain the corresponding Java database connection uniform resource locator JDBC URL; inspecting the JDBC URL based on a preconfigured inspection strategy to generate a corresponding connection configuration inspection result.
[0081] An embodiment of the present invention provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, a JDBC connection configuration inspection method as provided in all embodiments of the present invention is implemented: obtaining the interaction framework type between the Java virtual machine environment and the database corresponding to the object to be inspected, and determining the target framework object according to the interaction framework type; obtaining the data source object corresponding to the target framework object, and parsing the data source object to obtain the corresponding Java database connection uniform resource locator JDBC URL; inspecting the JDBC URL based on a preconfigured inspection strategy to generate a corresponding connection configuration inspection result. The computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium may be, for example, but not limited to, an electronic device, device or device of electrical, magnetic, optical, electromagnetic, infrared, or semiconductor, or any combination thereof. More specific examples of computer-readable storage media (a non-exhaustive list) include: an electrical connection with one or more conductors, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction-executing electronic device, apparatus, or device.
[0082] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction-executing electronic device, apparatus, or device.
[0083] The program code embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0084] Computer program code for performing the operations of the present invention may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0085] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.
Claims
1. A method for checking a Java database connection JDBC connection configuration, characterized in that: The method comprises: Obtaining the interaction framework type between the Java virtual machine environment and the database corresponding to the object to be checked, and determining the target framework object according to the interaction framework type; Obtaining a data source object corresponding to the target framework object, and parsing the data source object to obtain a corresponding Java database connection uniform resource locator JDBC URL; The JDBC URL is checked based on a preconfigured check strategy to generate a corresponding connection configuration check result.
2. The method according to claim 1, characterized in that: Obtaining a data source object corresponding to the target framework object, and parsing the data source object to obtain a corresponding JDBC URL, including: Parse the target framework object to obtain the data source object; The type of the data source object is determined, and the corresponding JDBC URL is captured according to the type of the data source object.
3. The method according to claim 1, characterized in that The JDBC URL is checked based on the preconfigured check strategy to generate a corresponding connection configuration check result, including: Acquire the preconfigured inspection strategy, and determine the target inspection item based on the inspection strategy; Check the JDBC URL based on the target inspection item, and obtain the project inspection result corresponding to each target inspection item; The connection configuration check result is generated according to the check results of each item.
4. The method according to claim 3, characterized in that: Checking the JDBC URL based on the target check item to obtain a project check result corresponding to each target check item includes: Obtaining current data and historical data of the target inspection item; The current data is compared with the historical data, and the project inspection result is generated according to the comparison result.
5. The method according to claim 4, characterized in that The target inspection items include: any one or more of timeout when waiting for connection, connection timeout, data reading timeout, and data writing timeout.
6. The method according to claim 1, characterized in that Before determining the type of interaction framework between the Java virtual machine environment corresponding to the target to be checked and the database, the method further includes: Sending a target inspection program to each of the objects to be inspected according to the inspection object form; wherein the inspection object form includes at least one object to be inspected; Determining type information of a Java virtual machine environment of the object to be checked in a server of the object to be checked; The corresponding target inspection program is configured according to the type information of the Java virtual machine environment, so as to run the target inspection program in the Java virtual machine environment of the object to be inspected.
7. A device for checking a Java database connection JDBC connection configuration, characterized in that: The device comprises: A framework object parsing module is used to obtain the interaction framework type between the Java virtual machine environment and the database corresponding to the object to be checked, and determine the target framework object according to the interaction framework type; A URL parsing module is used to obtain a data source object corresponding to the target framework object, and parse the data source object to obtain a corresponding Java database connection uniform resource locator JDBC URL; The URL checking module is used to check the JDBC URL based on a preconfigured checking strategy and generate a corresponding connection configuration checking result.
8. An electronic device, characterized in that: include: one or more processors; a memory for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the JDBC connection configuration checking method according to any one of claims 1 to 6.
9. A storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method for checking the JDBC connection configuration according to any one of claims 1 to 6 is implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the computer program implements the method for checking the JDBC connection configuration according to any one of claims 1 to 6.