特殊:Badtitle/NS100:ODBC
文章出处: |
{{#if: | {{{2}}} | https://help.ubuntu.com/community/ODBC }} |
点击翻译: |
English {{#ifexist: {{#if: UbuntuHelp:ODBC | UbuntuHelp:ODBC | {{#if: | :}}ODBC}}/af | • {{#if: UbuntuHelp:ODBC|Afrikaans| [[::ODBC/af|Afrikaans]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ODBC | UbuntuHelp:ODBC | {{#if: | :}}ODBC}}/ar | • {{#if: UbuntuHelp:ODBC|العربية| [[::ODBC/ar|العربية]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ODBC | UbuntuHelp:ODBC | {{#if: | :}}ODBC}}/az | • {{#if: UbuntuHelp:ODBC|azərbaycanca| [[::ODBC/az|azərbaycanca]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ODBC | UbuntuHelp:ODBC | {{#if: | :}}ODBC}}/bcc | • {{#if: UbuntuHelp:ODBC|جهلسری بلوچی| [[::ODBC/bcc|جهلسری بلوچی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ODBC | UbuntuHelp:ODBC | {{#if: | :}}ODBC}}/bg | • {{#if: UbuntuHelp:ODBC|български| [[::ODBC/bg|български]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ODBC | UbuntuHelp:ODBC | {{#if: | :}}ODBC}}/br | • {{#if: UbuntuHelp:ODBC|brezhoneg| [[::ODBC/br|brezhoneg]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ODBC | UbuntuHelp:ODBC | {{#if: | :}}ODBC}}/ca | • {{#if: UbuntuHelp:ODBC|català| [[::ODBC/ca|català]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ODBC | UbuntuHelp:ODBC | {{#if: | :}}ODBC}}/cs | • {{#if: UbuntuHelp:ODBC|čeština| [[::ODBC/cs|čeština]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ODBC | UbuntuHelp:ODBC | {{#if: | :}}ODBC}}/de | • {{#if: UbuntuHelp:ODBC|Deutsch| [[::ODBC/de|Deutsch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ODBC | UbuntuHelp:ODBC | {{#if: | :}}ODBC}}/el | • {{#if: UbuntuHelp:ODBC|Ελληνικά| [[::ODBC/el|Ελληνικά]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ODBC | UbuntuHelp:ODBC | {{#if: | :}}ODBC}}/es | • {{#if: UbuntuHelp:ODBC|español| [[::ODBC/es|español]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ODBC | UbuntuHelp:ODBC | {{#if: | :}}ODBC}}/fa | • {{#if: UbuntuHelp:ODBC|فارسی| [[::ODBC/fa|فارسی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ODBC | UbuntuHelp:ODBC | {{#if: | :}}ODBC}}/fi | • {{#if: UbuntuHelp:ODBC|suomi| [[::ODBC/fi|suomi]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ODBC | UbuntuHelp:ODBC | {{#if: | :}}ODBC}}/fr | • {{#if: UbuntuHelp:ODBC|français| [[::ODBC/fr|français]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ODBC | UbuntuHelp:ODBC | {{#if: | :}}ODBC}}/gu | • {{#if: UbuntuHelp:ODBC|ગુજરાતી| [[::ODBC/gu|ગુજરાતી]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ODBC | UbuntuHelp:ODBC | {{#if: | :}}ODBC}}/he | • {{#if: UbuntuHelp:ODBC|עברית| [[::ODBC/he|עברית]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ODBC | UbuntuHelp:ODBC | {{#if: | :}}ODBC}}/hu | • {{#if: UbuntuHelp:ODBC|magyar| [[::ODBC/hu|magyar]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ODBC | UbuntuHelp:ODBC | {{#if: | :}}ODBC}}/id | • {{#if: UbuntuHelp:ODBC|Bahasa Indonesia| [[::ODBC/id|Bahasa Indonesia]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ODBC | UbuntuHelp:ODBC | {{#if: | :}}ODBC}}/it | • {{#if: UbuntuHelp:ODBC|italiano| [[::ODBC/it|italiano]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ODBC | UbuntuHelp:ODBC | {{#if: | :}}ODBC}}/ja | • {{#if: UbuntuHelp:ODBC|日本語| [[::ODBC/ja|日本語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ODBC | UbuntuHelp:ODBC | {{#if: | :}}ODBC}}/ko | • {{#if: UbuntuHelp:ODBC|한국어| [[::ODBC/ko|한국어]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ODBC | UbuntuHelp:ODBC | {{#if: | :}}ODBC}}/ksh | • {{#if: UbuntuHelp:ODBC|Ripoarisch| [[::ODBC/ksh|Ripoarisch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ODBC | UbuntuHelp:ODBC | {{#if: | :}}ODBC}}/mr | • {{#if: UbuntuHelp:ODBC|मराठी| [[::ODBC/mr|मराठी]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ODBC | UbuntuHelp:ODBC | {{#if: | :}}ODBC}}/ms | • {{#if: UbuntuHelp:ODBC|Bahasa Melayu| [[::ODBC/ms|Bahasa Melayu]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ODBC | UbuntuHelp:ODBC | {{#if: | :}}ODBC}}/nl | • {{#if: UbuntuHelp:ODBC|Nederlands| [[::ODBC/nl|Nederlands]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ODBC | UbuntuHelp:ODBC | {{#if: | :}}ODBC}}/no | • {{#if: UbuntuHelp:ODBC|norsk| [[::ODBC/no|norsk]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ODBC | UbuntuHelp:ODBC | {{#if: | :}}ODBC}}/oc | • {{#if: UbuntuHelp:ODBC|occitan| [[::ODBC/oc|occitan]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ODBC | UbuntuHelp:ODBC | {{#if: | :}}ODBC}}/pl | • {{#if: UbuntuHelp:ODBC|polski| [[::ODBC/pl|polski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ODBC | UbuntuHelp:ODBC | {{#if: | :}}ODBC}}/pt | • {{#if: UbuntuHelp:ODBC|português| [[::ODBC/pt|português]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ODBC | UbuntuHelp:ODBC | {{#if: | :}}ODBC}}/ro | • {{#if: UbuntuHelp:ODBC|română| [[::ODBC/ro|română]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ODBC | UbuntuHelp:ODBC | {{#if: | :}}ODBC}}/ru | • {{#if: UbuntuHelp:ODBC|русский| [[::ODBC/ru|русский]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ODBC | UbuntuHelp:ODBC | {{#if: | :}}ODBC}}/si | • {{#if: UbuntuHelp:ODBC|සිංහල| [[::ODBC/si|සිංහල]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ODBC | UbuntuHelp:ODBC | {{#if: | :}}ODBC}}/sq | • {{#if: UbuntuHelp:ODBC|shqip| [[::ODBC/sq|shqip]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ODBC | UbuntuHelp:ODBC | {{#if: | :}}ODBC}}/sr | • {{#if: UbuntuHelp:ODBC|српски / srpski| [[::ODBC/sr|српски / srpski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ODBC | UbuntuHelp:ODBC | {{#if: | :}}ODBC}}/sv | • {{#if: UbuntuHelp:ODBC|svenska| [[::ODBC/sv|svenska]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ODBC | UbuntuHelp:ODBC | {{#if: | :}}ODBC}}/th | • {{#if: UbuntuHelp:ODBC|ไทย| [[::ODBC/th|ไทย]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ODBC | UbuntuHelp:ODBC | {{#if: | :}}ODBC}}/tr | • {{#if: UbuntuHelp:ODBC|Türkçe| [[::ODBC/tr|Türkçe]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ODBC | UbuntuHelp:ODBC | {{#if: | :}}ODBC}}/vi | • {{#if: UbuntuHelp:ODBC|Tiếng Việt| [[::ODBC/vi|Tiếng Việt]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ODBC | UbuntuHelp:ODBC | {{#if: | :}}ODBC}}/yue | • {{#if: UbuntuHelp:ODBC|粵語| [[::ODBC/yue|粵語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ODBC | UbuntuHelp:ODBC | {{#if: | :}}ODBC}}/zh | • {{#if: UbuntuHelp:ODBC|中文| [[::ODBC/zh|中文]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ODBC | UbuntuHelp:ODBC | {{#if: | :}}ODBC}}/zh-hans | • {{#if: UbuntuHelp:ODBC|中文(简体)| [[::ODBC/zh-hans|中文(简体)]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ODBC | UbuntuHelp:ODBC | {{#if: | :}}ODBC}}/zh-hant | • {{#if: UbuntuHelp:ODBC|中文(繁體)| [[::ODBC/zh-hant|中文(繁體)]]}}|}} |
{{#ifeq:UbuntuHelp:ODBC|:ODBC|请不要直接编辑翻译本页,本页将定期与来源同步。}} |
{{#ifexist: :ODBC/zh | | {{#ifexist: ODBC/zh | | {{#ifeq: {{#titleparts:ODBC|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:ODBC|1|-1|}} | zh | | }}
<<Include(Tag/NeedsExpansion)>> Ubuntu supports ODBC connections to databases (such as a remote MySQL server). Whilst this is not normally useful, The database in OpenOffice can use ODBC connections, and it may be convenient to set one up.
Installing the MySQL Database ODBC Driver
Get the linux MySQL ODBC driver. The console incantation is
apt-get install libmyodbc
and synaptic will provide a similar install.
Now hand edit (or create, if it does not exist already) /etc/odbc.ini
Here's an example odbc.ini:
[ODBC Data Sources] odbcname = MyODBC 3.51 Driver DSN [odbcname] Driver = /usr/lib/odbc/libmyodbc.so Description = MyODBC 3.51 Driver DSN SERVER = my.database.server.com PORT = USER = USER Password = XXXXXX Database = DBNAME OPTION = 3 SOCKET = [Default] Driver = /usr/local/lib/libmyodbc3.so Description = MyODBC 3.51 Driver DSN SERVER = localhost PORT = USER = root Password = Database = test OPTION = 3 SOCKET =
It is now possible to connect to the database DBNAME using the ODBC connection odbcname
Installing the Firebird Database ODBC Driver
The Firebird ODBC driver is not in the Ubuntu repositories so it has to be downloaded from the FirebirdSQL site:
[1]
It contains a single file named "libOdbcFb.so". Copy this file to the /usr/lib directory.
Next make sure you have the Firebird client library installed:
apt-get install libfbclient2
Openoffice and probably a few other programs will insist on using a driver named libgds.so for connecting to a Firebird database. A symbolic link will have to be created:
ln -s /usr/lib/libfbclient.so.2 /usr/lib/libgds.so
At this point you are ready to add some entries to the odbc config files. If they don't already exist you can create them.
Here's another example odbc.ini:
[DBNAME] Description = Firebird Driver = Firebird Dbname = localhost:/var/lib/firebird/2.1/data/employee.fdb User = SYSDBA Password = xxxxx Role = CharacterSet = ReadOnly = No NoWait = No
And the relevant entries for the odbcinst.ini file:
[Firebird] Description = InterBase/Firebird ODBC Driver Driver = /usr/lib/libOdbcFb.so Setup = /usr/lib/libOdbcFbS.so Threading = 1 FileUsage = 1 CPTimeout = CPReuse =
You should now be able to connect to DBNAME from OpenOffice or other programs using the ODBC connection method.