CN106294791B - A kind of database port change method of transparence - Google Patents

A kind of database port change method of transparence Download PDF

Info

Publication number
CN106294791B
CN106294791B CN201610669154.9A CN201610669154A CN106294791B CN 106294791 B CN106294791 B CN 106294791B CN 201610669154 A CN201610669154 A CN 201610669154A CN 106294791 B CN106294791 B CN 106294791B
Authority
CN
China
Prior art keywords
port
database
change
request
connection
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.)
Active
Application number
CN201610669154.9A
Other languages
Chinese (zh)
Other versions
CN106294791A (en
Inventor
程永新
孙玉颖
孙田
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
SHANGHAI NEW CENTURY NETWORK Co Ltd
Original Assignee
SHANGHAI NEW CENTURY NETWORK Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by SHANGHAI NEW CENTURY NETWORK Co Ltd filed Critical SHANGHAI NEW CENTURY NETWORK Co Ltd
Priority to CN201610669154.9A priority Critical patent/CN106294791B/en
Publication of CN106294791A publication Critical patent/CN106294791A/en
Application granted granted Critical
Publication of CN106294791B publication Critical patent/CN106294791B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems

Abstract

The invention discloses a kind of database ports of transparence to change method, includes the following steps: a) the default connection port of configuration database on the application server, and start port conversion module;Whether b) client initiates request, be that the default connection port of database judges to connectivity port after application server receives request;If c) connecting pin is default connection port, intercept requests packet, package enters port conversion module, converted port by specified port mapping corresponding relationship;D) after the target port in request packet is converted to the port of change by the port translation module, then with database physical connection is created, data is obtained from database, and return to client.It is transparent to application routine access that the present invention can be realized the change of database port, can be improved change efficiency, the safety of change and the ease of manageability of change, reduces failure caused by change, improves the stability of system operation.

Description

