Posted by: ripalmsoni | March 25, 2008

Logging Events

Logging Events 

Why do we need to Create EventLog ? 

No matter how well written and tested an application is, chances are high that there will be a bug or some unexpected behavior. Moreover, users typically aren’t developers and don’t use the same terminology that developers are accustomed to. It’s common to have users report problems using terminology that developers don’t recognize or understand. This communication gap makes bug verification a difficult process. And even when a bug can be verified, the circumstances that caused it might remain unknown. This reality makes identifying and fixing bugs difficult and can cause serious delays in repairing them.

Later versions of Windows such as Windows 2000, Windows XP, and Windows Server 2003 provide a mechanism to let applications log things that happen to them. This feature has many benefits. By using the event log, developers can record certain aspects of the state of an application, including serious errors. Essentially, developers can record just about anything that they think might be useful after the application is deployed. The ability to review significant events makes it much easier for support people to diagnose issues. A summary of the benefits of using Windows events and logging them are as follows:

§        Provide an easy mechanism to record specific items regarding an application’s state

§        Provide an easy mechanism to record situations that the developers consider to be out of the ordinary

§        Provide an easy mechanism for users to check on the state of applications that are running

Some Caveats about EvenLog  

§         Creating an EventLog object, writing to it, and passing it to code executing in a partial trust setting can be a huge security vulnerability. EventLog objects, including EventLogEntry objects and EventLogEntryCollection objects, should never be passed to less trusted code. This means any less trusted code, so it’s important to be cognizant of the security context these objects are executing in.

§         The EventLogPermission is required for many actions that use EventLog manipulation. Granting this permission to partially trusted code can open a serious security vulnerability. For example, mischievous code running in a partial trust environment with this permission granted could easily spoof other applications. It could, for example, shut down a critical antivirus or spyware-detection application yet make it appear as if it’s still running. The potential for mischief is unlimited.

§         Reading and logging events are relatively resource intensive in terms of disk utilization, system processor time, and other resources. EventLog objects can also get filled up, at which point attempts to write to them will cause exceptions to be thrown. EventLog objects should be used as necessary, but judiciously as well.

  Avoid EventLog objects in partial trust environments  

Use of EventLog objects in a partial trust environment can cause serious security holes and should be avoided if at all possible. 

Creating and Deleting an Event Log

To create an event log, the .NET Framework provides the EventLog class. To use it, the Source property needs to be specified and a message needs to be written, as shown in the following code, which requires the System.Diagnostics namespace:

‘ VB
Public Shared Sub CreateEventLog()
    Dim DemoLog As New EventLog(”Chap10Demo”)
    DemoLog.Source = “Chap10Demo”
DemoLog.WriteEntry(”CreateEventLog called”, EventLogEntryType.Information)
End Sub
 
// C#
public static void CreateEventLog()
   {
     EventLog DemoLog = new EventLog(”Chap10Demo”);
     DemoLog.Source = “Chap10Demo”;
DemoLog.WriteEntry(”CreateEventLog called”, EventLogEntryType.Information);
   }

After you create an EventLog object and specify its source (which, by the way, can all be done in one of the overloaded constructors), information about the object should be visible from the Windows Event Viewer.

Deleting an event log is equally simple. You may want, for example, to delete the log that you just created as part of this exercise. To remove the demonstration log, use the Delete method of EventLog in code like the following:

‘ VB
Public Shared Sub DeleteEventLog()
EventLog.Delete (”Chap10Demo”)
End Sub
 
// C#
Public static void DeleteEventLog()
{
EventLog.Delete(”Chap10Demo”);
}

Just be sure you don’t delete a log with valuable information by using this method!

Writing to an Event Log

Now that you have the code in place to create the log, it’s time to use it. Only one small enhancement needs to be made to the code sample you just created to get it to write to the event log:

‘ VB
Public Shared Sub CreateEventLog()
    Dim DemoLog As New EventLog(”Chap10Demo”)
    DemoLog.Source = “Chap10Demo”
DemoLog.WriteEntry(”CreateEventLog called”,          EventLogEntryType.Information)
End Sub
 
// C#
public static void CreateEventLog()
   {
     EventLog DemoLog = new EventLog(”Chap10Demo”);
     DemoLog.Source = “Chap10Demo”;
DemoLog.WriteEntry(”CreateEventLog called”,          EventLogEntryType.Information);
   }

In this example, the WriteEntry method looks rather simple. However, there are 10 overloads for it. As is the case with many overloaded constructors, the minimal construction can be used and then you can set all necessary properties. Or you can specify all the information you need in the constructor. Although doing everything in the overload is typically considered more elegant and straightforward, you might encounter situations in which this approach won’t work well with the rest of your code. For example, you might not know the rest of the values that you intend to record.

To make the point a little clearer, here are each of the overloads in action:

‘ VB
Public Shared Sub CreateEventLog()
    Dim DemoLog As New EventLog(”Chap10Demo”)
    DemoLog.Source = “Chap10Demo”
