Interview Questions.

Top 100+ Firebird Interview Questions And Answers

fluid

Top 100+ Firebird Interview Questions And Answers

Question 1. Can I Concurrently Access A Firebird Database With Embedded And With Regular Server?

Answer :

If you mean it’s one database and  packages then: NO
If you mean it’s two databases and one application then: YES

Question 2. 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 question:
selectwhere rdb$system_flag isn't always null and rdbSsystem_flag 0

RDBMS Interview Questions
Question 3. How To Add Remove, Modify Users Using Sql?

Answer :

It is currently now not possible. You need to use provider API. Access to it is supplied by maximum connectivity libraries (except ODBC).

Question four. How To Change Database Dialect?

Answer :

While you could surely trade a flag in database file it isn’t recommended as there’s a lot extra to it. Different dialects have distinct methods of handling numeric and date operations, which affects all object which might be compiled into BLR (stored approaches, triggers, views, computed fields, and many others.) Fixing all that on-the-fly would be very difficult, so the endorsed way is to create a brand new database and copy the statistics. You can without problems extract the existing database shape the usage of isql after which replica the records the use of some of the tools.

MySQL Tutorial
Question five. How To Configure Events With Firewall?

Answer :

If firewall is on customer, you don’t ought to do some thing unique. If firewall is at the server, you want to set RemoteAuxPort placing in Firebird,conf record and ahead site visitors from firewall to that port.

MySQL Interview Questions
Question 6. How Do Convert Or Display The Date Or Time As String?

Answer :

Simply use CAST to suitable CHAR or VARCHAR statistics type (large sufficient). Example:

CREATE TABLE t1 (t time, d date. Ts timestamp);
INSERT INTO t1 (t,d,ts) VALUES (‘14:fifty nine:23’, ‘2007-12-three 1’, ‘2007-12-31 14:fifty nine’);
SELECT CAST(t as varchar(thirteen)), CAST(d as varchar( 10)), CAST(ts as varchar(24)) FROM t1;

Firebird could output times in HH:MM:SS.Mmmm layout (hours, minutes, seconds, milliseconds), and dates in YYYY-MM-DD (yr, month, day) format.

In case you desire a different formatting you may either use SUBSTRING to extract the information from char column, or use EXTRACT to buld a specific’.‘12 months from d) FROMt1;

Question 7. How To Create A Database From My Program?

Answer :

Firebird doesn’t offer a way to create database the use of SQL You need to both use the Services API, or outside device. As API for database advent is often no longer available in libraries, you could call Firebird’s isql device to do it for you.

Let’s first do it manually. Run the isql, and then kind:

SQL>CREATE DATAB ASE ‘C :dbasesdatabase. Rib’ consumer ‘SYSDBA’ password ‘masterkey’;
That’s it, Database is created. Type exit; to go away isql. To do it from software, you could both feed the text to execute to isql via stdin, or create a small report (ex. Create sq.) containing the CREATE DATABASE announcement after which invoke isql with -i option: isql -i create.Sq.

Linux Tutorial Linux Interview Questions
Question 8. How To Deactivate Triggers?

Answer :

You can use those SQL commands:
ALTER TRIGGER trigger_name INACTIVE;
ALTER TRIGGER trigger_name ACTIVE;
Most equipment have alternatives to set off and deactivate all triggers for a table. For instance, in Flame Robin, open the properties screen for a desk, click on Triggers at top after which Activate or Deactivate All Triggers alternatives at the lowest of the web page.

Question nine. How To Debug Stored Procedures?

Answer :