A kind of database port change method of transparence
Technical field
The present invention relates to the database ports of a kind of database connection method more particularly to a kind of transparence to change method.
Background technique
In general, the process of java application program access database is: 1. loading data library driver;2. passing through Jdbc establishes database connection;3. accessing database, sql sentence is executed;4. turn-off data library connects.Wherein JDBC be java and Bridge between relational database.JDBC (connection of Java Data Base Connectivity, java database) is a kind of For executing the Java API of SQL statement, unified access can be provided for a variety of relational databases, it uses Java language by one group Class and the interface composition write.JDBC provides a kind of benchmark, can construct more advanced tool and interface accordingly, make database Developer can write database application.JDBC is directed toward specific data by Connection (connecting object interface) Library connecting object=Drivermanager.getConnection (String URL)), what wherein URL was configured here is data The connection string in library, the connection IP address including database, connectivity port and database instance name, such as: jdbc:oracle: thin:@192.168.1.1:1521:testdb.Domain name can be used in IP address in URL string, then is converted by dns server At true IP address.
For the safety for reinforcing database, change database default connection port is generally required in actual use.But Database connecting pin slogan is a specific value in URL string.If changing the connectivity port of database, need all The port numbers numerical value in the URL of database connection is modified on corresponding each application server, the process of configuration change is very It is cumbersome, large enterprise's application server cluster is increased to the difficulty of database access administration.
Therefore existing change database default connection port has the following technical problems:
1), low efficiency.One database usually can all have it is many come up using connection, if databases comparison connection Port then needs to modify database connection configuration in each application, it has to additional server is operated, in large-scale enterprise The efficiency of configuration change will be very low in system environments.
2), safety is low.In large-scale corporate environment, after having modified database connectivity port, may exist and omit System configuration do not change, or the case where correct mistakes, cause to cause fault in production, configuration change using database is not connected Safety is very low.
3), not manageability.Behind databases comparison connectivity port, then need to go on artificial to every application server The port numbers in database linking URL are modified, are measured from the angle of efficient O&M and automation O&M, such configuration becomes It is not easy to more very much manage.
Summary of the invention
Technical problem to be solved by the invention is to provide a kind of database ports of transparence to change method, can be realized The change of database port is transparent to application routine access, and change efficiency, the safety of change and the manageability of change can be improved Property, failure caused by change is reduced, the stability of system operation is improved.
The present invention is to solve above-mentioned technical problem and the technical solution adopted is that provide a kind of database port of transparence Change method, includes the following steps: a) the default connection port of configuration database on the application server, and starts port translation Module;B) client initiate request, after application server receives request, to connectivity port whether be database default connection end Mouth is judged;If c) connecting pin is default connection port, intercept requests packet, package enters port conversion module, passes through Specified port mapping corresponding relationship converts port;D) the port translation module turns the target port in request packet After being changed to the port of change, then with database create physical connection, data are obtained from database, and return to client.
Method is changed in the database port of above-mentioned transparence, wherein the default connection port configuration is in database It further include the link address and database Instance Name of database, institute in connection string, in the connection string of the database The link address for stating database is IP address or domain name addresses.
Method is changed in the database port of above-mentioned transparence, wherein what the port translation module scans were locally initiated Whether all connections are that the default connection port of database judges to connectivity port, if it is non-default connectivity port Request, original request directly issue;If it is default connection port, intercept requests packet, package enters port conversion module, passes through Specified port mapping corresponding relationship converts port, then package issues request.
Method is changed in the database port of above-mentioned transparence, wherein after the port translation module starting, first according to number It attempts to connect with database server creation database according to the default connection port in library, if default connection port is not present, All of the port on the server of ergodic data library, until the true connectivity port on confirmation database server, and store default and connect Connect the mapping corresponding relationship between port and true connectivity port.
Method is changed in the database port of above-mentioned transparence, wherein the application server and database server it Between a TCP connection established by three-way handshake, the true connectivity port of database server is contained in the packet header of TCP Number.
The present invention, which compares the prior art, to be had following the utility model has the advantages that the database port of transparence provided by the invention is changed Method passes through, it can be ensured that after modifying database connectivity port, all applying is not needing the case where doing configuration change Under, it can be correctly connected on database by new port and carry out database access, greatly improve change efficiency, change The ease of manageability of safety and change reduces failure caused by change, improves the stability of system operation.
Detailed description of the invention
Fig. 1 is that system architecture schematic diagram is changed in the database port of transparence of the present invention;
Fig. 2 is that flow diagram is changed in the database port of transparence of the present invention;
Fig. 3 is detection data server of the present invention connectivity port flow diagram;
Fig. 4 establishes TCP connection schematic diagram between application server and database server of the invention;
Fig. 5 is TCP head-coating structure schematic diagram in Fig. 4.
Specific embodiment
The invention will be further described with reference to the accompanying drawings and examples.
Fig. 1 is that system architecture schematic diagram is changed in the database port of transparence of the present invention;Fig. 2 is the number of transparence of the present invention Flow diagram is changed according to library port.
Method is changed, is included the following steps: with Fig. 2, the database port of transparence provided by the invention referring to Figure 1
A) the default connection port of configuration database on the application server, and start port conversion module;
B) client initiate request, after application server receives request, to connectivity port whether be database default connect Port is connect to be judged;
If c) connecting pin is default connection port, intercept requests packet, package enters port conversion module, by specified Port mapping corresponding relationship port is converted;
D) it after the target port in request packet is converted to the port of change by the port translation module, then creates with database Physical connection is built, data are obtained from database, and return to client.
The present invention redirects the port for needing to monitor in the process by port mapping, reconnects the service.Than If the mode of the database connection pool configured in the application server is domain name: port, port is the port numbers 1521 of default;
Client initiates request, and application server initiates the connection after receiving request to database;
Whether the port translation process of the machine scans all connections locally initiated, be 1521 to judge to port, such as Fruit is the request of non-1521 port, and original request issues;
If it is 1521 ports, intercept requests packet, package enters port conversion module, specified by port translation module Port mapping corresponding relationship port is converted, then package will request issue;
Target port in request packet have been converted into change after port, using after change port and database create Physical connection obtains data from database, returns to client.
When program starting, while starting port conversion module, ceaselessly the asynchronous http company monitoring the machine and issuing Connect request, once in listening to the message of request transformation in need port, such as the default port 1521 of oracle database, end As soon as a mouthful conversion module just starts a thread, (such as 1789 ports) on the port redirection to true port, in this line Cheng Li, completing port conversion.In order to guarantee to realize that the automation of transparence redirects, elder generation is needed after the starting of port translation module It is connect with the database server of distal end creation database, uses default port 1521, port translation module can arrive first far In end main frame attempt with 1521 creation connect, if 1521 ports are not present, to distance host on traverse all of the port, confirm The true connectivity port value of database, then by 1521 port translations be true database port, whole process is by port translation Module is automatically performed, and does not need to configure destination port number in port translation module manually, as shown in Figure 3.Distance host simultaneously Connection is established with the port hostport of host.Can also in the configuration file of port mapping device designated port forwarding. By this port mapping device, in the case where database update default port, application end can be transparently connecting to data On library, do not need to do large-scale configuration change.The remote port that local host to be accessed carries out mapping change, realizes local 1521 ports of host access remote server are equivalent to 1789 ports of access remote server.
A TCP connection, such as Fig. 4 are established by three-way handshake between application server and database server of the invention Shown, in the configuration of application server (host A), the request of initiation is attached to the 1521 of database server (host B) Port, but 1521 ports of database server have been changed to 1789 ports.Port translation module through the invention, in host A (application server) is initiated before shaking hands for the first time, the destination port in http message is changed to 1789 from 1521, host is initiated It shakes hands, is sent in the monitoring port of correct database (host B) for the first time, host B initiates to hold for the second time after receiving request Hand replys connection confirmation message to host A, and host A initiates third time again and shakes hands, and also needing at this time will even by port translation module It connects confirmation message and is sent to host B.Although the port that host A initiates request connection is 1521, it is actually and host B 1789 ports establish TCP connection.Realize that change database port is corresponding with transparent with this.Mesh is contained in the packet header of TCP The port numbers for marking host, such as the structure that Fig. 5 is the packet header TCP.
In conclusion not needing to change existing application code, not needing to change after database port change of the invention Existing middleware running configuration does not need additional configuration work amount, improves working efficiency, simplifies complicated cumbersome work. In addition, the present invention can have found that database side slogan changes automatically, and it is connected automatically on true database port, without Any manual configuration is done, databases comparison bring risk is reduced, promotes the reliable of database port change management operation Property, safety, reduce and omit operation etc. application system is brought the negative effect such as can not normally to connect.Database port of the invention Change is transparent to application, for large-scale production environment, effectively improves the simplification and efficiency of production environment management.
Although the present invention is disclosed as above with preferred embodiment, however, it is not to limit the invention, any this field skill Art personnel, without departing from the spirit and scope of the present invention, when can make a little modification and perfect therefore of the invention protection model It encloses to work as and subject to the definition of the claims.