DemoLog.WriteEntry(”CreateEventLog called”,          EventLogEntryType.Information)
End Sub
 
// C#
public static void CreateEventLog()
   {
     EventLog DemoLog = new EventLog(”Chap10Demo”);
      DemoLog.Source = “Chap10Demo”;
DemoLog.WriteEntry(”CreateEventLog called”,          EventLogEntryType.Information);
   }

The following example shows how to use an overload to add an event ID:

‘ VB
Public Shared Sub CreateEventLog()
    Dim DemoLog As New EventLog(”Security”)
    DemoLog.Source = “Chap10Demo”
DemoLog.WriteEntry(”CreateEventLog called”,          EventLogEntryType.Information, 100)
End Sub
 
// C#
public static void CreateEventLog()
   {
     EventLog DemoLog = new EventLog(”Security”);
     DemoLog.Source = “Chap10Demo”;
DemoLog.WriteEntry(”CreateEventLog called”,          EventLogEntryType.Information, 100);
    }
 

In addition to reading custom logs, the EventLog object also gives developers the ability to read from and write to built-in event logs. The built-in logs are the Application, Security, and System logs. Even though you might have a specified log for your application, you might want to take advantage of the built-in logs. Assume for a second that you have an ASP.NET Web application that authenticates users. Assume further that you have code in place to detect attempted SQL injection attacks. Developers of an application can do little about attempted attacks (other than ensuring that the code prevents them from being successful), but security administrators will be very interested in this type of activity, even when it is unsuccessful. Therefore it makes sense to write such events to the built-in Security log, where security personnel will be sure to see it.

 ( Meaning of SQL Injection - SQL injection attacks are hack attempts made through an application that trusts user input. The attacker uses special characters to change the nature of the input in order to embed SQL-database commands. Depending on what an attacker is allowed to do, he or she might be able to completely take over the database, as well as destroy it.)

Following are examples of how to write to each of the built-in logs. Remember that you must have permission to write to those logs.

Use the following code to write to the Application log:

‘ VB

Public Shared Sub WriteToApplicationEventLog()
Dim DemoLog As New EventLog(”Application”)
DemoLog.Source = “DemoApp”
DemoLog.WriteEntry(”Written to Application Log”, EventLogEntryType.Information)
End Sub
 
// C#
public static void WriteToApplicationEventLog()
 {
   EventLog DemoLog = new EventLog(”Application”);
   DemoLog.Source = “DemoApp”;
   DemoLog.WriteEntry(”Written to Application Log”,EventLogEntryType.Information);
}
 

Use the following code to write to the Security log:

‘ VB
Public Shared Sub WriteToSecurityEventLog()
Dim DemoLog As New EventLog(”Security”)
DemoLog.Source = “DemoApp”
DemoLog.WriteEntry(”A Sql Injection Attack just occurred fromIP Address 100.000.00.0″, EventLogEntryType.Information)
End Sub
// C#
public static void WriteToSecurityEventLog()
{
  EventLog DemoLog = new EventLog(”Security”);
  DemoLog.Source = “DemoApp”;
  DemoLog.WriteEntry(”A Sql Injection Attack just occurred fromIP Address 100.000.00.0″, EventLogEntryType.Warning);
}

Use the following code to write to the System log:

‘ VB
Public Shared Sub WriteToSystemEventLog()
Dim DemoLog As New EventLog(”System”)
DemoLog.Source = “DemoApp”
DemoLog.WriteEntry(”A DemoService Restarted due to reboot”, EventLogEntryType.Information)
End Sub
// C#
public static void WriteToSystemEventLog()
 {
   EventLog DemoLog = new EventLog(”System”);
  DemoLog.Source = “DemoApp”;
  DemoLog.WriteEntry(”A DemoService Restarted due to reboot”,
EventLogEntryType.Information);
}

Reading from an Event Log

At this point, an event log has been created and data has been written to it. The EventLog object has an Entries property. This property is an instance of the EventLogEntryCollection and contains EventLogEntry objects. After you have an instance of yourEventLog class, you can easily iterate through the log entries, as illustrated by thefollowing code:

‘ VB
Public Shared Sub ReadEventLog()
     Dim DemoLog As New EventLog()
     DemoLog.Log = “Chap10Demo”
     For Each DemoEntry As EventLogEntry In DemoLog.Entries
       Console.WriteLine(DemoEntry.Source + “: ” + DemoEntry.Message)
     Next
End Sub
 
// C#
public static void ReadEventLog()
   {
     EventLog DemoLog = new EventLog();
     DemoLog.Log = “Chap10Demo”;
     foreach (EventLogEntry DemoEntry in DemoLog.Entries)
     {
      Console.WriteLine(DemoEntry.Source + “:” + DemoEntry.Message);
     }
   }
 
