[go: up one dir, main page]

CN1317638C - Loading method of driving program for database - Google Patents

Loading method of driving program for database Download PDF

Info

Publication number
CN1317638C
CN1317638C CNB021452210A CN02145221A CN1317638C CN 1317638 C CN1317638 C CN 1317638C CN B021452210 A CNB021452210 A CN B021452210A CN 02145221 A CN02145221 A CN 02145221A CN 1317638 C CN1317638 C CN 1317638C
Authority
CN
China
Prior art keywords
database
database device
driver
database driver
file
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.)
Expired - Fee Related
Application number
CNB021452210A
Other languages
Chinese (zh)
Other versions
CN1499366A (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.)
ZTE Corp
Original Assignee
ZTE Corp
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 ZTE Corp filed Critical ZTE Corp
Priority to CNB021452210A priority Critical patent/CN1317638C/en
Publication of CN1499366A publication Critical patent/CN1499366A/en
Application granted granted Critical
Publication of CN1317638C publication Critical patent/CN1317638C/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本发明涉及一种JAVA数据库驱动程序的装载方法,其中,由驱动程序管理器接受并处理客户所发来的建立数据库连接的请求,并采用JAVA提供的标准方法查找所需的数据库驱动程序,如果找到则用该数据库驱动程序与数据库建立连接;其特征在于,如果找不到所需的数据库驱动程序,则按执行以下步骤:A.则由驱动程序管理器向数据库驱动程序装载器发出加载数据库驱动程序的请求;B.数据库驱动程序装载器在本机或网络服务器上查找所需的数据库驱动程序,如果找到所需的数据库驱动程序,则将其返回到驱动程序管理器;C.用所找到的数据库驱动程序与数据库建立连接。采用本发明的方法,使程序员在标准装载方法之外有更多的选择余地。

Figure 02145221

The present invention relates to a loading method of a JAVA database driver, wherein the driver manager accepts and processes the request for establishing a database connection sent by a client, and uses a standard method provided by JAVA to find the required database driver, if Find and then establish connection with the database with this database driver; It is characterized in that, if can not find required database driver, then by carrying out the following steps: A. then send loading database to database driver loader by the driver program manager The driver's request; B. The database driver loader looks for the required database driver on the local machine or the network server, and if it finds the required database driver, it returns it to the driver manager; C. Use all The found database driver establishes a connection to the database. By adopting the method of the present invention, the programmer has more choices besides the standard loading method.

Figure 02145221

Description

数据库驱动程序的装载方法How to load the database driver

技术领域technical field

本发明涉及数据库技术,更具体地说,涉及一种数据库驱动程序的装载方法。The invention relates to database technology, more specifically, to a loading method of a database driver.

背景技术Background technique

JDBC(Java Database Connectivity,即JAVA数据库连接)是由一组Java语言写成的类和接口组成,JDBC使用一种连接不同数据库的规范,其宗旨是让各个数据库开发商为Java程序员提供标准的数据库访问类和接口,所以应用相当广泛。程序员在应用JDBC时,经常将数据库驱动程序和自己的程序绑定在一起,即在CLASSPATH(类路径)中指定,或者自己的程序与数据库驱动程序一起形成一个jar文件(一种为JAVA定义的压缩文件扩展名,这种文件压缩格式采用ZIP标准)。这样方法有如下一些缺点:JDBC (Java Database Connectivity, that is, JAVA database connection) is composed of a set of classes and interfaces written in the Java language. JDBC uses a specification for connecting different databases. Its purpose is to allow various database developers to provide Java programmers with standard databases. Access classes and interfaces, so the application is quite extensive. When programmers apply JDBC, they often bind the database driver with their own program, that is, specify in CLASSPATH (class path), or their own program and database driver together form a jar file (a type defined for JAVA Compressed file extension, this file compression format adopts the ZIP standard). This method has the following disadvantages:

(1)、如果形成一个jar文件则整个程序“体积”庞大,数据库开发商提供的JDBC驱动程序常常在程序包中占很大比例;(1), if a jar file is formed, the whole program will have a huge "volume", and the JDBC driver provided by the database developer often accounts for a large proportion in the program package;

(2)、数据库驱动程序可能在程序中固定,不可以修改或者不方便修改;(2) The database driver may be fixed in the program and cannot be modified or is inconvenient to modify;

(3)、在CLASSPATH中修改东西比较繁琐;(3) It is cumbersome to modify things in CLASSPATH;

(4)、不能方便地随数据库开发商提供的数据库驱动程序进行版本升级;(4) The version cannot be easily upgraded with the database driver provided by the database developer;

(5)、不能提供集中管理数据库驱动程序的机制。(5), cannot provide the mechanism of centralized management database driver.

当然,程序员可以将数据库驱动程序放到JAVA扩展目录下(通常在ext目录下),以达到分离程序与数据库驱动程序的目的,但在数据库驱动程序的装载方面还是不够灵活,不能达到统一管理数据库驱动程序的目的。Of course, programmers can put the database driver in the JAVA extension directory (usually in the ext directory) to achieve the purpose of separating the program and the database driver, but the loading of the database driver is still not flexible enough to achieve unified management The purpose of the database driver.

发明内容Contents of the invention

本发明要解决的技术问题在于,针对现有技术的上述缺陷,提供一种数据库驱动程序的装载方法,在标准装载方法之外,使程序员有更多的选择余地。The technical problem to be solved by the present invention is to provide a loading method of a database driver for the above-mentioned defects of the prior art, which enables programmers to have more choices besides the standard loading method.

本发明解决其技术问题所采用的技术方案是:一种JAVA数据库驱动程序的装载方法,其中,由驱动程序管理器接受并处理客户所发来的建立数据库连接的请求,并采用JAVA提供的标准方法查找所需的数据库驱动程序,如果找到则用该数据库驱动程序与数据库建立连接;其特征在于,如果找不到所需的数据库驱动程序,则按执行以下步骤:A、则由所述驱动程序管理器向数据库驱动程序装载器发出加载数据库驱动程序的请求;B、所述数据库驱动程序装载器在本机或网络服务器上查找所需的数据库驱动程序,如果找到所需的数据库驱动程序,则将其返回到所述驱动程序管理器;C、用所找到的数据库驱动程序与数据库建立连接。The technical solution adopted by the present invention to solve the technical problem is: a loading method of a JAVA database driver, wherein the driver manager accepts and processes the request for establishing a database connection sent by the client, and adopts the standard provided by JAVA Method searches for the required database driver, if found then establishes connection with database with this database driver; It is characterized in that, if can not find required database driver, then by performing the following steps: A, then by described The program manager sends a request for loading the database driver to the database driver loader; B, the database driver loader searches for the required database driver on the local machine or the network server, if the required database driver is found, Then return it to the driver manager; C, establish a connection with the database with the found database driver.

在本发明的方法中,可将数据库驱动程序的压缩文件存放在本机上,由所述数据库驱动程序装载器在本机上查找所需的数据库驱动程序。此时,在所述步骤B中,根据所述驱动程序管理器发来的请求中的驱动程序名,对压缩文件每一个入口点进行查找,如果找到所需的数据库驱动程序的压缩文件,则对所述压缩文件进行解压,并定义类(即向JAVA虚拟机注册类,并建立类名和类字节的对应关系),然后向所述驱动程序管理器返回已解压并定义的数据库驱动程序;如果在所有压缩文件的入口点中找不到所需的数据库驱动程序,则返回异常信息。In the method of the present invention, the compressed file of the database driver can be stored on the local machine, and the database driver loader can search for the required database driver on the local machine. Now, in the step B, according to the driver name in the request sent by the driver manager, each entry point of the compressed file is searched, if the compressed file of the required database driver is found, then Decompress the compressed file, and define classes (i.e. register classes with the JAVA virtual machine, and establish the correspondence between class names and class bytes), then return the decompressed and defined database driver to the driver manager; An exception is returned if a required database driver cannot be found in the entry points of all compressed files.