Claims (2)

1. method is changed in a kind of database port of transparence, which comprises the steps of:
A) the default connection port of configuration database on the application server, and start port conversion module;
B) client initiate request, after application server receives request, to connectivity port whether be database default connection end Mouth is judged;
If c) connecting pin is default connection port, intercept requests packet, package enters port conversion module, passes through specified end Mouth mapping corresponding relationship converts port;
D) after the target port in request packet is converted to the port of change by the port translation module, then with database object is created Reason connection, obtains data, and return to client from database;
All connections that the port translation module scans are locally initiated, to connectivity port whether be database default connection end Mouth is judged, if it is the request of non-default connectivity port, original request is directly issued;If it is default connection port, cut Request packet is taken, and package enters port conversion module, port is converted by specified port mapping corresponding relationship, then package Request is issued;
After the port translation module starting, first attempted to create number with database server according to the default connection port of database It is connected according to library, if default connection port is not present, all of the port on the server of ergodic data library, until confirmation database clothes The true connectivity port being engaged on device, and store the mapping corresponding relationship between default connection port and true connectivity port;
A TCP connection is established by three-way handshake between the application server and database server, in the packet header of TCP Contain the true connecting pin slogan of database server.
2. method is changed in the database port of transparence as described in claim 1, which is characterized in that the default connection port Configuration further includes the link address sum number of database in the connection string of database, in the connection string of the database According to library Instance Name, the link address of the database is IP address or domain name addresses.
CN201610669154.9A 2016-08-15 2016-08-15 A kind of database port change method of transparence Active CN106294791B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610669154.9A CN106294791B (en) 2016-08-15 2016-08-15 A kind of database port change method of transparence

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610669154.9A CN106294791B (en) 2016-08-15 2016-08-15 A kind of database port change method of transparence