The only real task left to address is clearing a log. This method for doing this is one of the simplest methods to use. All you need to do is call the Clear method of the EventLog instance:
‘ VB
Public Shared Sub ClearEventLog()
        Dim LogDemo As New EventLog(”Chap10Demo”)
        LogDemo.Source = “DemoApp”
        LogDemo.Clear()
End Sub
 
// C#
public static void ClearEventLog()
   {
     EventLog LogDemo = new EventLog(”Chap10Demo”);
     LogDemo.Source = “DemoApp”;
     LogDemo.Clear();
   }
 

If you use the ReadEventLog method after calling ClearEventLog, you should see no log entries. If you see any entries—other than entries that might have been written by another piece of code in the interim—something has failed.


Download   logging events.doc

Posted by: ripalmsoni | October 3, 2007

Oracle Interview Questions

1. What are the components of Physical database structure of Oracle Database?
ORACLE database is comprised of three types of files. One or more Data files, two are more Redo Log files, and one or more Control files


2. What are the components of Logical database structure of ORACLE database?
Tablespaces and the Database’s Schema Objects.


3. What is a Tablespace?
A database is divided into Logical Storage Unit called tablespaces. A tablespace is used to grouped related logical structures together.

 
4. What is SYSTEM tablespace and When is it Created?
Every ORACLE database contains a tablespace named SYSTEM, which is automatically created when the database is created. The SYSTEM tablespace always contains the data dictionary tables for the entire database.


5. Explain the relationship among Database, Tablespace and Data file
Each databases logically divided into one or more tablespaces One or more data files are explicitly created for each tablespace.

6. What is schema?
A schema is collection of database objects of a User.

 
7. What are Schema Objects ?
Schema objects are the logical structures that directly refer to the database’s data. Schema objects include tables, views, sequences, synonyms, indexes, clusters, database triggers, procedures, functions packages and database links.



8. Can objects of the same Schema reside in different tablespaces.?
Yes.


9. Can a Tablespace hold objects from different Schemes ?
Yes.


1
0. what is Table ?
A table is the basic unit of data storage in an ORACLE database. The tables of a database hold all of the user accessible data. Table data is stored in rows and columns.

 
11. What is a View ?
A view is a virtual table. Every view has a Query attached to it. (The Query is a SELECT statement that identifies the columns and rows of the table(s) the view uses.)


12. Do View contain Data ?

Views do not contain or store data.



13. Can a View based on another View ?
Yes.


14. What are the advantages of Views ?
Provide an additional level of table security, by restricting access to a predetermined set of rows and columns of a table.
Hide data complexity.
Simplify commands for the user.
Present the data in a different perpecetive from that of the base table.
Store complex queries.

15. What is a Sequence ?
A sequence generates a serial list of unique numbers for numerical columns of a database’s tables.

16. What is a Synonym ?
A synonym is an alias for a table, view, sequence or program unit.



17. What are the type of Synonyms?
There are two types of Synonyms Private and Public.


18. What is a Private Synonyms ?
A Private Synonyms can be accessed only by the owner.
 


19. What is a Public Synonyms ?
A Public synonyms can be accessed by any user on the database.


20. What are synonyms used for ?
Synonyms are used to: Mask the real name and owner of an object.
Provide public access to an object
Provide location transparency for tables, views or program units of a remote database.
Simplify the SQL statements for database users.



21. What is an Index ?
An Index is an optional structure associated with a table to have direct access to rows, which can be created to increase the performance of data retrieval. Index can be created on one or more columns of a table.


22. How are Indexes Update ?
Indexes are automatically maintained and used by ORACLE. Changes to table data are automatically incorporated into all relevant indexes.

 
23. What are Clusters?
Clusters are groups of one or more tables physically stores together to share common columns and are often used together.



24. What is cluster Key?
The related columns of the tables in a cluster are called the Cluster Key.


25. What is Index Cluster ?
A Cluster with an index on the Cluster Key.


26. What is Hash Cluster ?
A row is stored in a hash cluster based on the result of applying a hash function to the row’s cluster key value. All rows with the same hash key value are stores together on disk.


27. When can Hash Cluster used ?
Hash clusters are better choice when a table is often queried with equality queries. For such queries the specified cluster key value is hashed. The resulting hash key value points directly to the area on disk that stores the specified rows.

 
28. What is Database Link ?
A database link is a named object that describes a “path” from one database to another.

29. What are the types of Database Links ?
Private Database Link, Public Database Link & Network Database Link.

30. What is Private Database Link ?
Private database link is created on behalf of a specific user. A private database link can be used only when the owner of the link specifies a global object name in a SQL statement or in the definition of the owner’s views or procedures.


31. What is Public Database Link ?
Public database link is created for the special user group PUBLIC. A public database link can be used when any user in the associated database specifies a global object name in a SQL statement or object definition.

 
32. What is Network Database link ?
Network database link is created and managed by a network domain service. A network database link can be used when any user of any database in the network specifies a global object name in a SQL statement or object definition.



33. What is Data Block ?

ORACLE database’s data is stored in data blocks. One data block corresponds to a specific number of bytes of physical database space on disk.