在本发明的方法中,还可将数据库驱动程序的压缩文件存放在数据库驱动程序文件服务器内,由所述数据库驱动程序装载器通过网络从所述数据库驱动程序文件服务器处查找所需的数据库驱动程序。此时,在所述步骤B中,根据所述驱动程序管理器发来的请求中的驱动程序名,所述数据库驱动程序装载器向所述数据库驱动程序文件服务器发出查找所需的数据库驱动程序的请求;所述数据库驱动程序文件服务器在所存放的压缩文件中进行查找,如果找到则返回成功消息给所述数据库驱动程序装载器,并将找到的文件附加在消息体中发送到所述数据库驱动程序装载器,再将其返回到所述驱动程序管理器;In the method of the present invention, the compressed file of the database driver can also be stored in the database driver file server, and the database driver loader can find the required database driver from the database driver file server through the network. program. At this time, in the step B, according to the driver program name in the request sent by the driver program manager, the database driver program loader sends the database driver program required for searching to the database driver program file server The request of the database driver program file server is searched in the stored compressed file, and if found, a success message is returned to the database driver program loader, and the found file is attached to the message body and sent to the database the driver loader, which returns it to the driver manager;

如果所述数据库驱动程序文件服务器在所存放的压缩文件中找不到所需的数据库驱动程序,则返回失败消息给所述数据库驱动程序装载器;所述数据库驱动程序装载器再向所述驱动程序管理器返回异常信息。If the database driver file server cannot find the required database driver in the stored compressed file, then return a failure message to the database driver loader; The program manager returned exception information.

可见,与现有技术相比,本发明的方法在装载数据库驱动程序方面更加灵活一点,因为驱动程序存放的目录是可配置的,更可以实现网络加载数据库驱动程序,达到统一管理数据库驱动程序的目的。本发明的方法具有以下特点:It can be seen that compared with the prior art, the method of the present invention is more flexible in loading the database driver, because the directory where the driver is stored is configurable, and it is more possible to load the database driver through the network to achieve unified management of the database driver. Purpose. Method of the present invention has following characteristics:

(1)、主程序与数据库驱动程序是分开的,避免了主程序因数据库驱动程序“体积”过大的缺陷;(1), the main program and the database driver are separated, avoiding the defect that the main program is too large due to the "volume" of the database driver;

(2)、易于配置,驱动程序类可配置,且很容易为用户提供一个图形化的配置界面;(2), easy to configure, the driver class can be configured, and it is easy to provide users with a graphical configuration interface;

(3)、数据库驱动程序升级很容易,只要修改配置文件,即可给程序换上合适的驱动程序,不用修改程序包,或者修改CLASSPATH;(3) It is very easy to upgrade the database driver, as long as the configuration file is modified, the program can be replaced with a suitable driver, without modifying the program package or modifying the CLASSPATH;

(4)、易管理,提供一种简单的数据库驱动程序集中管理模式——多个客户端可从一个地方下载并加载驱动程序,由单独的服务器管理驱动程序的更新。(4) Easy to manage, providing a simple centralized management mode of the database driver - multiple clients can download and load the driver from one place, and a separate server manages the update of the driver.

附图说明Description of drawings

下面将结合附图及实施例对本发明作进一步说明,附图中:The present invention will be further described below in conjunction with accompanying drawing and embodiment, in the accompanying drawing:

图1是用于实现本发明方法的原理图;Fig. 1 is a schematic diagram for realizing the method of the present invention;

图2是利用本发明的方法与数据建立连接的流程图;Fig. 2 is the flow chart that utilizes method of the present invention to establish connection with data;

图3是查找数据库驱动程序的流程图;Fig. 3 is the flowchart of searching database driver;

图4是本发明中数据库装载器与数据库驱动程序文件服务器之间的通讯交互示意图。Fig. 4 is a schematic diagram of the communication interaction between the database loader and the database driver file server in the present invention.

具体实施方式Detailed ways

本发明方法的原理如图1所示,本图采用的UML标准,其中每一个中文框经虚线连接到一个对应的英文框,将英文框图中内容翻译成中文。为实施本发明的方法,需要提供了如下一些模块:The principle of the method of the present invention is as shown in Figure 1, the UML standard that this figure adopts, wherein each Chinese frame is connected to a corresponding English frame through a dotted line, and the content in the English frame is translated into Chinese. For implementing the method of the present invention, some following modules need to be provided:

1、数据库驱动程序装载器(FlexDriverLoader),用于在指定的数据库驱动程序的压缩文件中寻找数据库驱动程序;1. The database driver loader (FlexDriverLoader), used to find the database driver in the compressed file of the specified database driver;

2、数据库驱动程序管理器(FlexDriverManager),用于根据指定的数据库驱动程序、URL(统一资源定位标记:Internet的WWW服务程序上用于指定信息位置的表示方法)、用户名及密码,提供数据库的连接;2. The database driver manager (FlexDriverManager) is used to provide the database according to the specified database driver, URL (uniform resource location mark: the representation method used to specify the location of information on the WWW service program of the Internet), user name and password. Connection;

3、数据库驱动程序文件服务器(DriverClassFileServer),用于管理多种数据库的JDBC驱动程序,响应数据库驱动程序装载器的请求,提供下载驱动程序的功能;3. The database driver file server (DriverClassFileServer), which is used to manage JDBC drivers of various databases, responds to the request of the database driver loader, and provides the function of downloading the driver;

4、配置者(DriverConfig):用于读取配置,可实现文本配置或XML(扩展标记语言)配置,并为数据库驱动程序装载器指定驱动程序,可以指定多个压缩文件;4. Configurator (DriverConfig): used to read the configuration, which can implement text configuration or XML (Extended Markup Language) configuration, and specify the driver for the database driver loader, and can specify multiple compressed files;

5、客户程序(Client):用于调用驱动程序管理器以获得数据库连接。5. Client program (Client): used to call the driver manager to obtain a database connection.

本发明中,驱动程序装载器可实现两种搜索驱动程序方式,具体方式如下:其一是Java提供的标准的类装载方法,即由Class.forName()方法在CLASSPATH(类路径)中搜索驱动程序类;其二是由数据库驱动程序管理器提供的类装载方法,由“数据库驱动程序装载器”与“数据库驱动程序文件服务器”配合以完成搜索并加载驱动程序的任务。In the present invention, driver program loader can realize two kinds of search driver mode, and specific mode is as follows: the one is the standard class loading method that Java provides, promptly searches for driver in CLASSPATH (class path) by Class.forName () method The second is the class loading method provided by the database driver manager, and the "database driver loader" cooperates with the "database driver file server" to complete the task of searching and loading the driver.

如图2所示,本发明中对这两种方式的使用是有先后的,优先考虑使用Java提供的标准的类装载方法,如果该方法找不到数据库驱动程序,将使用数据库驱动程序管理器提供的类装载方法。As shown in Figure 2, the use of these two methods is sequential in the present invention, and the standard class loading method provided by Java is given priority. If the method cannot find the database driver, the database driver manager will be used Provided class loading methods.

因此,本发明实际上是扩展了Java的数据库类装载方法,为客户提供了一种更灵活的数据库驱动程序的装载方法。Therefore, the present invention actually expands the Java database class loading method, and provides a more flexible database driver loading method for customers.

关于数据库驱动程序管理器提供的类装载方法,由图1中的结构,又可以组成两种由“数据库驱动程序装载器”与“数据库驱动程序文件服务器”配合完成的方法,其一是本地数据库驱动程序的装载方法;其二是网络数据库驱动程序的装载方法。下面分别对这两种方案的工作流程进行说明。Regarding the class loading method provided by the database driver manager, from the structure in Figure 1, two methods can be formed by the cooperation of the "database driver loader" and the "database driver file server". One is the local database The loading method of the driver; the second is the loading method of the network database driver. The workflows of the two schemes are described below respectively.