Publications (2)

Publication Number Publication Date
CN106294791A CN106294791A (en) 2017-01-04
CN106294791B true CN106294791B (en) 2019-09-13

Family

ID=57671729

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610669154.9A Active CN106294791B (en) 2016-08-15 2016-08-15 A kind of database port change method of transparence

Country Status (1)

Country Link
CN (1) CN106294791B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109831521B (en) * 2019-03-11 2021-08-31 深圳市珍爱捷云信息技术有限公司 Cache instance management method and device, computer equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1870657A (en) * 2006-06-23 2006-11-29 杭州华为三康技术有限公司 Method for providing port trigging concurrency for interface quipment and interface equipment
CN101199161A (en) * 2005-08-01 2008-06-11 思科技术公司 Method and system for dynamic assignment of wireless lan access point identity
CN103685043A (en) * 2012-09-19 2014-03-26 国基电子(上海)有限公司 Router, network connection recovery system and network connection recovery method
US9178800B1 (en) * 2009-08-28 2015-11-03 Cisco Technology, Inc. Policy based configuration of interfaces in a virtual machine environment

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050204118A1 (en) * 2004-02-27 2005-09-15 National Chiao Tung University Method for inter-cluster communication that employs register permutation

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101199161A (en) * 2005-08-01 2008-06-11 思科技术公司 Method and system for dynamic assignment of wireless lan access point identity
CN1870657A (en) * 2006-06-23 2006-11-29 杭州华为三康技术有限公司 Method for providing port trigging concurrency for interface quipment and interface equipment
US9178800B1 (en) * 2009-08-28 2015-11-03 Cisco Technology, Inc. Policy based configuration of interfaces in a virtual machine environment
CN103685043A (en) * 2012-09-19 2014-03-26 国基电子(上海)有限公司 Router, network connection recovery system and network connection recovery method

Also Published As

Publication number Publication date
CN106294791A (en) 2017-01-04

Similar Documents

Publication Publication Date Title
US11625414B2 (en) Method and system for transparent interoperability between applications and data management systems
CN104636189B (en) Virtual machine deployment system and method based on Xen
EP3629192B1 (en) Supporting graphql based queries on yang based configuration data models
US7805341B2 (en) Extraction, transformation and loading designer module of a computerized financial system
US7181474B2 (en) Database communication system and method for communicating with a database
CN106790503A (en) It is a kind of to realize the IPv4 websites without skylight using the device upgraded to IPv6 based on HTTP reverse proxys
US10140121B2 (en) Sending a command with client information to allow any remote server to communicate directly with client
US20080301143A1 (en) Automatic Update System and Method for Using a Meta Mib
WO2013063950A1 (en) Inspection method and system of multimode communication device
CN105893097A (en) Method and device for processing option information of BIOS (basic input output system)
CN106844545A (en) A kind of implementation method of the Database Systems with double engines based on stsndard SQL
CN114450678B (en) Enabling federated query access to heterogeneous data sources
CN102957568B (en) A kind of method for managing and monitoring of multi node server
CN109145009B (en) SQL-based method for searching ElasticSearch
CN106294791B (en) A kind of database port change method of transparence
CN101719991B (en) Video matrix protocol converter
US20150127785A1 (en) Gateway service manager for business object applications
CN103685536A (en) Monopolized type virtual desktop management method
CN109510729A (en) A kind of implementation method based on CMDB and Netstat discovery applied topology relationship
US10795880B2 (en) System and method for inter-program file control communication
CN105488174B (en) More distributed data power supply management methods and system based on BS structures
CN104574188B (en) A kind of transaction service system and transaction processing method
CN106302856A (en) A kind of method and system shortening Android intelligence POS exchange hour
US11803786B2 (en) Enterprise integration platform
US10303527B1 (en) Active directory attribute mapping

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant