个人工具

“UbuntuHelp:Firebird2.1”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
 
第1行: 第1行:
 
{{From|https://help.ubuntu.com/community/Firebird2.1}}
 
{{From|https://help.ubuntu.com/community/Firebird2.1}}
 
{{Languages|UbuntuHelp:Firebird2.1}}
 
{{Languages|UbuntuHelp:Firebird2.1}}
In Ubuntu 9.04 Jaunty  Firebird2.1.1 is [https://edge.launchpad.net/ubuntu/jaunty/+source/firebird2.1 included] by default but the latest stable is into my ppa .
+
In Ubuntu 10.04 Lucid Lynx Firebird 2.1.3 is [http://launchpad.net/ubuntu/lucid/+source/firebird2.1 included] by default and you don't need to enable the firebird stable ppa from bellow and you should follow the instructions from "apt-get install" section
The Firebird2.1 package (version 2.1.3) for  Ubuntu 9.04 Jaunty, Intrepid 8.10, Hardy 8.04, Dapper 6.06  is located into [https://launchpad.net/~mapopa/+archive this] repository (ppa)
+
The Firebird2.1 package (version 2.1.3) for  Ubuntu Karmic 9.10 ,Ubuntu 9.04 Jaunty, Intrepid 8.10, Hardy 8.04, Dapper 6.06  is located into [https://launchpad.net/~mapopa/+archive this] repository (ppa)
The repository must be added into sources.list , Here is the example for Jaunty
+
The repository must be added into sources.list , Here is the example for Karmic
 
<pre><nowiki>
 
<pre><nowiki>
 
sudo pico /etc/apt/sources.list.d/firebird.list
 
sudo pico /etc/apt/sources.list.d/firebird.list
第9行: 第9行:
 
and you should add these lines  
 
and you should add these lines  
 
<pre><nowiki>
 
<pre><nowiki>
deb http://ppa.launchpad.net/mapopa/ppa/ubuntu jaunty main
+
deb http://ppa.launchpad.net/mapopa/ppa/ubuntu karmic main
deb-src http://ppa.launchpad.net/mapopa/ppa/ubuntu jaunty main
+
deb-src http://ppa.launchpad.net/mapopa/ppa/ubuntu karmic main
 
</nowiki></pre>
 
</nowiki></pre>
 
You need to import my [https://help.launchpad.net/PPAKeys gpg key]  
 
You need to import my [https://help.launchpad.net/PPAKeys gpg key]  
第24行: 第24行:
 
apt-cache search firebird2.1-*
 
apt-cache search firebird2.1-*
 
</nowiki></pre>
 
</nowiki></pre>
install the super server package (you will be asked about the SYSDBA password and what service to enable :Super Server or Classic )
+
Install the super server package (you will be asked about the SYSDBA password and what service to enable :Super Server or Classic )
 
<pre><nowiki>
 
<pre><nowiki>
 
sudo apt-get install firebird2.1-super
 
sudo apt-get install firebird2.1-super
第58行: 第58行:
 
sudo chown firebird.firebird employee.fdb
 
sudo chown firebird.firebird employee.fdb
 
sudo mv employee.fdb /var/lib/firebird/2.1/data/</nowiki></pre>
 
sudo mv employee.fdb /var/lib/firebird/2.1/data/</nowiki></pre>
connect to db
+
Connect to database using the isql-fb console
 
<pre><nowiki>
 
<pre><nowiki>
 
$ isql-fb
 
$ isql-fb
 
+
SQL> connect "/var/lib/firebird/2.1/data/employee.fdb " user 'SYSDBA' password 'SYSDBApassword';
SQL> connect "/var/lib/firebird/2.1/data/employee.fdb " user 'SYSDBA' password 'SYSDBApassword';</nowiki></pre>
+
</nowiki></pre>
 +
If all is ok then you will have the message with what database connected and what user and ready to use
 +
sql prompt
 +
<pre><nowiki>
 +
Database:  "/var/lib/firebird/2.1/data/employee.fdb ", User: SYSDBA
 +
SQL> </nowiki></pre>
 
Now you can check the server version and the tables
 
Now you can check the server version and the tables
 
<pre><nowiki>
 
<pre><nowiki>
第73行: 第78行:
  
 
SQL> show version;
 
SQL> show version;
 +
ISQL Version: LI-V2.1.3.18185 Firebird 2.1
 +
Server version:
 +
Firebird/linux Intel (access method), version "LI-V2.1.3.18185 Firebird 2.1"
 +
Firebird/linux Intel (remote server), version "LI-V2.1.3.18185 Firebird 2.1/tcp (eeepc)/P11"
 +
Firebird/linux Intel (remote interface), version "LI-V2.5.0.25920 Firebird 2.5 Release Candidate 2/tcp (eeepc)/P11"
 +
on disk structure version 11.1
 +
</nowiki></pre>
 +
To create a new database
 +
<pre><nowiki>
 +
SQL> create database "/var/lib/firebird/2.1/data/first_database.fdb" user 'SYSDBA' password 'SYSDBAPASSWORD';
 +
SQL> connect "/var/lib/firebird/2.1/data/first_database.fdb" user 'SYSDBA' password 'masterkey';
 +
Commit current transaction (y/n)?y
 +
Committing.
 +
Database:  "/var/lib/firebird/2.1/data/first_database.fdb", User: SYSDBA
 +
SQL>
 +
</nowiki></pre>
 +
If you want to create a simple table then insert 1-2 rows and select from it here is one example
 +
<pre><nowiki>
 +
SQL> CREATE TABLE TEST (ID INT NOT NULL PRIMARY KEY, NAME VARCHAR(20));
 +
SQL> show tables;
 +
      TEST
 +
SQL> INSERT INTO TEST VALUES (1, 'John');
 +
SQL> INSERT INTO TEST VALUES (2, 'Joe');
 +
SQL> select * from test;
 +
 +
          ID NAME               
 +
============ ====================
 +
          1 John               
 +
          2 Joe
 +
</nowiki></pre>
 +
To quit the isql-fb console type quit
 +
<pre><nowiki>
 
SQL> quit
 
SQL> quit
 
CON>;  
 
CON>;  
 
</nowiki></pre>
 
</nowiki></pre>
For an GUI admin tool you might check the flamerobin administration tool included in ubuntu repository
+
For a good open source GUI admin tool you might check the flamerobin administration tool included in ubuntu repository can be installed by an simple  
can be installed by an simple  
+
 
<pre><nowiki>
 
<pre><nowiki>
 
sudo apt-get install flamerobin
 
sudo apt-get install flamerobin
第87行: 第123行:
 
sudo /etc/init.d/apache2 restart
 
sudo /etc/init.d/apache2 restart
 
</nowiki></pre>
 
</nowiki></pre>
Next if you need to install an php administration tool like ibwebadmin
+
Next if you need to install an php administration tool like Firebird Web Admin
 
<pre><nowiki>
 
<pre><nowiki>
sudo apt-get install ibwebadmin
+
sudo apt-get install git-core
 +
git clone git://github.com/mariuz/FirebirdWebAdmin.git
 +
mv FirebirdWebAdmin/firebirdwebadmin /var/www/firebirdwebadmin
 
</nowiki></pre>
 
</nowiki></pre>
and load it in the browser [http://localhost/ibwebadmin http://localhost/ibwebadmin]
+
and load it in the browser [http://localhost/firebirdwebadmin http://localhost/firebirdwebadmin]
It should look like this [http://farm3.static.flickr.com/2414/2492058076_49c677058d_o.png  screen shot]  
+
It should look like this [http://farm3.static.flickr.com/2555/4159286187_9ab6033e88_o.png  screen shot]  
 
=Other Firebird Related Guides=
 
=Other Firebird Related Guides=
You can start with the main Firebird [http://www.firebirdsql.org/?op=doc documentation]  
+
You can start with the main Firebird [http://www.firebirdsql.org/?op=doc documentation].
 +
To use Ruby language with firebird I wrote a [http://mapopa.blogspot.com/2009/02/fireruby-howto-start-with-firebird-and.html  tutorial] on howto install the stable driver.
 +
For Ruby on Rails i wrote [http://mapopa.blogspot.com/2009/02/installing-firebird-active-record-for.html  howto] install the Firebird Active Record Adapter and start [http://mapopa.blogspot.com/2009/02/rails-on-firebird-status-after-adapter.html  an application].
 +
To use python you must use [http://www.firebirdsql.org/index.php?op=devel&sub=python  the official ] firebird python driver and [http://mapopa.blogspot.com/2009/02/firebird-python-howto-on-ubuntu-wget.html  here] is howto install and test it if it works.
 +
For [http://manpages.ubuntu.com/manpages/lucid/man1/lazarus-ide.1.html Lazarus IDE] i wrote an [http://mapopa.blogspot.com/2010/04/using-lazarus-ide-with-firebird-in.html  visual guide]  on howto use the database aware components in a simple application that uses Firebird.
 +
Lua Language does have a [http://code.google.com/p/fbclient/ good driver] and there is a [http://mapopa.blogspot.com/2010/04/getting-started-with-firebird-and-lua.html Getting started] guide with firebird on ubuntu
  
 
[[category:UbuntuHelp]]
 
[[category:UbuntuHelp]]

2010年5月19日 (三) 22:21的最新版本

In Ubuntu 10.04 Lucid Lynx Firebird 2.1.3 is included by default and you don't need to enable the firebird stable ppa from bellow and you should follow the instructions from "apt-get install" section The Firebird2.1 package (version 2.1.3) for Ubuntu Karmic 9.10 ,Ubuntu 9.04 Jaunty, Intrepid 8.10, Hardy 8.04, Dapper 6.06 is located into this repository (ppa) The repository must be added into sources.list , Here is the example for Karmic

sudo pico /etc/apt/sources.list.d/firebird.list

and you should add these lines

deb http://ppa.launchpad.net/mapopa/ppa/ubuntu karmic main
deb-src http://ppa.launchpad.net/mapopa/ppa/ubuntu karmic main

You need to import my gpg key

sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com ea316a2f8d6bd55554c23f680be6d09eef648708

Then you need to update the cache repository

sudo apt-get update

Here is how you can inspect the firebird2.1 related packages

apt-cache search firebird2.1-*

Install the super server package (you will be asked about the SYSDBA password and what service to enable :Super Server or Classic )

sudo apt-get install firebird2.1-super

The following extra packages will be installed:
  firebird2.1-common firebird2.1-server-common libedit2 libfbclient2 libicu38
Suggested packages:
  firebird2.1-doc
The following NEW packages will be installed:
  firebird2.1-common firebird2.1-server-common firebird2.1-super libedit2 libfbclient2 libicu38
0 upgraded, 6 newly installed, 0 to remove and 1 not upgraded.
Need to get 11.7MB of archives.
After unpacking 28.4MB of additional disk space will be used.
Do you want to continue [Y/n]? y

Or install Classic if you have more than one cpu (dual core or SMP machine) and want SMP support

sudo apt-get install firebird2.1-classic

You need to configure the package after is installed

sudo dpkg-reconfigure firebird2.1-super

Install the examples and dev files

sudo apt-get install firebird2.1-examples firebird2.1-dev 

The employee.fdb archive will be under this dir /usr/share/doc/firebird2.1-examples/examples/empbuild/

cd /usr/share/doc/firebird2.1-examples/examples/empbuild/
sudo gunzip employee.fdb.gz
sudo chown firebird.firebird employee.fdb
sudo mv employee.fdb /var/lib/firebird/2.1/data/

Connect to database using the isql-fb console

$ isql-fb
SQL> connect "/var/lib/firebird/2.1/data/employee.fdb " user 'SYSDBA' password 'SYSDBApassword';

If all is ok then you will have the message with what database connected and what user and ready to use sql prompt

Database:  "/var/lib/firebird/2.1/data/employee.fdb ", User: SYSDBA
SQL> 

Now you can check the server version and the tables

SQL> show tables;
       COUNTRY                                CUSTOMER
       DEPARTMENT                             EMPLOYEE
       EMPLOYEE_PROJECT                       JOB
       PROJECT                                PROJ_DEPT_BUDGET
       SALARY_HISTORY                         SALES

SQL> show version;
ISQL Version: LI-V2.1.3.18185 Firebird 2.1
Server version:
Firebird/linux Intel (access method), version "LI-V2.1.3.18185 Firebird 2.1"
Firebird/linux Intel (remote server), version "LI-V2.1.3.18185 Firebird 2.1/tcp (eeepc)/P11"
Firebird/linux Intel (remote interface), version "LI-V2.5.0.25920 Firebird 2.5 Release Candidate 2/tcp (eeepc)/P11"
on disk structure version 11.1

To create a new database

SQL> create database "/var/lib/firebird/2.1/data/first_database.fdb" user 'SYSDBA' password 'SYSDBAPASSWORD';
SQL> connect "/var/lib/firebird/2.1/data/first_database.fdb" user 'SYSDBA' password 'masterkey';
Commit current transaction (y/n)?y
Committing.
Database:  "/var/lib/firebird/2.1/data/first_database.fdb", User: SYSDBA
SQL>

If you want to create a simple table then insert 1-2 rows and select from it here is one example

SQL> CREATE TABLE TEST (ID INT NOT NULL PRIMARY KEY, NAME VARCHAR(20));
SQL> show tables;
       TEST
SQL> INSERT INTO TEST VALUES (1, 'John');
SQL> INSERT INTO TEST VALUES (2, 'Joe');
SQL> select * from test;

          ID NAME                 
============ ==================== 
           1 John                 
           2 Joe 

To quit the isql-fb console type quit

SQL> quit
CON>; 

For a good open source GUI admin tool you might check the flamerobin administration tool included in ubuntu repository can be installed by an simple

sudo apt-get install flamerobin

Then use it from the menu Applications->Programming-> FlameRobin To use firebird with php , you will need the php5 driver

sudo apt-get install php5-interbase
sudo /etc/init.d/apache2 restart

Next if you need to install an php administration tool like Firebird Web Admin

sudo apt-get install git-core
git clone git://github.com/mariuz/FirebirdWebAdmin.git 
mv FirebirdWebAdmin/firebirdwebadmin /var/www/firebirdwebadmin

and load it in the browser http://localhost/firebirdwebadmin It should look like this screen shot

Other Firebird Related Guides

You can start with the main Firebird documentation. To use Ruby language with firebird I wrote a tutorial on howto install the stable driver. For Ruby on Rails i wrote howto install the Firebird Active Record Adapter and start an application. To use python you must use the official firebird python driver and here is howto install and test it if it works. For Lazarus IDE i wrote an visual guide on howto use the database aware components in a simple application that uses Firebird. Lua Language does have a good driver and there is a Getting started guide with firebird on ubuntu