Firebird still doesn’t provide hooks for saved technique debugging but. Here are some commonplace workarounds:
* You can log values of your variables and trace the execution through external tables. External tables are not a topic of transaction manage, so the trace received’t be lost if transaction is rolled returned.
* You can turn your non-selectable stored system into selectable and run it with ‘SELECT * FROM’ as opposed to ’EXECUTE PROCEDURE’ so one can hint the execution. Just make sure you fill within the variables and call SUSPEND frequently. It’s a commonplace exercise to replace everyday variables with output columns of the equal call - in order that less code wishes to be changed.
* Some industrial equipment like IBExpert or Database Workbench parse the saved procedure body and execute statements one after the other supplying you with the emulation of saved manner run. While it does paintings well maximum of the time, please notice that the behaviour you may see in those tools won't be precisely the same as one seen with actual Firebird saved procedure - specifically if you have uninitialized variables or different events wherein behavior is undefined. Make positive you report the trojan horse reports to device makers and not to Firebird improvement crew if you run such ‘stored system debuggers’.
* Since Firebird 2.0 you may also use EXECUTE BLOCK to simulate saved methods. EXECUTE BLOCK does no longer guide input parameters, so that you want to convert all of these to nearby variables (with DECLARE VARIABLE)

Mac OS X Deployment Interview Questions
Question 10. How To Detect Applications And Users That Hold Transactions Open Too Long?

Answer :

To try this, you need Firebird 2.1 or a higher model. First, run gstat device (out of your Firebird installation’s bin directory), and also you’ll get an output like this:
gstat -h faqs.Gdb
Database “faqs.Gdb”
Database header web page records:
Flags 0
Checksum 12345
Generation 919
Page length 4096
ODS model eleven .1
Oldest transaction 812
Oldest lively 813
Oldest image 813
Next transaction 814

Now, hook up with that database and question the MON$TRANSACTTONS desk to get the MON$ATTACHMENT_ID for that transaction, and then question the MONSATTACHMENTS table to get the user call, software name, 1P address or even PID on the client device. We are searching out the oldest energetic transaction, so in this situation, a query might appear like:

SELECT ma.*
FROM MON$ATTACHMENTS ma
join MON$TRANSACTIONS mt
on ma.MON$ATTACHMENT ID - mt.MONSATTACHMENTID
where mt.MONSTRANSACTION_ID = 813,

Windows 10 Tutorial
Question eleven. How To Detect The Server Version?

Answer :

You can get this thru Firebird Service API. It does no longer work for Firebird Classic 1.0, so if you don’t get an answer you’ll realize it’s Firebird Classic 1.Zero or InterBase Classic 6.Zero. Otherwise it returns a string like this:
LI-V2.0.0. 12748 Firebird 2.Zero
or...
LI-V1 .5.3.4870 Firebird 1.5
The use of API relies upon on programming language and connectivity library you use. Some may even not provide it. Those that do, call the isc_info_svc_server_version API.

If you operate Firebird 2.1, you may also retrieve the engine model from a international context variable, like this:

SELECT rdbSget_context(’SYSTEM’, ‘ENGINE VERSION’)
from rdb$database ;

Windows Administration Interview Questions
Question 12. How To Determine Who Is And Change The Owner Of Database?

Answer :

Use the subsequent query:
SELECT DISTINCT RDB$OWNER_NAME AS DATABASE_OWNER
FROM RDB$RELATIONS
WHERE (RDB$SYSTEM_FLAG = 1 );

RDBMS Interview Questions
Question 13. How To Open The Database In Exclusive Mode?

Answer :

You want to shutdown the database (using gfix or some different device). Firebird 2.0 gives diverse shutdown modes (single-person, unmarried-connection, multiple connection, and so on.).

Windows 10 Development Tutorial
Question 14. How To Move A Multi-record Database?

Answer :

You are possibly used to having a unmarried-file database which you can pass around as lots as you want. But, your database has grown too huge and now you want a multi-record database. Paths to the secondary files are absolute and stored in the header page of the first database record. If you want to transport those documents, it is recommended which you backup the database and repair at new area. However, if you really need to copy them round, you could use freeware device G1ink by Ivan Prenosil:

Question 15. How To Monitor Firebird Server Activity?

Answer :