一、本地数据库驱动程序的装载方法1. Loading method of local database driver

所谓本地数据库驱动程序的装载方法,是指数据库驱动程序存放在本机上(本地),由数据库驱动程序装载器负责完成数据库驱动程序的本地搜索及加载的工作。具体流程如图3所示:The loading method of the so-called local database driver means that the database driver is stored on the local machine (local), and the database driver loader is responsible for completing the local search and loading of the database driver. The specific process is shown in Figure 3:

1、驱动程序管理器接受并处理建立数据库连接的请求。1. The driver manager accepts and processes the request to establish a database connection.

其中,客户可以直接指定用某个数据库的驱动程序来建立连接,而不仅仅像JDK(JAVA开发工具包)提供DriverManager只提供URL,及登陆用户密码信息来建立数据库的连接,这里建立数据库连接的工作均由名为getConnection()的静态方法完成,方法所带参数为:Among them, the customer can directly specify a database driver to establish a connection, instead of just providing the DriverManager as JDK (JAVA Development Kit) only provides the URL and login user password information to establish a database connection. Here, the database connection is established The work is done by a static method named getConnection(), and the parameters of the method are:

String driver    驱动类名String driver driver class name

String url       数据库的url信息String url The url information of the database

String user      数据库用户名String user database user name

String password  密码信息String password password information

数据库驱动程序管理器接受请求后将向数据库驱动程序装载器发出加载数据库驱动程序的请求。After the database driver manager accepts the request, it will send a request to the database driver loader to load the database driver.

2、数据库驱动程序装载器接受并处理加载数据库驱动程序的请求。2. The database driver loader accepts and processes the request to load the database driver.

其中,数据库驱动程序装载器根据要加载的类从压缩文件中搜索数据库驱动程序。寻找的过程由lookFile(查找文件)方法完成的,LookFile方法的流程如图3所示。在寻找前必须设置要搜索的数据库驱动程序的压缩文件,设置的工作由addDriverFile()方法完成,如果在本地找不到所需的数据库驱动程序,则抛出‘ClassNotFoundException’(无法找到类的异常)的异常供检测。Among them, the database driver loader searches the database driver from the compressed file according to the class to be loaded. The search process is completed by the lookFile (find file) method, and the flow of the LookFile method is shown in Figure 3. Before searching, you must set the compressed file of the database driver to be searched. The work of setting is completed by the addDriverFile() method. If the required database driver cannot be found locally, a 'ClassNotFoundException' (exception that the class cannot be found ) for detection of anomalies.

数据库驱动程序装载器完成加载工作后将向驱动程序管理器返回加载的类。After the database driver loader finishes loading, it will return the loaded classes to the driver manager.

3、驱动程序管理器向客户返回一个数据库连接。3. The driver manager returns a database connection to the client.

在具体实施上述三个步骤时,由于不涉及网络操作,所以可以不用管数据库驱动程序文件服务器的配置。首先,在配置文件中或其它地方(如命令行、输入框等)配置驱动程序的位置信息,即数据库驱动程序的位置;配置类对象(配置者)将读取驱动程序的信息,并为数据库驱动程序装载器添加相应的驱动资源。然后,客户程序调用驱动程序管理器的“getConnection”方法获取数据库连接,该方法需要如下信息:驱动程序类名、URL、用户名以及密码。比如客户程序中可以这样写:When implementing the above three steps, since no network operation is involved, the configuration of the database driver file server can be ignored. First, configure the location information of the driver in the configuration file or other places (such as command line, input box, etc.), that is, the location of the database driver; the configuration class object (configurator) will read the information of the driver and provide The driver loader adds the corresponding driver resources. Then, the client program calls the "getConnection" method of the driver manager to obtain a database connection, which requires the following information: driver class name, URL, user name, and password. For example, the client program can be written like this:

String driver="com.sybase.jdbc2.jdbc.SybDriver";String driver="com.sybase.jdbc2.jdbc.SybDriver";