34. How to define Data Block size ?

A data block size is specified for each ORACLE database when the database is created. A database users and allocated free database space in ORACLE datablocks. Block size is specified in INIT.ORA file and cann’t be changed latter.


35. What is Row Chaining ?

In Circumstances, all of the data for a row in a table may not be able to fit in the same data block. When this occurs , the data for the row is stored in a chain of data block (one or more) reserved for that segment.

36. What is an Extent ?
An Extent is a specific number of contiguous data blocks, obtained in a single allocation, used to store a specific type of information.

37. What is a Segment ?
A segment is a set of extents allocated for a certain logical structure.

38. What are the different type of Segments ?
Data Segment, Index Segment, Rollback Segment and Temporary Segment.

39. What is a Data Segment ?
Each Non-clustered table has a data segment. All of the table’s data is stored in the extents of its data segment. Each cluster has a data segment. The data of every table in the cluster is stored in the cluster’s data segment.

40. What is an Index Segment ?
Each Index has an Index segment that stores all of its data.

41. What is Rollback Segment ?
A Database contains one or more Rollback Segments to temporarily store “undo” information.

42. What are the uses of Rollback Segment ?
Rollback Segments are used :
To generate read-consistent database information during database recovery to rollback uncommitted transactions for users.


43. What is a Temporary Segment ?

Temporary segments are created by ORACLE when a SQL statement needs a temporary work area to complete execution. When the statement finishes execution, the temporary segment extents are released to the system for future use.

44. What is a Data File ?
Every ORACLE database has one or more physical data files. A database’s data files contain all the database data. The data of logical database structures such as tables and indexes is physically stored in the data files allocated for a database.

45. What are the Characteristics of Data Files ?
A data file can be associated with only one database. Once created a data file can’t change size.
One or more data files form a logical unit of database storage called a table space.

46. What is a Redo Log?
The set of Redo Log files for a database is collectively known as the database’s redo log.


47. What is the function of Redo Log ?

The Primary function of the redo log is to record all changes made to data.


48. What is the use of Redo Log Information ?

The Information in a redo log file is used only to recover the database from a system or media failure prevents database data from being written to a database’s data files.


49. What does a Control file Contain ?

A Control file records the physical structure of the database. It contains the following information.
Database Name
Names and locations of a database’s files and redolog files.
Time stamp of database creation.

50. What is the use of Control File ?
When an instance of an ORACLE database is started, its control file is used to identify the database and redo log files that must be opened for database operation to proceed. It is also used in database recovery.  

51. What is a Data Dictionary ?
The data dictionary of an ORACLE database is a set of tables and views that are used as a read-only reference about the database.
It stores information about both the logical and physical structure of the database, the valid users of an ORACLE database, integrity constraints defined for tables in the database and space allocated for a schema object and how much of it is being used.


52. What is an Integrity Constrains ?
An integrity constraint is a declarative way to define a business rule for a column of a table.



53. Can an Integrity Constraint be enforced on a table if some existing table data does not satisfy the constraint ?

No.


54. Describe the different type of Integrity Constraints supported by ORACLE ?
NOT NULL Constraint - Disallows NULLs in a table’s column.
UNIQUE Constraint - Disallows duplicate values in a column or set of columns.
PRIMARY KEY Constraint - Disallows duplicate values and NULLs in a column or set of columns.
FOREIGN KEY Constrain - Require each value in a column or set of columns match a value in a related table’s UNIQUE or PRIMARY KEY.
CHECK Constraint - Disallows values that do not satisfy the logical expression of the constraint.


55. What is difference between UNIQUE constraint and PRIMARY KEY constraint ?
A column defined as UNIQUE can contain NULLs while a column defined as PRIMARY KEY can’t contain Nulls.


56. Describe Referential Integrity ?
A rule defined on a column (or set of columns) in one table that allows the insert or update of a row only if the value for the column or set of columns (the dependent value) matches a value in a column of a related table (the referenced value). It also specifies the type of data manipulation allowed on referenced data and the action to be performed on dependent data as a result of any action on referenced data.
 


 
57. What are the Referential actions supported by FOREIGN KEY integrity constraint ?
UPDATE and DELETE Restrict - A referential integrity rule that disallows the update or deletion of referenced data.
DELETE Cascade - When a referenced row is deleted all associated dependent rows are deleted.



58. What is self-referential integrity constraint ?
If a foreign key reference a parent key of the same table is called self-referential integrity constraint.


59. What are the Limitations of a CHECK Constraint ?
The condition must be a Boolean expression evaluated using the values in the row being inserted or updated and can’t contain subqueries, sequence, the SYSDATE,UID,USER or USERENV SQL functions, or the pseudo columns LEVEL or ROWNUM.

60. What is the maximum number of CHECK constraints that can be defined on a column ?
No Limit.


Downloan basic-oracle-questions.doc

Posted by: ripalmsoni | September 13, 2007

Basic InterviewQuestions for PL/SQL

