PostgreSQL
PrevChapter 47. ODBC インターフェースNext

背景

The ODBC API matches up on the backend to an ODBC compatible data source. This could be anything from a text file to an Oracle RDBMS. ODBC APIはODBC互換のデータソースへのバックエンドと協調して動作する テキストファイルから Oracle RDBMS へ変換されるものなら、 どんなものでも ODBC 互換データソースとなりうる。

The backend access come from ODBC drivers, or vendor specifc drivers that allow data access. PostODBC is such a driver, along with others that are available, such as the OpenLink ODBC drivers. バックエンドはODBCドライバもしくはデータアクセスを許可するベンダー固有(の)ドライバ からアクセスする。PostODBCとは、OpenLink ODBCドライバの 様に利用可能な他のドライバと一緒に利用するドライバである。

Once you write an ODBC application, you SHOULD be able to connect to ANY back end database, regardless of the vendor, as long as the database schema is the same. ひとたびODBCアプリケーションを書けば、ベンダーに拘わらず、データベースス キーマが同一である限り、任意のデータベースに接続できるはずである。

For example. you could have MS SQL Server and PostgreSQL servers which have exactly the same data. Using ODBC, your Windows app would make exactly the same calls and the back end data source would look the same (to the windows app). 例えば、完全に同一のデータを持つ MS SQL サーバと PostgreSQL サーバが あるとしよう。ODBC を使えば、Windows アプリケーションは(双方の サーバ に対して)同一の呼び出しを行うことができ、またWindows アプリケーション から見て、データソースのバックエンドは双方とも全く同じように見える だろう。

In the real world, differences in drivers and the level of ODBC support lessens the potential of ODBC:

現実の世界では、ドライバやODBCの能力差により異なってくる。

Access, Delphi, and Visual Basic all support ODBC directly. Access, DelphiとVisual BasicはODBCを直接サポートする。
Under C++, such as Visual C++, you can use the C++ ODBC API. Visual C++の様に、C++のもとではC++のODBC APIを使用する。
In Visual C++, you can use the CRecordSet class, which wraps the ODBC API set within and MFC 4.2 class. This is the easiest route if you are doing Windows C++ development under Windows NT.
Visual C++では、CRecordSetクラスを使うことができる。これは、ODBC API セットを MFC 4.2 のクラスの中に包み隠して(ラッピングして)いる。 Windows NT のもとで Windows C++ の開発を行う場合はこれが一番簡単 な方法である。

If I write an app for PostgreSQL can I write it using ODBC calls to the PostgreSQL server, or is that only when another database program like MS SQL Server or Access needs to access the data? PostgreSQLのアプリケーションを書く場合に、PostgreSQLサーバへのODBC 呼び出しを使用して書けるだろうか? それとも(ODBC が使えるのは)、MS SQL サーバや MS Access のような別のデータベース・プログラムがデータにアクセスするために 必要な場合だけなのだろうか?

Again, the ODBC API set is the way to go. You can find out more at Microsoft's web site or in your Visual C++ docs (if that's what you are using.) ODBC API セットは(上記の)いずれの場合も通用する、マイクロソフトのウエブサイト もしくは(Visual C++を使っているなら)そのドキュメントから見つける事が できるだろう。

Visual Basic and the other RAD tools have Recordset objects that use ODBC directly to access data. Using the data-aware controls, you can quickly link to the ODBC back end database (very quickly). Visual Basicや、他のRADツールは、ODBCが直接データをアクセスするための レコードセットオブジェクトを有する。data-awareコントロールを使えば、 非常に素早く ODBC バックエンド・データベースと 接続することができる。

Playing around with MS Access will help you sort this out. Try using File->Get External Data MS Accessを使っているなら、この違いを実感できる。Fileメニューの Get External Dataを試してみよ。

TIP: You'll have to set up a DSN first. 最初に、DSNを設定しなければならない。

TIP: The PostgreSQL datetime type will break MS Access. PostgreSQLのdatetime型は MS Access では使用できない。


PrevHomeNext
ODBC インターフェースUpJDBC Interface