String url="jdbc:sybase:Tds:10.40.99.1:5000/billdb";String url="jdbc:sybase:Tds:10.40.99.1:5000/billdb";

String user="sa";String user="sa";

String password=〃〃;String password=〃〃;

Connection conn=Connection conn=

FlexDriverManager.getConnection(driver,url,user,password);FlexDriverManager.getConnection(driver, url, user, password);

如果连接成功则返回数据库连接给客户程序应用;如果失败抛出异常供客户程序检测并处理。If the connection is successful, return the database connection to the client program application; if it fails, throw an exception for the client program to detect and process.

二、网络数据库驱动程序的装载方法Second, the loading method of the network database driver

所谓网络数据库驱动程序的装载方法,是指数据库驱动程序存放在数据库驱动程序文件服务器上,由数据库驱动程序文件服务器与数据库驱动程序装载器配合完成数据库驱动程序的网络搜索(在服务器上搜索)及加载的工作。本方法与“本地数据库驱动程序的装载方法”不同之处在于,数据库驱动程序装载器和数据库驱动程序文件服务器必须执行一些网络操作才能完成搜索的任务。下面只是介绍数据库驱动程序装载器与数据库驱动程序文件服务器之间如何完成网络操作的流程,其它流程与“本地数据库驱动程序的装载方法”一样。其中,数据库驱动程序装载器与数据库驱动程序文件服务器是通过HTTP 1.0协议进行通讯的,如图4所示,通讯流程如下:The loading method of the so-called network database driver means that the database driver is stored on the database driver file server, and the database driver file server cooperates with the database driver loader to complete the network search of the database driver (search on the server) and Loaded work. The difference between this method and the "local database driver loading method" is that the database driver loader and the database driver file server must perform some network operations to complete the task of searching. The following is just an introduction to the process of how to complete the network operation between the database driver loader and the database driver file server, and other processes are the same as the "Loading method of the local database driver". Among them, the database driver loader and the database driver file server communicate through the HTTP 1.0 protocol, as shown in Figure 4, the communication process is as follows:

1、数据库驱动程序装载器向数据库驱动程序文件服务器发出查找某个数据库驱动程序类的请求。1. The database driver loader sends a request to the database driver file server to find a certain database driver class.

2、数据库驱动程序文件服务器根据请求在所配置的驱动压缩文件中寻找,如果找到则用返回成功的消息,并将类文件附加在消息体中发送到数据库驱动程序装载器;如果找不到相应类,则返回失败的消息给数据库驱动程序装载器。2. The database driver file server searches in the configured driver compressed file according to the request, and returns a successful message if found, and attaches the class file in the message body and sends it to the database driver loader; if no corresponding class, a failure message is returned to the database driver loader.

3、数据库驱动程序装载器完成加载工作后将向驱动程序管理器返回加载的类;如果没有找到可加载的类则抛出ClassNotFoundException的异常供检测。3. After the database driver loader completes the loading work, it will return the loaded class to the driver manager; if no class that can be loaded is found, an exception of ClassNotFoundException will be thrown for detection.

在具体实施上步骤时,由于涉及到网络操作,所以流程比本地加载数据库驱动程序要稍微复杂一些,具体如下:When implementing the above steps, the process is slightly more complicated than loading the database driver locally because it involves network operations, as follows:

(1)数据库驱动程序文件服务器配置服务监听端口,配置服务器要管理的数据库驱动程序压缩包或者驱动类目录。(1) The database driver file server configures the service listening port, and configures the database driver compressed package or driver class directory to be managed by the server.

(2)启动数据库驱动程序文件服务器,命令行如下:(2) Start the database driver file server, the command line is as follows:

Java FlexClassFileServer,Java FlexClassFileServer,

可以用浏览器检验数据库驱动程序文件服务器是否启动成功。You can use a browser to verify whether the database driver file server has started successfully.

