|Firebird Interview Questions & Answers - Learning Mode|
DATABASE INTERVIEW QUESTIONS
FIREBIRD INTERVIEW QUESTIONS QUESTIONS & ANSWERS - LEARNING MODE
Firebird Interview Questions & Answers - Learning Mode
Firebird is a relational database offering many ANSI SQL standard features that runs on Linux, Windows, and a variety of Unix platforms. Firebird offers excellent concurrency, high performance, and powerful language support for stored procedures and triggers. Firebird is an open source SQL relational database management system that runs on Linux, Microsoft Windows, Mac OS X and a variety of Unix. The database forked from Borland's open source edition of InterBase in 2000, but since Firebird 1.5 the code has been largely rewritten. Initial release: 2000.
|Try Firebird Interview Questions & Answers - Exam Mode|
|Firebird Interview Questions & Answers - Learning Mode|
|Try Firebird Interview Questions & Answers - Exam Mode|
Question: How to detect the server version?
Answer: You can get this via Firebird Service API. It does not work for Firebird Classic 1.0, so if you don't get an answer you'll know it's Firebird Classic 1.0 or InterBase Classic 6.0. Otherwise it returns a string like this:
LI-V22.214.171.12448 Firebird 2.0
LI-V126.96.36.19970 Firebird 1.5
The use of API depends on programming language and connectivity library you use. Some might even not provide it. Those that do, call the isc_info_svc_server_version API.
Question: How to stop SuperServer service on Linux using only Firebird tools?
Answer: The server is started and stopped by 'fbmgr' executable from 'bin' directory of your Firebird installation. It is called 'ibmgr' in Firebird 1.0. To start the server type:
To start the server with Guardian (Guardian watches the server and restarts it if it crashes) type:
/opt/firebird/bin/fbmgr -start -forever
To stop a running server, type:
/opt/firebird/bin/fbmgr -shut -user SYSDBA -pass *****
To f Source: CoolInterview.com
Question: How to deactivate triggers?
Answer: You can use these SQL commands:
ALTER TRIGGER trigger_name INACTIVE;
ALTER TRIGGER trigger_name ACTIVE;
Most tools have options to activate and deactivate all triggers for a table. For example, in FlameRobin, open the properties screen for a table, click on Triggers at top and then Activate or Deactivate All Triggers options at the bottom of the page. Source: CoolInterview.com
Question: How to configure events with firewall?
Answer: If firewall is on client, you don't have to do anything special. If firewall is on the server, you need to set RemoteAuxPort setting in Firebird.conf file and forward traffic from firewall to that port. Source: CoolInterview.com
Question: How to pump the data from one database to another?
Answer: Many recommend IB Pump or IB Data Pump, but the problem is when you have complex relations between tables. In such cases, it is better to use tool like FBCopy which sorts the tables by dependencies (foreign keys, check constraints) into correct orde Source: CoolInterview.com
Question: How to select a random record from a table?
Answer: There is no such feature in Firebird, but you can use some tricks. The following example requires that you have a unique integer column (primary key is usually used):
FROM table t1
ORDER BY (t1.int_col + seed)*4294967291-((t1.int_col + seed)*4294967291/49157)*49157;
If you just need one random record, limit the result set using FIRST or ROWS clause. This query will give consistent records for the same seed. If you wish to be complet Source: CoolInterview.com
Question: How to tell Firebird to only accept conections from XYZ host or network?
Answer: This isn't really a thing you should be configuring in Firebird. There is a RemoteBindAddress setting in firebird.conf which configures on which interfaces/addresses the Firebird listens but that's all. You should really use your system's firewall to set this up.
Beside firewall, if you use Classic on Linux, you can use xinetd or inetd access control files /etc/hosts.allow and /etc/hosts.deny. With xinetd you can also edit the xinetd configuration file for Firebird service, wh Source: CoolInterview.com
Question: How to activate all indexes in Firebird?
Answer: If you run Firebird 1.x which doesn't have EXECUTE BLOCK, you can run the following query:
select 'ALTER INDEX '||rdb$index_name ||' ACTIVE;'
where rdb$system_flag is not null and rdb$system_flag = 0 Source: CoolInterview.com
Question: How to extract metadata for the entire database?
Answer: It's quite simple, use isql with -x or -a options. Please be careful and test if it works. Some commercial administration tools like to play with system tables directly, and isql isn't always able to understand their hacks.
You can also extract DDL with FlameRobin. Open the properties page for the database and select DDL option at the top. Source: CoolInterview.com
Question: Is there a way to detect whether fbclient.dll or fbembed.dll is loaded?
Answer: There are some ways to detect it:
- check the size of DLL file
- if you are using different versions of Firebird (for example 1.5.4 and 2.0.1, you can query the server version via Services API)
You should understand that fbembed can be used as a regular Firebird client. Checking whether embedded or fbclient is loaded for licensing or similar needs is really not useful. You could use the connection string as guide, but super server can establish direct local connections witho Source: CoolInterview.com
Question: How to migrate Paradox, dBase or FoxPro database to Firebird?
Answer: The easiest way is to download the freeware IBDataPump by CleverComponents. It will extract the metadata from Paradox/dBase/FoxPro database, create all the tables in a Firebird database and then copy all the data. You'll probably have a ready-to-go Firebird database in less than one hour. Source: CoolInterview.com
Question: How to monitor Firebird server activity?
Answer: Firebird 2.1 introduces server-side monitoring via special system tables. This way you can monitor your server directly from SQL. Those system tables all have prefix MON$ in their name. To use them, you need to make sure your database file is created with Firebird 2.1 or higher (ODS version 11.1). If you have a database that is created with earlier versions, you need to do backup and subsequent restore with Firebird 2.1 to have those tables.
For detailed information about each monitoring Source: CoolInterview.com
Question: How to write UDF s in Delphi?
Answer: It's quite simple, the only thing you need to remember is that you must always use ib_util_malloc() to allocate memory if your UDF returns string result. The UDF must be declared as FREE_IT, so that Firebird releases the memory after it reads the string.
To use ib_util_malloc(), you need to import it from ib_util.dll into your program - and make sure you use it instead of regular memory alocating functions. Here's a simple example of Delphi UDF:
function ib_util_malloc( Source: CoolInterview.com
Question: Is there an example how to configure ExternalFileAccess setting in firebird.conf?
Answer: Firebird's config file (firebird.conf) does have descriptions inside that explain everything, but sometimes they are confusing and hard to understand what should you do exactly if you don't have examples. One of such settings is ExternalFileAccess. Some people are even tempted to put Full as it is much easier than trying to guess what's the correct format. Here are the basic settings ('None' to disallow external tables and 'Full' to allow them anywhere) which you prob Source: CoolInterview.com
Question: How to do replication of Firebird databases?
Answer: Firebird does not offer replication out-of-the-box, you need to use some 3rd party tools. Those external tools add specific triggers that log all the changes in database and replicate to other databases.
Question: How to repair a corrupt Firebird database?
Answer: Here's a short step-by-step walkthrough:
* disconnect users and disable incoming connections to the database
* make a copy of database file (or two copies) and work on that
* use GFIX with -v option to validate the database file
* use GFIX with -v and -f to do full validation
If problem is not too serious, you can try to backup the broken db and restore under a new name:
* use GFIX -mend to prepare corrupt database for backup
* use GBAK -b -g to backup the da Source: CoolInterview.com
Question: Is there some bulk load or other way to import a lot of data fast?
Answer: Currently there is only one way to quickly load a lot of data into database. That is by using external tables. You should read the manual for details, but here's a short explanation. You create a binary or textual file using the external table format and then hook it up in the database using a statement like this:
CREATE TABLE ext1 EXTERNAL 'c:myfile.txt'
To do quick import into regular table, do something like this:
Question: What is the maximum number of rows in a table in Firebird?
Answer: Maximum number of rows per table:
in Firebird is 16G (4G with Firebird 1.x) Source: CoolInterview.com
Question: How to detect applications and users that hold transactions open too long?
Answer: To do this, you need Firebird 2.1 or a higher version. First, run gstat tool (from your Firebird installation's bin directory), and you'll get an output like this:
gstat -h faqs.gdb
Database header page information:
Page size 4096
ODS version 11.1
Oldest transaction 812
Oldest active 813
Oldest snapshot 813
Next transaction 814
Now, connect to that database and query the MON$TRANS Source: CoolInterview.com
Question: How to disconnect the user connection?
Answer: Currently there is no easy way of doing it. You can bring database to some of shutdown modes, but it affects all users. If you use Classic you can (with some effort) find the users process by detecting the IP address and open database files of that process and simply kill that process. With Super Server it is not possible as the connection is run in a thread of multithreaded SuperServer process.
There are plans for future versions of Firebird to address this. For example, version 2.1 intr Source: CoolInterview.com
India News Network
Latest 20 Questions
An offer which is open for acceptance over a period of time is:
(a) Cross Offer
(b) Counter Offer
(c) Standing Offer
(d) Implied Offer
Specific offer can be communicated to__________ (a) All the parties of contract (b) General public in universe (c) Specific person (d) None of the above
_________ amounts to rejection of the original offer. (a) Cross offer (b) Special offer (c) Standing offer (d) Counter offer
A advertises to sell his old car by advertising in a newspaper. This offer is caleed: (a) General Offer (b) Special Offer (c) Continuing Offer (d) None of the above
In case a counter offer is made, the original offer stands: (a) Rejected (b) Accepted automatically (c) Accepted subject to certain modifications and variations (d) None of the above
In case of unenforceable contract having some technical defect, parties (a) Can sue upon it (b) Cannot sue upon it (c) Should consider it to be illegal (d) None of the above
If entire specified goods is perished before entering into contract of sale, the contract is (a) Valid (b) Void (c) Voidable (d) Cancelled
______________ contracts are also caled contracts with executed consideration. (a) Unilateral (b) Completed (c) Bilateral (d) Executory
A offers B to supply books @ Rs 100 each but B accepts the same with condition of 10% discount. This is a case of (a) Counter Offer (b) Cross Offer (c) Specific Offer (d) General Offer
_____________ is a game of chance. (a) Conditional Contract (b) Contingent Contract (c) Wagering Contract (d) Quasi Contract
There is no binding contract in case of _______ as one's offer cannot be constructed as acceptance (a) Cross Offer (b) Standing Offer (c) Counter Offer (d) Special Offer
An offer is made with an intention to have negotiation from other party. This type of offer is: (a) Invitation to offer (b) Valid offer (c) Voidable (d) None of the above
When an offer is made to the world at large, it is ____________ offer. (a) Counter (b) Special (c) General (d) None of the above
Implied contract even if not in writing or express words is perfectly _______________ if all the conditions are satisfied:- (a) Void (b) Voidable (c) Valid (d) Illegal
A specific offer can be accepted by ___________. (a) Any person (b) Any friend to offeror (c) The person to whom it is made (d) Any friend of offeree
An agreement toput a fire on a person's car is a ______: (a) Legal (b) Voidable (c) Valid (d) Illegal
"Holiday Packages" announced as an advertisement are an example of _________: (a) Offer (b) Counter Offer (c) Invitation to Offer (d) None of the above
A match fixing contract between a player and a broker is a: (a) Valid Contract (b) Unenforceable Contract (c) Void Contract (d) Illegal Contract
When a bookseller sells a book on cash payment then it is called as ___________: (a) Unilateral Contract (b) Bilateral Contract (c) Executed Contract (d) Executory Contract
____________ agreements are created by situation: (a) Written (b) Oral (c) Void (d) Implied