JP2004302840A - Data base access method - Google Patents
Data base access method Download PDFInfo
- Publication number
- JP2004302840A JP2004302840A JP2003094791A JP2003094791A JP2004302840A JP 2004302840 A JP2004302840 A JP 2004302840A JP 2003094791 A JP2003094791 A JP 2003094791A JP 2003094791 A JP2003094791 A JP 2003094791A JP 2004302840 A JP2004302840 A JP 2004302840A
- Authority
- JP
- Japan
- Prior art keywords
- class
- database
- access
- data
- data base
- 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.)
- Pending
Links
Images
Abstract
Description
【0001】
【発明の属する技術分野】
本発明は、複数の異なるデータベースアクセス方式によるデータベースへのアクセスを同一のインタフェースでアクセスできるようにするためのデータベースアクセス方法に関するものである。
【0002】
【従来の技術】
データベースにアクセスするためには、使用するデータベースアクセス方式として定められた規約に準拠したデータベース操作手続きを記述しなければならない。したがって、例えば、大量のデータをデータベースに登録する場合には高速に登録処理を行なうことができるSQL(Structured Query Language)ローダを使用してバッチ処理的に登録する。しかし、データベースを検索したり更新するような場合には、登録機能しかないSQLローダを使用することはできないため、JDBC(Java(登録商標) DataBase Connectivity)など別のデータベースアクセス方式のソフトウェアを使用してデータベースにアクセスすることになる。このように、複数の異なるデータベースアクセス方式を用いてデータベースをアクセスするためには、各データベースアクセス方式で規定された形式に準拠したデータベース操作手続きを記述するというように、データベースアクセス方式によりデータベース操作手続きを使い分ける必要があった。
【0003】
そのため、従来の複数の異なるデータベースアクセス方式を使用したデータベースのアクセスにおいては、ソフトウェア開発者によるアプリケーション・ソフトウェアなどの開発作業が複雑になったり、データベース利用者にとってデータベースのアクセスが面倒であるといった問題があった。また、データベースのテーブル構造に応じて人が手書きでクラス等を定義しなければならないため、手間がかかっていた。尚、従来技術としては特許文献1が公開されている。
【0004】
【特許文献1】
特開平5−197600号公報
【0005】
【発明が解決しようとする課題】
本発明は、上記の問題に鑑みてなされたもので、複数の異なるデータベースアクセス方式を使用したデータベースへのアクセスを容易にするために、データベースのアクセス方式が異なっても一つのインタフェースで統一するデータベースのアクセス方法、およびそのためのクラスやデータベース操作手続きを自動生成する方法を提供することを目的とする。
【0006】
【課題を解決するための手段】
この発明は、上記の課題を解決すべくなされたもので、請求項1に記載の発明は、複数の異なるデータベースアクセス方式を用いてデータベースをアクセスするデータベースアクセス方法において、端末から前記データベースをアクセスするためのデータおよびデータベース操作種別を受信し、前記受信したデータベース操作種別を識別し、前記識別したデータ操作種別に対応したデータベースアクセス方式で定められた所定の規則に準拠したデータベースアクセス形式に前記データおよびデータベース操作種別を変換し、前記データベースアクセス形式を用いて前記データベースにアクセス要求を出すことを特徴とするデータベースアクセス方法である。
【0007】
請求項2に記載の発明は、請求項1に記載のデータベースアクセス方法において、前記データベースアクセス形式への変換は、前記受信したデータを前記データベースの対応するテーブルと同一形式で格納するためのテーブルクラスおよび前記データベースアクセス方式に対応した制御用のテーブルアクセスクラスを、前記データベースのテーブルに対応付けて予め生成しておき、前記受信したデータを対応する前記テーブルクラスに格納し、前記識別したデータ操作種別に対応した前記テーブルアクセスクラスに記述された前記所定の規則にしたがって前記データおよびデータベース操作種別を変換することを特徴とする。
【0008】
請求項3に記載の発明は、請求項2に記載のデータベースアクセス方法において、前記テーブルクラスおよびテーブルアクセスクラスの生成は、前記データベースのテーブルに対応して予め準備されているテーブルクラス生成用雛形ファイル、および前記データベースアクセス方式に対応して予め準備されているテーブルアクセスクラス雛形ファイルと、前記データベースの属性情報をもとに生成することを特徴とする。
【0009】
【発明の実施の形態】
以下、本発明の実施の形態によるデータベースアクセス方法について説明する。ここでは、2通りのデータベースアクセス方式(JDBCおよびSQLローダ)を使用する場合に本発明を適用したデータベースアクセス方法について図1を参照して説明する。図1は本発明をアプリケーションサーバ(APサーバ)に適用した実施の形態によるシステム全体を示すブロック図である。図1において、10は、様々なデータを格納するデータベース(DB)である。20は利用者がDB10をアクセスする際に利用するクライアント(端末)であり、30はDB10を利用して様々な処理を行なう社内システムである。50は、本発明を適用した各種のアプリケーションサービスを提供するAPサーバであり、Web系(オンライン)の機能が実行されるWeb系DBアクセス部540とバッチ系の機能が実行されるバッチ系DBアクセス部560およびユーザプログラム580で構成(特許請求の範囲に記載のデータベースアクセス手段に相当)される。
【0010】
Web系DBアクセス部540は、JDBCを使用してDB10に対して検索、更新、登録および削除の全ての操作を可能としている。これに対して、バッチ系DBアクセス部560は、SQLローダを使用してDB10に対して登録の操作のみを可能としている。そのため、バッチ系DBアクセス部560は、Web系DBアクセス部540よりも高速にDB10に登録操作を行なうことが可能である。また、ユーザプログラム580は、クライアント20や社内システム30とのインタフェースを司るとともに、Web系DBアクセス部540やバッチ系DBアクセス部560を制御してDB10にアクセスする。
【0011】
なお、図1に示した各処理部は専用のハードウェアにより実現されるものであってもよく、また、これらの処理部はメモリおよびCPU(中央演算装置)により構成され、各処理部に機能を実現するためのプログラム(図示せず)をメモリにロードして実行することによりその機能を実現させるものであってもよい。また、記憶部(図示せず)は、ハードディスク装置や光ディスク装置、フラッシュメモリなどの不揮発性メモリや、RAM(Random Access Memory)のような揮発性のメモリ、あるいはこれらの組合せにより構成されるものとする。
【0012】
また、図1における各処理部の機能を実現するためのプログラムをコンピュータ読み取り可能な記録媒体に記録して、この記録媒体に記録されたプログラムをコンピュータシステムに読み込ませ、実行することにより各処理部の処理を行ってもよい。なお、ここでいう「コンピュータシステム」とは、OSや周辺機器などのハードウェアを含むものとする。
【0013】
次に、本発明の実施の形態の動作の概要について図1を参照して説明する。図1において、クライアント20や社内システム30からDB10にアクセスする際、DB10にデータを登録する場合には、クライアント20または社内システム30でJDBCまたはSQLローダのいずれを使用するかを指定することにより、ユーザプログラム530は指定されたJDBCまたはSQLローダに対応したWeb系DBアクセス部540またはバッチ系DBアクセス部560のいずれかを選択し、選択したWeb系DBアクセス部540またはバッチ系DBアクセス部560を制御してDB10にアクセスしデータを登録する。また、DB10に対して検索、更新および削除のいずれかを行なう場合には、ユーザプログラム580の制御によりWeb系DBアクセス部540によってJDBCを使ってDB10をアクセスして、検索、更新または削除の処理を行なう。なお、これらの動作の詳細については後述する。
【0014】
次に、図1のWeb系DBアクセス部540、バッチ系DBアクセス部560におけるDBアクセスクラスの自動生成について、図2を参照して説明する。図2において、図1と同一部分には同一符号を付して、その説明を省略する。図2は、DBアクセスクラス自動作成プログラムによってDBアクセスクラスを自動生成する仕組みを示す図である。ここで、DBアクセスクラスとは、DB10をアクセスするために必要な情報であるデータ、テーブル名、データベース操作内容などのデータや制御情報を格納するためのクラスである。
【0015】
図2において、DB10はデータのほかに属性情報11を保持している。属性情報11は、テーブル名、カラム名、データ型といったDB10に格納されているテーブルに関する情報である。510はDBアクセスクラス530を自動生成するために必要な6種類の雛形ファイルから構成される雛形ファイルの総称である。511はDB10の属性情報11のテーブル名に対応したテーブルクラス541を生成するためのテーブルクラス生成用雛型ファイルであり、そのファイルの中にDB10の属性情報11に置換するための置換用文字列が埋め込まれている。512はテーブルコレクションクラス542を生成するためのコレクションクラス生成用雛型ファイルであり、その中に属性情報11に置換するための置換用文字列が埋め込まれている。
【0016】
また、513はテーブルアクセスクラス543を生成するためのテーブルアクセスクラス生成用雛型ファイルであり、その中に属性情報11に置換するための置換用文字列が埋め込まれている。514はSQLローダ実行用クラス561を生成するためのSQLローダ実行用クラス生成用雛型ファイルであり、その中に属性情報11に置換するための置換用文字列が埋め込まれている。515はCTLファイル562を生成するためのCTLファイル生成用雛型ファイルであり、その中に属性情報11に置換するための置換用文字列が埋め込まれている。516は登録データCSVファイル作成用クラス563を生成するための雛型ファイルであり、その中に属性情報11に置換するための置換用文字列が埋め込まれている。
【0017】
そして、520は、雛型ファイル510とDB10より取得するテーブル名、カラム名、データ型といった属性情報11を入力情報として、DBアクセスクラス530の自動生成を行うDBアクセスクラス自動生成プログラムである。DBアクセスクラス530は、Web系DBアクセス部540およびバッチ系DBアクセス部560の各クラスから構成され、DB10にアクセスするために必要な情報を持つ様々なクラスの総称である。
【0018】
JDBCを使用してDB10へのアクセス処理を行うWeb系DBアクセス部540のクラスは、テーブルクラス群541g、テーブルコレクションクラス群542gおよびテーブルアクセスクラス群543gで構成される。ここで、テーブルクラス群541g、テーブルコレクションクラス群542gおよびテーブルアクセスクラス群543gは、それぞれ、DB10のテーブルの数だけテーブルクラス541、テーブルコレクションクラス542、テーブルアクセスクラス543を持つクラスである。
【0019】
テーブルクラス541は、DB10のテーブルに対応したクラスであり、テーブルアクセスクラス543に送るキー項目、更新用データ、登録用データを設定する。テーブルコレクションクラス542は、テーブルクラス541をvector型で複数持つことができ、同じ顔つきをした複数行のデータの扱いを簡単にすることを目的とするクラスである(テーブルクラス541とテーブルコレクションクラス542は特許請求の範囲に記載のテーブルクラスに相当)。テーブルアクセスクラス543は、JDBCを使用してDB10にアクセスするための制御用のクラスである。
【0020】
また、SQLローダを使用してDB10へのアクセス処理を行うバッチ系DBアクセス部560は、SQLローダ実行用クラス群561g、CTLファイル群562gおよび登録データCSVファイル作成用クラス群563gで構成される。ここで、SQLローダ実行用クラス群561g、CTLファイル群562gおよび登録データCSVファイル作成用クラス群563gは、それぞれ、SQLローダ実行用クラス561、CTLファイル562、登録データCSVファイル作成用クラス563をテーブル数だけ備えている。SQLローダ実行用クラス561は、DB10にSQLローダを使用してアクセスするための制御用のクラスである。CTLファイル562は、SQLローダを使用するために必要な設定ファイルである。登録データCSVファイル作成用クラス563は、SQLローダ実行用クラス561に送る登録データをCSVファイルとして作成するための制御用のクラスである。
【0021】
次に、図2を参照してDBアクセスクラスを自動生成する動作について説明する。図2において、まず、DBアクセスクラス自動生成プログラム520は、DB10に接続し(ステップS1)、DB10より属性情報11を取得する(ステップS2)。また、DBアクセスクラス自動生成プログラム520は、テーブルクラス生成用雛型ファイル511を読み込み、テーブルクラス生成用雛形ファイル511の中の置換用文字列をステップS2で取得した属性情報11に置換し、テーブルクラス541を作成する。これを、属性情報11、すなわちテーブルの数だけ繰り返しテーブルクラス群541gを作成する(ステップS3)。このテーブルクラスの作成の詳細については、具体例を用いて後述する。
【0022】
そして、DBアクセスクラス自動生成プログラム520は、同様にして、テーブルコレクションクラス生成用雛型ファイル512、テーブルアクセスクラス生成用雛型ファイル513、SQLローダ実行用クラス生成用雛型ファイル514、CTLファイル生成用雛型ファイル515、登録データCSVファイル作成用クラス生成用雛型ファイル516、および属性情報11をもとに、テーブルコレクションクラス群542g、テーブルアクセスクラス郡543g、SQLローダ実行用クラス群561g、CTLファイル群562g、登録データCSVファイル作成用クラス群563gを作成し(ステップS4〜ステップS8)、DBアクセスクラス530の生成を終了する。
【0023】
次に、図2で説明したDBアクセスクラス自動生成プログラム520によって、テーブルクラス生成用雛形ファイル511からテーブルクラス(ファイル)541を作成した一例を図3、図4に示す。図3はデータベースDB10の属性情報11の取り出しおよびテーブルクラス生成用雛形ファイル511の一例(関連する部分を抜粋)を示す図であり、図4は作成されたテーブルクラス(ファイル)541の一例(関連部分を抜粋)を示す図である。図3に示すテーブルクラス生成用雛形ファイル511の中の置換用文字列の部分がDB10の該当する属性情報11の内容により置換されて図4に示すテーブルクラス(ファイル)541が作成される。
【0024】
例えば、図3の3行目のpublic class Table%TABLE_NAME%{の中のTableは置換用文字列%TABLE_NAME%を属性情報11のテーブル名と置換することを意味しているため、この部分をテーブル名USERに置換し、図4の3行目に示すようにpublic class TableUSER{に変換される。テーブルクラス生成用雛形ファイル511の中の他の置換用文字列の部分についても、同様にして置換され、テーブルクラス(ファイル)541が作成される。また、図2に示したテーブルコレクションクラス542など他のクラスについても、テーブルクラス541の場合と同様にして作成される。
【0025】
次に、DB10へデータを登録する場合の動作について図5を参照して説明する。図5は、クライアント20からDB10にデータを登録する場合の動作の流れを示す図である。図5において、図1または図2と同一部分には同一符号を付して、その説明を省略する。図5において、ユーザプログラム580は、クライアント20から登録するデータを受け取ると(ステップS50)、受け取ったデータをテーブルクラス541に設定する。この際、受け取ったデータが複数行ある場合には、1行分のデータをそれぞれ一つのテーブルクラス541に設定するため、テーブルクラス541は行数分の数だけ設定されることになる(ステップS51)。
【0026】
また、ユーザプログラム580は、設定したテーブルクラス541を全てテーブルコネクションクラス542に設定する(ステップS52)。そして、ユーザプログラム580は、ステップS50でデータとともに受信した、データベースを操作するメソッド(関数)(データベース操作種別)を識別し、その結果をもとに対応するJDBCまたはSQLローダのメソッドをテーブルアクセスクラス543に対してコールする(ステップS53)。コールされたテーブルアクセスクラス543のメソッドは、所定の方法でDB10にデータを登録する(ステップS54)。
【0027】
次に、図5で説明したDB10への登録動作についてさらに詳細に説明する。ここでは、JDBCとSQLローダを使用して、DB10に格納されているテーブル名が「ユーザ」であるテーブルに2つのデータを登録することとする。まず、図6を参照してJDBCを使用してDB10にデータを登録する場合の動作について説明する。図6はJDBCを使用したDBアクセスクラスの方式のイメージを示す図である。図6において、ユーザテーブルクラス541uはDB10の「ユーザ」テーブルに対応したテーブルクラスであり、ユーザテーブルコレクションクラス542uはユーザテーブルクラス541uのコレクションクラスである。
【0028】
図6において、ユーザプログラム580は、クライアント20から受け取ったユーザ番号、名字、名前およびメールアドレスで構成されるユーザ番号11とユーザ番号12の2つのデータをそれぞれユーザテーブルクラス541uの対応するユーザ番号、名字、名前およびメールアドレスの欄に設定し(ステップS61)、設定した2つのユーザテーブルクラス541uを順次、ユーザテーブルコレクションクラス542uに設定する(ステップS62)。また、データの登録を行なうJDBCのメソッドinsertTableUsersをユーザテーブルコレクションクラス542uのオブジェクト名tableUsersを引数としてコールする(ステップS63)。
【0029】
そして、ユーザプログラム580は、コールされたinsertTableUsersメソッドに対応したSQL文を作成するために、引数として受け渡されたオブジェクト名tableUsersのユーザテーブルコレクションクラス542uから対応するユーザテーブルクラス541uを取り出し(ステップS64)、ユーザテーブルクラス541uに設定されている、ユーザ番号、名字、名前およびメールアドレスと対応するテーブル名を作成するSQL文INSERTの所定の箇所に設定し、2つのSQL文を作成する(ステップS65)。この2つのSQL文を用いてDB10にアクセスすることによって、2つのデータがDB10に登録される。
【0030】
次に、図7を参照してSQLローダを使用してDB10にデータを登録する場合の動作について説明する。図7において、図6と同一部分には同一符号を付してある。図7は、SQLローダを使用したDBアクセスクラスの方式のイメージを示す図である。図7において、ユーザプログラム580は、クライアント20から受け取ったユーザ番号、名字、名前およびメールアドレスで構成されるユーザ番号11とユーザ番号12の2つのデータをそれぞれユーザテーブルクラス541uの対応するユーザ番号、名字、名前およびメールアドレスの欄に設定し(ステップS71)、これをユーザテーブルコレクションクラス542uに設定する(ステップS72)。そして、登録を行なうSQLローダのメソッドappendTableUsersをユーザテーブルコレクションクラスのオブジェクト名tableUsersを引数としてコールする(ステップS73)。
【0031】
次に、ユーザプログラム580は、コールされたappendTableUsersメソッドの引数として受け渡されたオブジェクト名tableUsersのユーザテーブルコレクションクラス542uから対応するユーザテーブルクラス541uを取り出し(ステップS74)、ユーザテーブルクラス541uに設定されているユーザ番号、名字、名前およびメールアドレスを用いて、CSVファイルを出力する(ステップS75)。また、ユーザプログラム580は、ユーザテーブルクラス541uを用いてSQLローダコマンドを作成し(ステップS76)、実行する。これにより、CSVファイル内の2つのデータがDB10に登録される。
【0032】
このように、JDBCをコールするためのメソッドinsertTableUser(tableUsers tables)とSQLローダをコールするためのメソッappendTableUsers(tableUsers tables)は、JDBCとSQLローダでメソッドの名前は異なるが、その引数tableUsers tablesは同じになるため、アプリケーション・ソフトウェアの開発やデータベース利用者はJDBCとSQLローダのメソッド名のみを意識すればよい。
【0033】
【発明の効果】
以上説明したように、この発明の請求項1および請求項2によれば、予め生成したテーブルクラスおよびテーブルアクセスクラスを用いて、端末から受信したデータベース操作種別を識別し、そのデータ操作種別に対応したデータベースアクセス方式に準拠したデータベースアクセス形式に受信したデータベース操作種別およびデータを変換し、このデータベースアクセス形式を用いてデータベースにアクセス要求を出すようにした。その結果、同一のインタフェースで複数のデータベースアクセス方式を容易に使い分けることができるようになり、アプリケーション・ソフトウェアなどのソフトウェア開発者の開発作業の負担を軽減することができる。また、データベースの利用者もデータベースを容易に利用できるようになる。さらに、データベースへのアクセスのルールを統一することにより、処理構造がわかりやすくなり、作業効率、保守性を向上することができる。
また、この発明の請求項3によれば、テーブルクラスおよびテーブルアクセスクラスの生成は、データベースのテーブルに対応して予め準備されているテーブルクラス生成用雛形ファイル、およびデータベースアクセス方式に対応して予め準備されているテーブルアクセスクラス生成用雛形ファイルと、データベースに予め格納されている属性情報をもとに自動的に生成するようにした。その結果、テーブル構造に応じて人が手書きでクラス等を定義する手間が無くなり、特に、テーブル数の多いデータベースほど手間を大幅に減らすことができる。
【図面の簡単な説明】
【図1】この発明の一実施形態によるデータベースアクセス方法を適用したシステムの構成を示すブロック図である。
【図2】同実施形態によるDBアクセスクラスの自動生成の仕組みを示す図である。
【図3】同実施形態によるテーブルクラス生成用雛形ファイルの一例を示す図である。
【図4】同実施形態によるテーブルクラス(ファイル)の一例を示す図である。
【図5】同実施形態によるクライアントからデータベースにデータを登録する場合の動作の流れを示す図である。
【図6】同実施形態によるJDBCを使用したDBアクセスクラスの方式のイメージを示す図である。
【図7】同実施形態によるSQLローダを使用したDBアクセスクラスの方式のイメージを示す図である。
【符号の説明】
10…データベース(DB)、20…クライアント、30…社内システム、50…APサーバ(アプリケーションサーバ)、510…雛形ファイル、520…DBアクセスクラス自動生成プログラム、530…DBアクセスクラス、540…Web系DBアクセス部、560…バッチ系DBアクセス部、580…ユーザプログラム[0001]
TECHNICAL FIELD OF THE INVENTION
The present invention relates to a database access method for enabling access to a database by a plurality of different database access methods using the same interface.
[0002]
[Prior art]
In order to access a database, a database operation procedure that conforms to the rules defined as the database access method to be used must be described. Therefore, for example, when registering a large amount of data in a database, the data is registered in a batch process using an SQL (Structured Query Language) loader that can perform registration processing at high speed. However, when searching or updating a database, it is not possible to use an SQL loader having only a registration function. Therefore, software of another database access method such as JDBC (Java (registered trademark) DataBase Connectivity) is used. To access the database. As described above, in order to access a database using a plurality of different database access methods, a database operation procedure conforming to the format specified by each database access method is described. Had to be used properly.
[0003]
As a result, in conventional database access using a plurality of different database access methods, there are problems in that the development work of application software and the like by software developers becomes complicated and database access is troublesome for database users. there were. In addition, a person must manually define a class or the like according to the table structure of the database, which is troublesome. Note that
[0004]
[Patent Document 1]
JP-A-5-197600
[Problems to be solved by the invention]
The present invention has been made in view of the above problems, and in order to facilitate access to a database using a plurality of different database access methods, a database that is unified with one interface even if the database access method is different. It is an object of the present invention to provide a method for automatically accessing a database and a method for automatically generating a class and a database operation procedure therefor.
[0006]
[Means for Solving the Problems]
SUMMARY OF THE INVENTION The present invention has been made to solve the above problems, and an invention according to
[0007]
According to a second aspect of the present invention, in the database access method according to the first aspect, the conversion into the database access format is a table class for storing the received data in the same format as a corresponding table in the database. And a control table access class corresponding to the database access method is generated in advance in association with the database table, the received data is stored in the corresponding table class, and the identified data operation type is stored. The data and the database operation type are converted according to the predetermined rule described in the table access class corresponding to.
[0008]
According to a third aspect of the present invention, in the database access method according to the second aspect, the generation of the table class and the table access class is performed by preparing a table class generating template file corresponding to a table of the database. , And a table access class template file prepared in advance corresponding to the database access method, and attribute information of the database.
[0009]
BEST MODE FOR CARRYING OUT THE INVENTION
Hereinafter, a database access method according to an embodiment of the present invention will be described. Here, a database access method to which the present invention is applied when two types of database access methods (JDBC and SQL loader) are used will be described with reference to FIG. FIG. 1 is a block diagram showing an entire system according to an embodiment in which the present invention is applied to an application server (AP server). In FIG. 1,
[0010]
The Web
[0011]
Each processing unit shown in FIG. 1 may be realized by dedicated hardware, and these processing units are configured by a memory and a CPU (Central Processing Unit). May be implemented by loading a program (not shown) for realizing the function into a memory and executing the program. The storage unit (not shown) includes a nonvolatile memory such as a hard disk device, an optical disk device, or a flash memory, a volatile memory such as a RAM (Random Access Memory), or a combination thereof. I do.
[0012]
Also, a program for realizing the function of each processing unit in FIG. 1 is recorded on a computer-readable recording medium, and the program recorded on this recording medium is read into a computer system and executed, thereby executing each processing unit. May be performed. Here, the “computer system” includes an OS and hardware such as peripheral devices.
[0013]
Next, an outline of the operation of the embodiment of the present invention will be described with reference to FIG. In FIG. 1, when data is registered in the
[0014]
Next, automatic generation of a DB access class in the Web
[0015]
In FIG. 2, a
[0016]
[0017]
[0018]
The classes of the Web
[0019]
The
[0020]
Further, the batch
[0021]
Next, an operation of automatically generating a DB access class will be described with reference to FIG. 2, first, the DB access class
[0022]
The DB access class
[0023]
Next, FIGS. 3 and 4 show an example in which a table class (file) 541 is created from the table class
[0024]
For example, since “Table” in “public class Table% TABLE_NAME%} on the third line in FIG. 3 indicates that the replacement character string% TABLE_NAME% is to be replaced with the table name of the attribute information 11, this part is replaced with a table. The name is replaced with USER, and as shown in the third line of FIG. 4, it is converted to public class TableUSER. Other replacement character strings in the table class
[0025]
Next, an operation for registering data in the
[0026]
Further, the
[0027]
Next, the registration operation to the
[0028]
In FIG. 6, the
[0029]
Then, the
[0030]
Next, an operation of registering data in the
[0031]
Next, the
[0032]
In this way, the method insertTableUser (tableUsers tables) for calling JDBC and the method applicableTableUsers (tableUsers tables) for calling SQL loader are different in the JDBC and SQL loader, but the method where le is the same as the argument sab is the same as the argument sab t sab Therefore, application software developers and database users need only be aware of the JDBC and SQL loader method names.
[0033]
【The invention's effect】
As described above, according to
According to the third aspect of the present invention, the table class and the table access class are generated in advance according to the table class generating template file prepared in advance corresponding to the database table and the database access method. It is automatically generated based on the prepared table access class generation template file and the attribute information stored in the database in advance. As a result, there is no need for a person to manually define a class or the like according to the table structure, and in particular, a database having a large number of tables can greatly reduce the trouble.
[Brief description of the drawings]
FIG. 1 is a block diagram showing a configuration of a system to which a database access method according to an embodiment of the present invention is applied.
FIG. 2 is a diagram showing a mechanism for automatically generating a DB access class according to the embodiment;
FIG. 3 is a view showing an example of a template file for generating table classes according to the embodiment;
FIG. 4 is a diagram showing an example of a table class (file) according to the embodiment.
FIG. 5 is a diagram showing an operation flow when data is registered in a database from a client according to the embodiment.
FIG. 6 is a diagram showing an image of a method of a DB access class using JDBC according to the embodiment.
FIG. 7 is a diagram showing an image of a method of a DB access class using an SQL loader according to the embodiment.
[Explanation of symbols]
Reference Signs List 10: database (DB), 20: client, 30: in-house system, 50: AP server (application server), 510: template file, 520: DB access class automatic generation program, 530: DB access class, 540: Web DB Access unit, 560: Batch DB access unit, 580: User program
Claims (3)
端末から前記データベースをアクセスするためのデータおよびデータベース操作種別を受信し、前記受信したデータベース操作種別を識別し、前記識別したデータ操作種別に対応したデータベースアクセス方式で定められた所定の規則に準拠したデータベースアクセス形式に前記データおよびデータベース操作種別を変換し、前記データベースアクセス形式を用いて前記データベースにアクセス要求を出すことを特徴とするデータベースアクセス方法。In a database access method for accessing a database using a plurality of different database access methods,
The terminal receives data and a database operation type for accessing the database from the terminal, identifies the received database operation type, and conforms to a predetermined rule defined by a database access method corresponding to the identified data operation type. A database access method comprising: converting the data and the database operation type into a database access format; and issuing an access request to the database using the database access format.
ことを特徴とする請求項1に記載のデータベースアクセス方法。The conversion to the database access format is performed by storing a table class for storing the received data in the same format as the corresponding table of the database and a table access class for control corresponding to the database access method, Is generated in advance in association with, the received data is stored in the corresponding table class, the data and the data according to the predetermined rule described in the table access class corresponding to the identified data operation type 2. The database access method according to claim 1, wherein a database operation type is converted.
ことを特徴とする請求項2に記載のデータベースアクセス方法。The generation of the table class and the table access class includes a table class generation template file prepared in advance corresponding to the database table, and a table access class template file prepared in advance corresponding to the database access method. 3. The database access method according to claim 2, wherein the information is generated based on attribute information of the database.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2003094791A JP2004302840A (en) | 2003-03-31 | 2003-03-31 | Data base access method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2003094791A JP2004302840A (en) | 2003-03-31 | 2003-03-31 | Data base access method |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2004302840A true JP2004302840A (en) | 2004-10-28 |
Family
ID=33407282
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2003094791A Pending JP2004302840A (en) | 2003-03-31 | 2003-03-31 | Data base access method |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2004302840A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2006293796A (en) * | 2005-04-13 | 2006-10-26 | Hitachi Software Eng Co Ltd | Database migration method |
CN111124718A (en) * | 2019-12-31 | 2020-05-08 | 中国银行股份有限公司 | Parameter data acquisition method, parameter data processing method and device and electronic equipment |
-
2003
- 2003-03-31 JP JP2003094791A patent/JP2004302840A/en active Pending
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2006293796A (en) * | 2005-04-13 | 2006-10-26 | Hitachi Software Eng Co Ltd | Database migration method |
JP4681338B2 (en) * | 2005-04-13 | 2011-05-11 | 株式会社日立ソリューションズ | Database migration method |
CN111124718A (en) * | 2019-12-31 | 2020-05-08 | 中国银行股份有限公司 | Parameter data acquisition method, parameter data processing method and device and electronic equipment |
CN111124718B (en) * | 2019-12-31 | 2024-04-19 | 中国银行股份有限公司 | Parameter data acquisition method, parameter data processing method, device and electronic equipment |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP3437849B2 (en) | Database management system and method for supporting object-oriented programming | |
US20030093420A1 (en) | Method and system for retrieving sharable information using a hierarchically dependent directory structure | |
US20080098037A1 (en) | Markup language based database upgrades | |
CN111259067B (en) | Method, device and equipment for realizing DAO interface based on Spring | |
CN113204571B (en) | SQL execution method and device related to write-in operation and storage medium | |
US20060015483A1 (en) | SQL query enhancement technique | |
JP2005301985A (en) | Information processor, object generation method, object conversion method, object generation program, object conversion program, and recording medium | |
JP3756407B2 (en) | Method for handling user-defined data type data items | |
US20090171922A1 (en) | System and Method for Dynamically Exposing SQL Statements as Web Protocols | |
JP2003248635A (en) | Database accessing method and system in management information base of network management protocol | |
JP2004302840A (en) | Data base access method | |
EP1881420B1 (en) | Mark Up Language Based Database Upgrades | |
JP3439368B2 (en) | Data conversion processing system and recording medium recording program for realizing the function | |
JP2003280956A (en) | Database case device | |
JP2923917B2 (en) | Data access method for large-scale knowledge database system | |
EP0126123A1 (en) | Dynamic data base representation | |
JP2002132502A (en) | Automatic creating system and method of distributed object with interpretation of language function | |
JP3472454B2 (en) | Business program creation support device and program storage medium | |
JP2785138B2 (en) | Genetic methods in large-scale knowledge database systems | |
JP2004252536A (en) | Program development support device | |
JPH01286020A (en) | Program retrieving system | |
JP2003177923A (en) | Reserved word converting method for porting support system | |
JP2003085013A (en) | Pdm system and programming method for system connection | |
US20180246900A1 (en) | File managing method and system thereof for integrated circuit design | |
JP2000347907A (en) | Automatic data file converting device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20061024 |
|
A02 | Decision of refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A02 Effective date: 20070417 |