假设数据库驱动程序文件服务器所在机器IP地址为:10.40.57.4,设定端口为8898,且管理了以下一些数据库驱动程序压缩包:Suppose the IP address of the machine where the database driver file server is located is: 10.40.57.4, the port is set to 8898, and the following database driver compressed packages are managed:

Sybase的JDBC驱动程序包:jconn2.jarSybase JDBC driver package: jconn2.jar

Oracle的JDBC驱动程序包:816classes12.zipOracle's JDBC driver package: 816classes12.zip

在浏览器中输入 http://10.40.57.4:8898/SybVersion.class后,如果出现下载的提示,则说明数据库驱动程序文件服务器启动成功。注意测试时每个类要带有完整的包名,例如:http://10.40.57.4:8898/oracle.JDBC.driver.OracleSql.class可以成功,但如果写成 http://10.40.57.4:8898/OracleSql.class就会失败。如果没有下载提示则说明没有启动数据库驱动程序文件服务器或者启动有误或者测试本身有误(比如没有输入正确的类名及包名)。数据库驱动程序文件服务器启动成功后方能继续执行下面流程,否则没有意义。After entering http://10.40.57.4:8898/SybVersion.class in the browser, if a download prompt appears, it means that the database driver file server has started successfully. Note that each class should have a complete package name when testing, for example: http://10.40.57.4:8898/oracle.JDBC.driver.OracleSql.class can be successful, but if it is written as http://10.40.57.4:8898 /OracleSql.class will fail. If there is no download prompt, it means that the database driver file server has not been started, or the startup is wrong, or the test itself is wrong (such as not entering the correct class name and package name). The following process can only be continued after the database driver file server is started successfully, otherwise it is meaningless.

(3)在本地配置文件中或其它地方(如命令行,或输入框等)配置驱动程序的位置信息,包括数据库驱动程序文件服务器的IP地址及监听端口。(3) Configure the location information of the driver program in the local configuration file or other places (such as the command line, or the input box, etc.), including the IP address and the listening port of the database driver file server.

(4)客户程序调用驱动程序管理器的“getConnection”方法获取数据库连接,该方法需要如下信息:驱动程序类名、URL、用户名、密码。如果获取连接成功则返回数据库连接给客户程序应用。如果失败将抛出异常供客户程序检测并处理。(4) The client program calls the "getConnection" method of the driver manager to obtain the database connection, which requires the following information: driver class name, URL, user name, password. If the connection is obtained successfully, the database connection is returned to the client program application. If it fails, an exception will be thrown for the client program to detect and process.

本发明的方法在计费查询系统中应用时,效果良好,能够实现查询程序与数据库驱动程序分开,并能方便地升级数据库驱动程序。When the method of the invention is applied in the billing inquiry system, the effect is good, the inquiry program can be separated from the database driver program, and the database driver program can be upgraded conveniently.

Claims (6)

1, a kind of stowage of JAVA database device, wherein, by driver manager accept and handle that the client sent set up the database connection requests, and the standard method of adopting JAVA to provide searches required database device, if find then connect with this database device and database; It is characterized in that, if can not find required database device, then by carrying out following steps:
A, the request of sending the loading of databases driver by described driver manager to the database device loading bin;
B, described database-driven loading bin are searched required database device on this machine or the webserver, if find required database device, then it is turned back to described driver manager;
C, use the database device and the database that are found to connect.
2, method according to claim 1 is characterized in that, the compressed file of database device can be left on this machine, searches required database device by described database device loading bin on this machine.
3, method according to claim 2, it is characterized in that, in described step B, database device name in the request of sending according to described driver manager, each entrance of compressed file is searched,, then the file that finds is carried out decompress(ion) if find the file of required database device, and the definition class, return the database device of decompress(ion) and definition then to described driver manager; If in all compressed file entrances, can not find required database device, then return abnormal information.
4, method according to claim 3 is characterized in that, the operation of described definition class comprises to JAVA virtual machine registration class, and sets up the corresponding relation of class name and class byte.
5, method according to claim 1, it is characterized in that, the compressed file of database device can be left in the database device file server, search required database device by network from described database device file server by described database device loading bin.
6, method according to claim 5, it is characterized in that, in described step B, driver name in the request of sending according to described driver manager, described database device loading bin sends the request of searching required database device to described database device file server; Described database device file server is searched in stored compressed file, if find then return success message and give described database device loading bin, and the file that finds is attached to sends to described database device loading bin in the message body, again it is turned back to described driver manager;
If described database device file server can not find required database device in stored compressed file, then return failed message and give described database device loading bin; Described database device loading bin returns abnormal information to described driver manager again.
CNB021452210A 2002-11-08 2002-11-08 Loading method of driving program for database Expired - Fee Related CN1317638C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB021452210A CN1317638C (en) 2002-11-08 2002-11-08 Loading method of driving program for database

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB021452210A CN1317638C (en) 2002-11-08 2002-11-08 Loading method of driving program for database

