Difference between revisions of "Accessing Firebird with ODBC"

From LSDevLinux
Jump to: navigation, search
m (Reverted edits by Okopacare (Talk); changed back to last version by Andy)
(minor updates)
Line 92: Line 92:
 
=== Reference ===
 
=== Reference ===
 
* The [http://www.unixodbc.org/ unixODBC site] has a bunch of good reference. Click 'Manuals' on the left. (The [http://www.unixodbc.org/doc/ProgrammerManual/Tutorial/ ODBC Programming Tutorial] worked fine for me, but the Easysoft ones do look more professional).
 
* The [http://www.unixodbc.org/ unixODBC site] has a bunch of good reference. Click 'Manuals' on the left. (The [http://www.unixodbc.org/doc/ProgrammerManual/Tutorial/ ODBC Programming Tutorial] worked fine for me, but the Easysoft ones do look more professional).
* The [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/odbcabout_this_manual.asp MSDN ODBC Programmer's Reference] is the authoritative reference for the ODBC API, but there may be some differences between this and unixODBC.
+
* The [http://msdn.microshit.com/library/default.asp?url=/library/en-us/odbc/htm/odbcabout_this_manual.asp MSDN ODBC Programmer's Reference] is the authoritative reference for the ODBC API, but there may be some differences between this and unixODBC.
  
 
[[Category:Database]]
 
[[Category:Database]]
 +
 +
== Discovering My Own Values ==
 +
 +
At the end of your life a friend once asked, What do you hope to have happened? I thought it a great question and decided to give him a thoughtful answer, so I pocketed it for later and bought myself a month for the assignment. For a while my mind flooded with questions of plot.
 +
 +
[[http://goodvillenews.com/Discovering-My-Own-Values-4UdImK.html Discovering My Own Values]]
 +
 +
[[http://goodvillenews.com/wk.html GoodvilleNews.com - good, positive news, inspirational stories, articles]]
 +
 +
== 5 Principles for Inner Transformation at Work ==
 +
 +
People go to work to sustain themselves and produce value in the world. Yet work environments can also be stressful, filled with challenging responsibilities and personalities, and feel misaligned with our most deeply cherished values. Instead of sustaining us, the workplace can sometimes feel simply draining, and at worst, unwholesome for both ourselves and the world.
 +
 +
[[http://goodvillenews.com/5-Principles-for-Inner-Transformation-at-Work-TTklKV.html 5 Principles for Inner Transformation at Work]]
 +
 +
[[http://goodvillenews.com/wk.html GoodvilleNews.com - good, positive news, inspirational stories, articles]]
 +
 +
== 5 Things You Can Do To Love Your Authentic Self More ==
 +
 +
I had no idea that being your authentic self could make me as rich as Ive become. If I had, Id have done it a lot earlier. Oprah WinfreyIt can be easy to love other people but its not always easy to love your authentic self, am I right?
 +
 +
[[http://goodvillenews.com/5-Things-You-Can-Do-To-Love-Your-Authentic-Self-More-r2jcXE.html 5 Things You Can Do To Love Your Authentic Self More]]
 +
 +
[[http://goodvillenews.com/wk.html GoodvilleNews.com - good, positive news, inspirational stories, articles]]
 +
 +
== 7 Essential Books on Optimism ==
 +
 +
Every once in a while, we all get burned out. Sometimes, charred. And while a healthy dose of cynicism and skepticism may help us get by, its in those times that we need nothing more than to embrace lifes promise of positivity with open arms. Here are seven wonderful books that help do just that with an arsenal ranging from the light visceral stimulation of optimistic design to the serious neuroscience findings about our proclivity for the positive.
 +
 +
[[http://goodvillenews.com/7-Essential-Books-on-Optimism-6pgcLt.html 7 Essential Books on Optimism]]
 +
 +
[[http://goodvillenews.com/wk.html GoodvilleNews.com - good, positive news, inspirational stories, articles]]
 +
 +
== Use Your Talents Give More Receive More ==
 +
 +
When I stand before God at the end of my life, I would hope that I would not have a single bit of talent left, and could say, I used everything you gave me.Erma Bombeck
 +
 +
[[http://goodvillenews.com/Use-Your-Talents-Give-More-Receive-More-n807aT.html Use Your Talents Give More Receive More]]
 +
 +
[[http://goodvillenews.com/wk.html GoodvilleNews.com - good, positive news, inspirational stories, articles]]

Revision as of 06:15, 30 July 2012

A guide to setting up Firebird and ODBC on a Linux system. This guide was created using Debian Etch, some details may vary for other distributions.

Names

A few names will be used throughout this guide. These are for you to pick.

  • <sysdbapassword> The administrator password for this install of Firebird.
  • <database_path> Path to the database, eg. /usr/share/fieldworks/
  • <database_name> Filename for the database, eg. database.fdb
  • <username> Name for a regular database user.
  • <password> Password for the regular database user.
  • <driver_name> Name for the ODBC driver.
  • <DSN_name> Name for the ODBC description of the database.

Installing software

  • Install unixodbc* packages
  • Install firebird2-classic-server (set SYSDBA password)
  • Install firebird2-dev
  • Optional: Install firebird2-utils-classic

Note: It's also possible to use firebird2-super-server. I don't fully understand the difference.

Creating a database

Note: The commands run as root here would be better run as the 'firebird' user.

Note 2: Retrospectively, using this guide for Ubuntu would have probably been better. Aside from one or two package names, it should work on Debian.

# gsec -user sysdba -pass <sysdbapassword> -add <username> -pw <password>
$ cd <database_path>
# /usr/lib/firebird2/bin/isql (NOT the same as /bin/isql)
SQL> create database '<datbase_name>' user '<username>' password '<password>';
SQL> connect test.fdb user <username> password <password>;

Data can then be added with normal SQL commands

Setting up unixODBC

Drivers

Database

Warning: Putting the name and password in the DSN is a bit of a security risk. It is done in this example for convenience.

Graphical setup

Use ODBCConfig. Create a new Driver, then a new user DSN.

Source: The unixODBC User Manual.

Driver:

  • Name: <driver_name>
  • Driver: /usr/lib/odbc/libOdbcFb32.so
  • Setup: /usr/lib/odbc/libOdbcFb32.so

DSN:

First, select the driver just created and click 'OK'.

  • Name: <DSN_name>
  • Dbname: localhost:<database_path><database_name>
  • User: <username>
  • Password: <password>

Config file setup

The above can also be created adding an entries to unixODBC's ini files, such as in these minimal examples. (The graphical tool does the same thing, but adds a lot more fields to the files.

Driver: /etc/odbcinst.ini

[Firebird]
Driver		= /usr/lib/odbc/libOdbcFb32.so
Setup		= /usr/lib/odbc/libOdbcFb32.so

DSN: /home/user/.odbc.ini<code> for a single user or <code>/etc/odbc.ini for all users)

[<DSN_name>]
Driver   = <driver_name>
Dbname   = localhost:<database_path><database_name>
User     = <username>
Password = <password>

Connecting to the database

isql -v <DSN_name>

(It may be required to use LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/odbc)

Running the above command as either root or firebird will provide an ODBC SQL console.

OpenOffice.org Base can also connect to ODBC databases.

Programming (C)

Reference

Discovering My Own Values

At the end of your life a friend once asked, What do you hope to have happened? I thought it a great question and decided to give him a thoughtful answer, so I pocketed it for later and bought myself a month for the assignment. For a while my mind flooded with questions of plot.

[Discovering My Own Values]

[GoodvilleNews.com - good, positive news, inspirational stories, articles]

5 Principles for Inner Transformation at Work

People go to work to sustain themselves and produce value in the world. Yet work environments can also be stressful, filled with challenging responsibilities and personalities, and feel misaligned with our most deeply cherished values. Instead of sustaining us, the workplace can sometimes feel simply draining, and at worst, unwholesome for both ourselves and the world.

[5 Principles for Inner Transformation at Work]

[GoodvilleNews.com - good, positive news, inspirational stories, articles]

5 Things You Can Do To Love Your Authentic Self More

I had no idea that being your authentic self could make me as rich as Ive become. If I had, Id have done it a lot earlier. Oprah WinfreyIt can be easy to love other people but its not always easy to love your authentic self, am I right?

[5 Things You Can Do To Love Your Authentic Self More]

[GoodvilleNews.com - good, positive news, inspirational stories, articles]

7 Essential Books on Optimism

Every once in a while, we all get burned out. Sometimes, charred. And while a healthy dose of cynicism and skepticism may help us get by, its in those times that we need nothing more than to embrace lifes promise of positivity with open arms. Here are seven wonderful books that help do just that with an arsenal ranging from the light visceral stimulation of optimistic design to the serious neuroscience findings about our proclivity for the positive.

[7 Essential Books on Optimism]

[GoodvilleNews.com - good, positive news, inspirational stories, articles]

Use Your Talents Give More Receive More

When I stand before God at the end of my life, I would hope that I would not have a single bit of talent left, and could say, I used everything you gave me.Erma Bombeck

[Use Your Talents Give More Receive More]

[GoodvilleNews.com - good, positive news, inspirational stories, articles]