使用JDatabase來取用資料庫

From Joomla! Documentation

This page is a translated version of the page Accessing the database using JDatabase and the translation is 17% complete.
Copyedit.png
This Article Needs Your Help

This article is tagged because it NEEDS REVIEW. You can help the Joomla! Documentation Wiki by contributing to it.
More pages that need help similar to this one are here. NOTE-If you feel the need is satistified, please remove this notice.


Other languages:
Bahasa Indonesia • ‎Deutsch • ‎English • ‎Nederlands • ‎español • ‎français • ‎português do Brasil • ‎română • ‎русский • ‎فارسی • ‎हिन्दी • ‎বাংলা • ‎中文(台灣)‎
Joomla! 
3.x
Joomla! 
2.5

有用的資訊

Being able to use JDatabase is vital when you start developing for Joomla. The tutorial is split into two independent parts:

進階資訊

This tutorial looks at how to use transactions with JDatabase (available since Joomla 3.x only):

This tutorial looks at how to use the union methods in JDatabaseQuery (available in working form since Joomla 3.3 only):

Supported Storage Connectors

The table below outlines the database and storage connectors available for Joomla! as well as which version of Joomla they became available in.

To make a connector available in Joomla's installer or global configuration manager, you will need to ensure the PHP library is installed (E.g. for PHP5 and MySQL the php5-mysql library would need to be installed).

Database Joomla! Versions Joomla DB
MySQL Joomla 1.5Joomla 2.5Joomla 3.0Joomla 4.0 Yes
Microsoft SQL Server Joomla 2.5Joomla 3.0 Yes
Microsoft SQL Azure Joomla 2.5Joomla 3.0 Yes
Postgresql Joomla 3.0Joomla 4.0 Yes (In Joomla 4.0 and higher only via the PDO library for postgres)
Oracle DB Joomla 3.0 No
SQL Lite Joomla 3.0Joomla 4.0 No
PHP Data Objects (PDO)* Joomla 3.0Joomla 4.0 No
  • PHP Data Objects is a database abstraction layer and is shipped with PHP 5.1+.