1. What is PL/SQL ?
Ans.
PL/SQL is a procedural language that has both interactive SQL and procedural programming language constructs such as iteration, conditional branching.


2. What is the basic structure of PL/SQL ?
Ans.
PL/SQL uses block structure as its basic structure. Anonymous blocks or nested blocks can be used in PL/SQL.


3. What are the components of a PL/SQL block ?
Ans.
A set of related declarations and procedural statements is called block.


4. What are the components of a PL/SQL Block ?
Ans.
Declarative part, Executable part and Exception part.
Datatypes PL/SQL


5. What are the datatypes a available in PL/SQL ?
Ans.
Some scalar data types such as NUMBER, VARCHAR2, DATE, CHAR, LONG, BOOLEAN.
Some composite data types such as RECORD & TABLE.


6. What are % TYPE and % ROWTYPE ? What are the advantages of using these over datatypes?
Ans.
% TYPE provides the data type of a variable or a database column to that variable.
% ROWTYPE provides the record type that represents a entire row of a table or view or columns selected in the cursor.
The advantages are :
I. Need not know about variable’s data type
ii. If the database definition of a column in a table changes, the data type of a variable changes accordingly.


7. What is difference between % ROWTYPE and TYPE RECORD ?
Ans.
% ROWTYPE is to be used whenever query returns a entire row of a table or view.
TYPE rec RECORD is to be used whenever query returns columns of different
table or views and variables.
E.g. TYPE r_emp is RECORD (eno emp.empno% type,ename emp ename %type
);
e_rec emp% ROWTYPE
cursor c1 is select empno,deptno from emp;
e_rec c1 %ROWTYPE.
 
8. What is PL/SQL table ?
Ans.
Objects of type TABLE are called “PL/SQL tables”, which are modeled as (but not the same as) database tables, PL/SQL tables use a primary PL/SQL tables can have one column and a primary key.

9. What is a cursor ? Why Cursor is required ?
Ans.
Cursor is a named private SQL area from where information can be accessed. Cursors are required to process rows individually for queries returning multiple rows.

10. Explain the two type of Cursors ?
There are two types of cursors, Implicit Cursor and Explicit Cursor.
PL/SQL uses Implicit Cursors for queries.
User defined cursors are called Explicit Cursors. They can be declared and used.

11. What are the PL/SQL Statements used in cursor processing ?
Ans.
DECLARE CURSOR cursor name, OPEN cursor name, FETCH cursor name INTO or Record types, CLOSE cursor name.

12. What are the cursor attributes used in PL/SQL ?
Ans.
%ISOPEN - to check whether cursor is open or not
% ROWCOUNT - number of rows fetched/updated/deleted.
% FOUND - to check whether cursor has fetched any row. True if rows are fetched.
% NOT FOUND - to check whether cursor has fetched any row. True if no rows are fetched.
These attributes are proceeded with SQL for Implicit Cursors and with Cursor name for Explicit Cursors.

13. What is a cursor for loop ?
Ans.
Cursor for loop implicitly declares %ROWTYPE as loop index, opens a cursor, fetches rows of values from active set into fields in the record and closes
when all the records have been processed.
eg. FOR emp_rec IN C1 LOOP
salary_total := salary_total +emp_rec sal;
END LOOP;

14. What will happen after commit statement ?
Ans.
Cursor C1 is
Select empno,
ename from emp;
Begin
open C1; loop
Fetch C1 into
eno.ename;
Exit When
C1 %notfound;—–
commit;
end loop;
end;
The cursor having query as SELECT …. FOR UPDATE gets closed after COMMIT/ROLLBACK.
The cursor having query as SELECT…. does not get closed even after COMMIT/ROLLBACK.

15. Explain the usage of WHERE CURRENT OF clause in cursors ?
Ans.
WHERE CURRENT OF clause in an UPDATE, DELETE statement refers to the latest row fetched from a cursor.

16. What is a database trigger ? Name some usages of database trigger ?
Ans.
Database trigger is stored PL/SQL program unit associated with a specific database table. Usages are Audit data modifications, Log events transparently, Enforce complex business rules Derive column values automatically, Implement complex security authorizations. Maintain replicate tables.

17. How many types of database triggers can be specified on a table ? What are they ?
Ans.
Insert Update Delete
Before Row o.k. o.k. o.k.
After Row o.k. o.k. o.k.
Before Statement o.k. o.k. o.k.
After Statement o.k. o.k. o.k.
If FOR EACH ROW clause is specified, then the trigger for each Row affected by the statement.
If WHEN clause is specified, the trigger fires according to the returned boolean value.


18. Is it possible to use Transaction control Statements such a ROLLBACK or COMMIT in Database Trigger ? Why ?
Ans.
It is not possible. As triggers are defined for each table, if you use COMMIT of ROLLBACK in a trigger, it affects logical transaction processing.