Publications (2)

Publication Number Publication Date
CN1499366A CN1499366A (en) 2004-05-26
CN1317638C true CN1317638C (en) 2007-05-23

Family

ID=34232316

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB021452210A Expired - Fee Related CN1317638C (en) 2002-11-08 2002-11-08 Loading method of driving program for database

Country Status (1)

Country Link
CN (1) CN1317638C (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103164455B (en) * 2011-12-15 2016-08-03 百度在线网络技术(北京)有限公司 The optimization method and device of data base
CN103309704A (en) * 2013-05-09 2013-09-18 苏州泽佑科技有限公司 Android driving program loading method
CN103491171A (en) * 2013-09-24 2014-01-01 成都金山数字娱乐科技有限公司 Network resource asynchronous loading method and device
CN105159982A (en) * 2015-08-28 2015-12-16 浪潮(北京)电子信息产业有限公司 Method and system for connecting DB2 databases in Unix operation system
CN106934649A (en) * 2016-11-09 2017-07-07 东北大学秦皇岛分校 A kind of electricity market price simulation system and its loading method

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1249877A (en) * 1997-08-07 2000-04-05 西门子公司 Method and loading function provided by first computer (server) onto second computer (client)

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1249877A (en) * 1997-08-07 2000-04-05 西门子公司 Method and loading function provided by first computer (server) onto second computer (client)

Also Published As

Publication number Publication date
CN1499366A (en) 2004-05-26

Similar Documents

Publication Publication Date Title
US7114159B2 (en) Processing resource for use in a distributed processing framework system and methods for implementing the same
CN108037961A (en) A kind of application program collocation method, device, server and storage medium
CN112083951A (en) Software package unified management method and system supporting multiple operating system platforms
CN1608248A (en) Provisioning aggregated services in a distributed computing environment
CN1967485A (en) Method and system for realizing J2EE application
CN1791037A (en) Method for realizing Web service automatic test
CN1617496A (en) Method for automatic upgrade configuration of next generation network terminal
CN1317638C (en) Loading method of driving program for database
CN1790257A (en) Method for uniformly configuring configuration files
US7593917B2 (en) Implementation of application management operations
CN104468811A (en) Upgrading method and device
CN1556609A (en) Mobile robot network control platform device
US12367014B2 (en) Event consumption for high-level programing language platform
CN106802790A (en) Method, equipment and system that application user use information based on cloud platform is managed
CN1744498A (en) A network server and data interaction method between the network server and the browser
CN1300981C (en) A mobile data service content management system and implementing method thereof
CN1537392A (en) Service application framework for integrating network service providers
CN100428166C (en) Method and device for processing client calling remote interface to access EJB
CN1829162A (en) Information processing system, management device and management method
CN1852170A (en) Method and system for realizing apparatus management based on standard platform
CN101923547A (en) A system for sharing computing resources
CN1656450A (en) Systems and methods for managing operating system option values
CN100340991C (en) Cross-platform computer testing system and method
CN1442800A (en) Dynamic SNMP Network Devices
CN1421799A (en) Real-time data customer service system and method thereof

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20070523

Termination date: 20171108