Firebird 2.1 introduces server-facet monitoring via unique gadget tables. This manner you may display your server immediately from SQL Those gadget tables all have prefix MON$ of their name. To use them, you need to make certain your database report is created with Firebird 2.1 or higher (ODS model eleven.1). If you've got a database this is created with earlier variations, you need to do backup and subsequent restore with Firebird 2.1 to have those tables.

Windows Server 2003 Interview Questions
Question sixteen. How To Migrate Paradox, Dbase Or Foxpro Database To Firebird?

Answer :

The easiest way is to down load the freeware IBDataPump via CleverComponents. It will extract the metadata from Paradox/dBase/FoxPro database, create all of the tables in a Firebird database after which reproduction all the statistics. You’ll probable have a equipped-to-cross Firebird database in less than one hour.

Question 17. How To Load A File Into Database Column?

Answer :

While a few different database structures might have an SQL feature for this, with Firebird you want an utility. Datatype that holds binary files is known as BLOB, and you ought to use sub_type 0, as sub_type one is for textual content-best facts. Let’s create a table to maintain the file. We’ll have a filename column and a blob column containing the report itself:
CREATE TABLE t1
(
file_name VARCHAR(200),
file_data BLOB SUB_TYPE 0
);
The blobs are loaded thru parametrized query:
INSERT INTO t1 (file_name, file_data) VALUES (?,? );

SQL Interview Questions
Question 18. How To Extract Metadata For The Entire Database?

Answer :

It’s pretty simple, use isql with -x or -a options. Please be careful and check if it works. Some commercial management equipment want to play with gadget tables immediately, and isql isn’t constantly capable of recognize their hacks You can also extract DDL with FlameRobin Open the homes page for the database and pick out DDL alternative on the top.

MySQL Interview Questions
Question 19. How To Export Data From Database And Import Into Another?

Answer :

If your databases are on-line, i.E. Seen to each different through community, then you can use some information pump device like freeware lB Pump or some of superior commercial administration gear that have this selection included.

If your databases are offline, you need to first export the facts and then import it on the other end. Most admin. Tools can do export to CVS, XML or INSERT statements. If performance is critical, or your have records with BLOB column, you could use the open supply FBExport device.

If you are searching out a manner to without problems import CS’ or XML statistics into Firebird, take a look at XML Wizard tool. You also can use it to import statistics from Microsoft Excel or OpenOffice by way of saving the sheet to .Csv layout and then importing thru XML Wizard

Question 20. How To Drop All Foreign Keys In Database?

Answer :

Deleting all overseas keys can be done by using querying the gadget tables and droping them one by one. If you operate Firebird 2 or better, it can be performed with a unmarried SQL declaration:

set time period!!;

EXECUTE BLOCK RETURNS (stmt VARCHAR(1 000)) AS
BEGIN
FOR
select ‘adjust deskin which (r. Rdb$constraint_type=’FORETGN KEY’)
into :stmt
DO begin droop; execute statement :stmt; end
END!!

Set term; !!

If you operate Firebird i .X, you can run the subsequent query to get statements to execute and then copy/paste the result and execute:
selectwherein (r.Rdb$constraint_type=’FORETGN KEY’)

NoSQL Interview Questions
Question 21. How To Do Replication Of Firebird Databases?

Answer :

Firebird does no longer offer replication out-of-the-field, you want to use some third birthday party tools. Those outside tools add specific triggers that log all the changes in database and replicate to other databases.

Question 22. How To Disconnect The User Connection?

Answer :

Currently there's no clean way of doing it. You can convey database to a number of shutdown modes, but it influences all customers. If you operate Classic you can (with some attempt) locate the customers system by way of detecting the IP cope with and open database documents of that method and simply kill that technique. With Super Server it isn't always feasible as the connection is administered in a thread of’ multithreaded SuperServer system.

There are plans for destiny versions of Firebird to cope with this. For instance. Model 2.1 introduces capability to cancel jogging queries (via deleting the applicable facts from MON$STATEMENTS desk).

Question 23. How To Present Firebird.Log File From Filling Up The Disk Partition?

Answer :

Here are a few tips:

a) create a scheduled mission or cron job a good way to truncate or rotate the log document. By rotation, we imply renaming the flies in such way that you always have some of previous logs to be had. Example.

Delete flrebird.Log.Five
rename firebird. Iog.4 firebird. Log. 5
rename flrebird.Iog.3 firebird.Log.Four
rename flrebird.Log.2 firebird.Log.3
rename firebird.Log.L f’irebird.Iog,2
rename firebird.Iog firebird.Log.1
This way you’ll constantly have last 5 logs available, and people too antique get deleted. You can also use zip, rar, bzip2 or some different packer to compress the old log documents. Since they may be undeniable text, they compress very well.

B) redirect logging to void. For example, on Linux, you may do it via developing a symlink to /dev/null in preference to the normal log file:
# cd /opt/firebird
# rm -f firebird log
in -s /dev/null firebird.Log

Advanced C++ Interview Questions
Question 24. How To Pump The Data From One Database To Another?

Answer :

Many suggest IB Pump or IB Data Pump, but the hassle is when you have complicated members of the family among tables. In such instances, it's far better to use device like FB Copy which sorts the tables through dependencies (foreign keys, take a look at constraints) into correct order

Linux Interview Questions
Question 25. How To Recreate The Index On A Firebird Table?

Answer :

Recreating the index:
ALTER INDEX indexName INACTIVE.
ALTER INDEX indexName ACT1VE

Question 26. How To Reorder The Table Columns (fields)?

Answer :

While the order need to not matter to programs (you must always use express column names in queries), perhaps it’s simpler for you when you work with tables in database management equipment. You can pass a column to unique location the use of the subsequent SQL announcement:

ALTER TABLE table_name ALTER subject name POSITION new_position:

Positions are numbered from one. If you wish to exchange two fields, make sure you run the announcement for both of them. It’s clean to run gear like Flame Robin to try this (Reorder Fields option at desk’s residences display).

Question 27. How To Repair A Corrupt Firebird Database?

Answer :

Here’s a quick step-with the aid of-step walkthrough.

* disconnect customers and disable incoming connections to the database
* make a duplicate of database record (or  copies) and paintings on that
* use GFIX with -v choice to validate the database file
* use GF1X with -v and -f to do full validation

If problem isn't too serious, you could try to backup the broken db and restore under a brand new call:

* use GF1X -mend to put together corrupt database for backup
* use GBAK -b -g to backup the database. -g disables rubbish collection
* use GBAK -c to repair backup to a new database.

If you prevail, you've got fixed the hassle and feature a practical database. If no longer, you could try to create an empty database with the identical shape and pump the facts to it.

One of the reasons why backup or restore can fail is that if some damaged database triggers exist, and prevent connection to the database. For instance, a database trigger would possibly use a few desk which has a damaged index, and so forth. To paintings round this, connect to database with isql device the use of -nodbtriggers alternative after which disable those triggers. You can permit them later whilst you repair other problems and get a working database once more.

Mac OS X Deployment Interview Questions
Question 28. How To Select A Random Record From A Table?

Answer :

There isn't any such feature in Firebird, however you could use some hints. The following instance requires which you have a unique integer column (number one secret is generally used):

SELECT.. Field_list...
FROM desk t1
WHERE situations
ORDER BY (t1 .Int_col + seed)*4294967291 -((tl .Int_col + seed)*4294967291/49157)*49157;

If you simply want one random record, restrict the result set the use of FIRST or ROWS clause. This question will supply steady facts for the equal seed. If you desire to be absolutely random, you want to change the seed. You ought to use the price of int_col from preceding run, or virtually fetch a new cost from a generator (simply ensure the equal value for seed is utilized in both places in expression).

Question 29. How To Specify Transaction Or Query Timeout?

Answer :

In order to maintain the server low affordable, you may need to restriction the time a unmarried query can devour. Firebird does now not support this immediately yet (there are plans for Firebird 3.Zero).

However, you can periodically query the tracking tables to detect and cancel lengthy running queries. You can do:

SELECT * FROM MON$STATEMENTS:
Look for the ones having MON$STATE set to at least one.

Question 30. How To Stop Superserver Service On Linux Using Only Firebird Tools?

Answer :

The server is started and stopped by means of ‘fbmgr’ executable from ‘bin’ directory of your Firebird set up. It is known as ‘ibmgr’ in Firebird 1.0. To start the server kind:
/decide/firebird/bin/fbmgr -begin

To start the server with Guardian (Guardian watches the server and restarts it if it crashes) type:
/opt/firebird/bin/fbmgr -start -all the time

To prevent a strolling server, type:
/opt/firebird/bin/fbmgr -close -consumer SYSDBA -bypass *****

To pressure a shutdown, type:
/decide/firebird/bin/fbmgr -shut -pressure -person SYSDBA -bypass *****

If you operate Firebird 2 or higher, you may also use the ordinary ‘kill’ command to shutdown the server, because it handles the signals properly. Make sure you first kill the father or mother and then the server (in any other case parent would restart the server).

Question 31. How To Tell Firebird To Only Accept Connections From Xyz Host Or Network?

Answer :

This isn’t surely a aspect you ought to be configuring in Firebird. There is a RemoteBind Address placing in firebird.Conf which configures on which interfaces/addresses the Firebird listens but that’s all. You ought to sincerely use your machine’s firewall to set this up.

Beside firewall, if you use Classic on Linux, you could use xinetd or meld access manage documents /and so on/hosts.Permit and /and many others/hosts.Deny. With xinetd you can also edit die xinetd configuration document for Firebird provider, which is in /and so forth/xinetd.D/firebird and upload a line like this:
“most effective _from 192.168.Zero.0/24”

Question 32. How To Use Events With Zebedee, Ssh Or Stunnel?

Answer :

You ought to use SuperServer, installation RemoteAuxPort placing in firebird.Conf and create two tunnels (one for facts, other for occasions).

Question 33. How To Write Udf S In Delphi?

Answer :

It’s quite simple. The handiest element you need to recollect is that you must usually use ib_util_mallocOto allocate reminiscence if your UDF returns string result. The UDF should be declared as FREE IT. So that Firebird releases the reminiscence after it reads the string.

To use ib_util_mallocO, you want to import it from ib_utildil into your application - and make sure you use it rather than everyday memory alocating functions. Here’s a simple example of Delphi UDF:

characteristic ib uti l_rnalloc(l: integer): pointer; cdecl: external ‘ib_util.Dll;
characteristic ChangeMyString(const p: PChar). PChar; cdecl:
var
s: string;
start
s := DoSomething(string(p));
Result := ib_util_malloc(Length(s) + 1);
StrPCopy(Result, s);
cease;

Declaration in Firebird:
DECLARE EXTERNAL FUNCTION ChangeMyString
CString(255)
RETURNS CString(255) FREE_IT
ENTRY_POINT ‘ChangeMyString’ MODULE_NAME ‘……’‘

Windows Administration Interview Questions
Question 34. Is It Possible To Determine Clients Ip Address?

Answer :

To get it from SQL. You need to use Firebird 2.Zero (very own deal with), or Firebird 2.1 (all of us’s):
If you operate Firebird 2.Zero or higher, use the GET_RDB$Context function with (‘SYSTEM’, ‘CLIENT_ADDRESS’) parameters.

If you use Firebird 2.1 or better, you can get deal with of any patron by means of deciding on from the tracking tables.

With Firebird I .X you may try to get the information from TCP/IP stack, the usage of netstat or lsof commands from the command-prompt. Just search for Firebird’s port (3050 or gds_db).

Question 35. Is There A Way To Automate Sql Execution From The Command-line, Batch Job Or Shell Script?

Answer :

Yes. You can use isql for this. It is placed inside the ‘bin’ directory of your Firebird installation. If you desire to attempt it interactively, run isql after which type:

isql localhost:my_database -person sysdba -pass *****
SQL> enter my_script.Sq.;
SQL> devote;
SQL>
To run it from a batch (.Bat) file or a shell script, use -i transfer:
isql -i my_script.Sq. Localhost:my_database -consumer sysdba -bypass ******

If you have some DM1. Statements on your script, make certain you put the COMMIT command at the give up of the report. Also, make certain the file ends with a newline, as isql executes the commands on the road simplest after it receives the newline man or woman.

Question 36. Is There A Way To Detect Whether Fbclient.Dll Or Tbembed.Dll Is Loaded?

Answer :

There are a few ways to detect it:
- take a look at the dimensions of DLL record
- in case you are the usage of different variations of Firebird (as an instance 1.5.4 and a couple of.Zero.1, you may question the server model thru Services API)

You have to keep in mind that fbembed can be used as a ordinary Firebird purchaser. Checking whether or not embedded or fbclient is loaded for licensing or comparable desires is in reality not useful. You may want to use the relationship string as guide, but superb server can establish direct nearby connections with out localhost prefix.

If you combine all this statistics, you could get a few conclusions:
- if DLL length fits fbembed and connection string doesn’t have hostname, you're using embedded
- if DLL length suits fbembed and connection string does have hosmame. You're the usage of both awesome server or traditional
- if DDL length suits fbclient and connection string doesn’t have hostname, you're the use of top notch server via nearby connection (IPC. XNET)
- if DLL size fits fbclient and connection string does have hostname, you are the use of both first rate server or conventional

Windows Server 2003 Interview Questions
Question 37. Is There An Example How To Configure Externalfileaccess Setting In Firebird.Conf?

Answer :

Firebird’s config document (firebird.Conf) does have descriptions inner that specify everything, but every so often they are confusing and tough to understand what must you do precisely if you don’t have examples. One of such settings is ExternalFileAccess. Some people are even tempted to put Full as it is a lot less complicated than looking to guess what’s the right format Here are the fundamental settings (‘None’ to disallow outside tables and ‘Full’ to allow them anywhere) which you probably understood yourself

ExtemalFileAccess = None
ExtemalFileAccess = Full
And right here are the ones complicated Restrict settings:
ExtemalFileAccess Restrict C :somedirectory
For a couple of directories, use some thing like this:
ExtemalFileAccess = Restrict C :somedirectory,C :someotherdirectory
For Linux users:
ExtemalFileAccess= Restrict /some/listing

Question 38. Is There An Example How To Configure Udfaccess Setting In Firebird.Conf?

Answer :

Well, there’s one right there in the firebird.Conf, however possibly it isn’t obvious sufficient. Here are the simple settings (‘None’ to disallow UDFs absolutely and ‘Full’ to allow them everywhere) that you probable understood your self:

UdfAccess None
UdfAccess = Full

And right here is that problematic Restrict placing:
UdfAccess = Restrict C:somedirectory
For a couple of directories, use some thing like this:
UdfAccess = Restrict C:somedirectoryC:’sorneotherdirectory
For Linux customers:
UdfAccess = Restrict !A few/listing

In the default putting ‘Restrict UDF, ‘UDF is a listing relative to root directory of Firebird set up.

Question 39. Why Does Reading Require Write Privileges On Database File?

Answer :

In order to run the SELECT declaration, it nevertheless desires to start a transaction.

If you want to build a examine-best database to location on some read-only media like CD or DVD ROM. You could do it with:
gfix -mode study _only database. Fdb
.....Or within your preferred administration tool. Toes is likewise available through ServicesAPl, so that you may do it out of your software as properly. Please observe that you may simplest make this modification whilst getting ready the database, because the study-simplest flag desires to be written within the database document.

When the database becomes read-handiest, the only element you could write to is the read_only flag (to reset it back to read-write).

Question forty. What Is The Maximum Number Of Rows In A Table In Firebird?

Answer :

Maximum quantity of rows consistent with desk:
in Firebird is 16G (4G with Firebird 1.X)

SQL Interview Questions




CFG