19. What are two virtual tables available during database trigger execution ?
Ans.
The table columns are referred as OLD.column_name and NEW.column_name.
For triggers related to INSERT only NEW.column_name values only available.
For triggers related to UPDATE only OLD.column_name NEW.column_name values only available.
For triggers related to DELETE only OLD.column_name values only available.


20. What happens if a procedure that updates a column of table X is called in a database trigger of the same table ?
Ans.
Mutation of table occurs.


21. What is an Exception ? What are types of Exception ?
Ans.
Exception is the error handling part of PL/SQL block. The types are Predefined and user_defined. Some of Predefined exceptions are.
CURSOR_ALREADY_OPEN
DUP_VAL_ON_INDEX
NO_DATA_FOUND
TOO_MANY_ROWS
INVALID_CURSOR
INVALID_NUMBER
LOGON_DENIED
NOT_LOGGED_ON
PROGRAM-ERROR
STORAGE_ERROR
TIMEOUT_ON_RESOURCE
VALUE_ERROR
ZERO_DIVIDE
OTHERS.


22. What is Pragma EXECPTION_INIT ? Explain the usage ?
Ans. The PRAGMA EXECPTION_INIT tells the complier to associate an exception with an oracle error. To get an error message of a specific oracle error.
e.g. PRAGMA EXCEPTION_INIT (exception name, oracle error number)


23. What is Raise_application_error ?
Ans.
Raise_application_error is a procedure of package DBMS_STANDARD which allows to issue an user_defined error messages from stored sub-program or database trigger.


24. What are the return values of functions SQLCODE and SQLERRM ?
Ans.
SQLCODE returns the latest code of the error that has occurred.
SQLERRM returns the relevant error message of the SQLCODE.

25. Where the Pre_defined_exceptions are stored ?
Ans.
In the standard package.

26. What is a stored procedure ?
Ans.
A stored procedure is a sequence of statements that perform specific function.

27. What is difference between a PROCEDURE & FUNCTION ?
Ans.
A FUNCTION always returns a value using the return statement.
A PROCEDURE may return one or more values through parameters or may not return at all.

28. What are advantages fo Stored Procedures ?
Ans. Extensibility, Modularity, Reusability, Maintainability and one time compilation.

29. What are the modes of parameters that can be passed to a procedure ?
Ans.
IN, OUT, IN-OUT parameters.

30. What are the two parts of a procedure ?
Ans.
Procedure Specification and Procedure Body.

31. Give the structure of the procedure ?
Ans.
PROCEDURE name (parameter list…..)
is
local variable declarations
BEGIN
Executable statements.
Exception.
exception handlers
end;

32. Give the structure of the function ?
Ans.
FUNCTION name (argument list …..) Return datatype is
local variable declarations
Begin
executable statements
Exception
execution handlers
End;

33. Explain how procedures and functions are called in a PL/SQL block ?
Ans.
Function is called as part of an expression.
sal := calculate_sal (’a822′);
procedure is called as a PL/SQL statement
calculate_bonus (’A822′);

34. What is Overloading of procedures ?
Ans.
The Same procedure name is repeated with parameters of different datatypes and parameters in different positions, varying number of parameters is called overloading of procedures.
e.g. DBMS_OUTPUT put_line

35. What is a package ? What are the advantages of packages ?
Ans.
Package is a database object that groups logically related procedures.
The advantages of packages are Modularity, Easier Application Design, Information. Hiding,. reusability and Better Performance.

36.What are two parts of package ?
Ans.
The two parts of package are PACKAGE SPECIFICATION & PACKAGE BODY.
Package Specification contains declarations that are global to the packages and local to the schema.
Package Body contains actual procedures and local declaration of the procedures and cursor declarations.

37. What is difference between a Cursor declared in a procedure and Cursor declared in a package specification ?
Ans.
A cursor declared in a package specification is global and can be accessed by other procedures or procedures in a package.
A cursor declared in a procedure is local to the procedure that can not be accessed by other procedures.

38. Name the tables where characteristics of Package, procedure and functions are stored ?
Ans.
User_objects, User_Source and User_error 


 Download in word document -   pl-sql-interview-questions.doc

Posted by: ripalmsoni | September 10, 2007

Crystal Reports - For Visual Studio 2005 Walkthroughs - Contents

DOWNLOAD COMPLETE PDF FILE : Crystal Reports For Visual Stuido 2005

Crystal Reports - For Visual Studio 2005 Walkthroughs - By Ripal Soni

Contents

  1. CrystalReportViewer Object Model Tutorials
  2. Logging onto a Secure SQL Server Database
  3. Reading and Setting Discrete Parameters
  4. Reading and Setting Range Parameters for a Subreport
  5. Filtering Data Using Selection Formulas
  6. Customizing the CrystalReportViewer Control
  7. ReportDocument Object Model Tutorials
  8. Persisting the ReportDocument Object ModelUsing Session
  9. Logging onto a Secure SQL Server Database Using SQL Authentication
  10. Logging onto a Secure SQL Server Database Using Integrated Security
  11. Logging onto a Secure SQL Server Database with a Subreport
  12. Reading and Setting Discrete Parameters
  13. Reading and Setting Parameters with a Subreport
  14. Exporting to Multiple Formats
  15. Printing and Setting Print Options
  16. Filtering Data Using Selection Formulas
  17. Displaying Report Parts with the CrystalReportPartsViewer Control
  18. Reduced-Code Tutorials in Visual Studio 2005
  19. Web Site Setup with Crystal Reports Using Smart Tasks
  20. Windows Project Setup with Crystal Reports using Smart Tasks
  21. Secure Database Logon in a Web Site
  22. Parameter Setting in a Web Site
  23. Exposing Report Data to Other Controls in a Web Site
  24. Exposing Report Data to Other Controls in a Windows Application
  25. Data Connectivity Tutorials
  26. Connecting to ADO.NET DataSets
  27. Connecting to IDataReader
  28. Connecting to Object Collections
  29. Other Tutorials
  30. Configuring Multilingual Client Support
  31. Creating a User Function Library
  32. Populating a Drop Down List of Reports from the File Directory
  33. Populating a Drop Down List of Reports from a Web Service
  34. Triggered Export with the ReportExporter Control
  35. Deployment Tutorials
  36. Deploying a Windows Application with ClickOnce Deployment
  37. Creating a New Web Site Deployment Project with Windows Installer
  38. Creating a New Windows Application Deployment Project with
  39. Windows Installer
  40. Migrating a Project that Uses Crystal Reports for Visual Studio .NET
  41. 2002 or 2003 Merge Modules Deploymen
  42. Migrating a Project that Uses Crystal Reports for Visual Studio 2005
  43. Merge Modules Deployment
  44. Performing a Silent Installation with a Windows Installer
  45. Deploying Web Sites with Merge Modules
  46. Deploying Windows Applications with Merge Modules
  47. Configuring Database Driver Installation Options
  48. Appendix
  49. Crystal Reports Product Keycode and Registration Number
  50. Design Time Preview
  51. Formula Reference
  52. System Setup
  53. What Needs to be Installed?
  54. What Needs to be Verified?
  55. Add New Item Dialog Box Includes Crystal Reports
  56. 64-Bit Development Configuration
  57. Optional Installation: MSDE
  58. MSDE Installation with Windows or SQL Server Authentication
  59. Northwind Database Installation
  60. Security: Creating a Limited Access Database Account
  61. Sample Reports’ Directory
  62. Tutorials’ Sample Code Directory
  63. Viewers’ Virtual Directory
  64. Location of Xtreme Sample Database
  65. ODBC DSN Entry for Xtreme Sample Database
  66. Project Setup
  67. Additional Setup Requirements
  68. Multilingual Client Support
  69. Useful Addresses at a Glance
  70. Which Persistence Approach Should I Use with Crystal Reports?
  71. .NET Framework 2.0
  72. Crystal Reports for .NET Framework 2.0 Windows Installer
  73. Merge Modules Summary
  74. Crystal Reports Merge Modules for Visual Studio 2005

Posted by: mauliksoni | June 6, 2007

C# .Net Interview Questions

1. What standard types does C# use?

C# supports a very similar range of basic types to C++, including int, long, float, double, char, string, arrays, structs and classes. In C# Types The names may be familiar, but many of the details are different. For example, a long is 64 bits in C#, whereas in C++ the size of a long depends on the platform (typically 32 bits on a 32-bit platform, 64 bits on a 64-bit platform). Also classes and structs are almost the same in C++ - this is not true for C#. Finally, chars and strings in .NET are 16-bit (Unicode/UTF-16), not 8-bit like C++.

2.What is the syntax to inherit from a class in C#?

Place a colon and then the name of the base class.

Example: class DerivedClassName: BaseClassName

3.How can I make sure my C# classes will interoperate with other .Net languages?

Make sure your C# code conforms to the Common Language Subset (CLS). To help with this, add the [assembly: CLSCompliant (true)] global attribute to your C# source files. The compiler will emit an error if you use a C# feature which is not CLS-compliant.

4.Does C# support variable argument on method?

The params keyword can be applied on a method parameter that is an array. When the method is invoked, the elements of the array can be supplied as a comma separated list.So, if the method parameter is an object array,

void paramsExample(object arg1, object arg2, params object[] argsRest)

{ foreach (object arg in argsRest)

{

/* …. */

}

}

then the method can be invoked with any number of arguments of any type.paramsExample(1, 0.0f, “a string”, 0.0m, new UserDefinedType());

5.What’s the difference between const and readonly?

Readonly fields are delayed initalized constants. However they have one more thing different is that; When we declare a field as const it is treated as a static field. where as the Readonly fields are treated as normal class variables.const keyword used ,when u want’s value constant at compile time but in case of readonly ,value constant at run timeForm the use point of view if we want a field that can have differnet values between differnet objects of same class, however the value of the field should not change for the life span of object; We should choose the Read Only fields rather than constants.Since the constants have the same value accross all the objects of the same class; they are treated as static.

Read More…

Posted by: mauliksoni | May 16, 2007

.Net 2.0 Interview Terms / Interview Questions

.NET 2.0 Terms / Interview Questions

access control list (ACL) A term most commonly used to refer to a discretionary access control list (DACL), which is an authorization restriction mechanism that identifies the users and groups that are assigned or denied access permissions on an object.

Advanced Encryption Standard (AES) A synonym for Rijndael, which is a symmetric encryption algorithm that uses key sizes of 128 through 256 bits.

application domain A logical container that allows multiple assemblies to run within a single process, while preventing them from directly accessing another assembly’s memory.

application setting A custom setting that the application reads, writes, or both.

Read More…

Posted by: ripalmsoni | May 1, 2007

OOPs Interview Questions

“The ability to define a class and create instances of classes is one of the most important capabilities of any Object Oriented Language”

 

Q: How will you define a CLASS ?

A: All classes in Visual Basic. NET are defined in a .VB file (as oppose to .CLS file in vb6), Also .VB file may contain one or more classes. The basic syntax of a class is as follows:

 

Class ClassName

 

End Class

 

Public|Protected|Friend|Protected Friend|Private Class Vehicle

 

End Class

Read More…

Posted by: ripalmsoni | April 25, 2007

Print PDF file in VB.Net by giving Printer Name

Here is the solution of printing PDF file by giving printer name

Dim pathToExecutable As String = “AcroRd32.exe”

Dim sReport = “C:Test.PDF” ‘Complete name/path of PDF file

Dim SPrinter = “HP Officejet 5600 seriese” ‘Name Of printer

Dim starter As New ProcessStartInfo(pathToExecutable, “/t “ + sReport + ” “ + sPrinter + “”)
Read More…

Posted by: ripalmsoni | April 3, 2007

ASP.NET 1.1 Interview Questions

1.What is the difference between Response.Write() and Response.Output.Write()?
Ans.Response.Output.Write() allows you to write formatted output.
2.What is the difference between Server.Transfer and Response.Redirect?
Ans.
Server.Transfer transfers page processing from one page directly to the next page without making a round-trip back to the client’s browser.This provides a faster response with a little less overhead on the server.Server.Transfer does not update clients url historylist or current url.
Response.Redirect is used to redirect the user’s browser to another page or site.This performs a trip back to the client where client’s browser is redirected to the new page.The user’s browser history list is updated to reflect the new address.
3.Explain the difference between server-side code and client-side code.
Ans.
Server-side code executes on the server.Client-side code executes on the client’s browser.
4.Describe the difference between inline code and code behind.
Ans.
Inline code written along side the html in a page.Code-behind is code written in seprate file and refrenced by .aspx in page.
5.What methods are fired during page load?
Ans.
Init() - when the page is instantiated
Load() - when the page is loaded into server memory
PreRender() - the brief moment before the page is displayed to the user as HTML
Unload() - when page finishes loading.

Read More…

Posted by: ripalmsoni | March 29, 2007

.Net Framework 1.1 Interview Questions

1. What is an assembly?

Ans. Assemblies are the smallest units of versioning and deployment in .Net application.Assemblies are also building blocks for programs such as Web Services,Windows Services,Service Components and .Net Remoting Applications.

Here are some general Concepts of an Assembly.

  • An Assembly is a logical unit of code
  • Assembly physically exist as DLLs or EXEs
  • One assembly can contain one or more files
  • The constituent files can include any file types like image files, text files etc. along with DLLs or EXEs
  • When you compile your source code by default the exe/dll generated is actually an assembly
  • Unless your code is bundled as assembly it can not be used in any other application
  • When you talk about version of a component you are actually talking about version of the assembly to which the component belongs.
  • Every assembly file contains information about itself. This information is called as Assembly Manifest.
  • For more information about an Assembly please visit http://msdn2.microsoft.com/en-us/library/hk5f40ct.aspx

    2.What is Satellite assembly?

    Ans. A .NET Framework assembly containing resources specific to a given language. Using satellite assemblies, you can place the resources for different languages in different assemblies, and the correct assembly is loaded into memory only if the user elects to view the application in that language.

    3.What is MSIL?

    Ans. Microsoft Intermediate Language (MSIL) is a platform independent language that gets compiled into platform dependent executable file or dynamic link library.It means .NET Compiler can generate code written using any supported languages and finally convert it to the machine code depending on the target machine.

    4.What is CLR?

    Ans. CLR is Common Language Runtime that provides multi-language execution environment for .NET.It executes the MSIL code to the native machine code.It helps us to use classes which is created in another .NET language.For eg. You can use a class created using vb in c#.

    5.What is CTS?

    Ans. CTS is the .NET Framework specification for defining, declaring, and managing types in .NET languages for the Common Language Runtime (CLR). All .NET components must comply with the CTS specification.

    Read More…

    Older Posts »

    Categories