Friday, October 31, 2008

Microsoft SQL Server 2008

Hi Friends

Today I am going to talk of MS-SQL Server 2008, a very powerful tool in Database Management.


MS SQL Server 2008 aims to make data management self-tuning, self organizing, and self maintaining with the development of SQL Server Always On technologies, to provide near-zero downtime. SQL Server 2008 will also include support for structured and semi-structured data, including digital media formats for pictures, audio, video and other multimedia data. In current versions, such multimedia data can be stored as BLOBs (binary large objects), but they are generic bitstreams. Intrinsic awareness of multimedia data will allow specialized functions to be performed on them.

Other new data types include specialized date and time types and a Spatial data type for location-dependent data. Better support for unstructured and semi-structured data is provided using the FILESTREAM data type has been added, which can be used to reference any file stored on the file system. Structured data and metadata about the file is stored in SQL Server database, whereas the unstructured component is stored in the file system. Such files can be accessed both via Win32 file handling APIs as well as via SQL Server using T-SQL; doing the latter accesses the file data as a binary BLOB. Backing up and restoring the database backs up or restores the referenced files as well. SQL Server 2008 also natively supports hierarchical data, and includes T-SQL constructs to directly deal with them, without using recursive queries.

SQL Server 2008 Architecture

Protocol layer

Protocol layer implements the external interface to SQL Server. All operations that can be invoked on SQL Server are communicated to it via a Microsoft-defined format, called Tabular Data Stream (TDS). TDS is an application layer protocol, used to transfer data between a database server and a client.

Data Storage

The main unit of data storage is a database, which is a collection of tables with typed columns. SQL Server supports different data types, including primary types such as Integer, Float, Decimal, Char (including character strings), Varchar (variable length character strings), binary (for unstructured blobs of data), Text (for textual data) among others. It also allows user-defined composite types (UDTs) to be defined and used.

For physical storage of a table, its rows are divided into a series of partitions (numbered 1 to n).

Buffer Management

SQL Server buffers pages in RAM to minimize disc I/O. Any 8 KB page can be buffered in-memory, and the set of all pages currently buffered is called the buffer cache. The amount of memory available to SQL Server decides how many pages will be cached in memory. The buffer cache is managed by the Buffer Manager. Either reading from or writing to any page copies it to the buffer cache.

Concurrency and Locking

SQL Server allows multiple clients to use the same database concurrently. As such, it needs to control concurrent access to shared data, to ensure data integrity - when multiple clients update the same data, or clients attempt to read data that is in the process of being changed by another client. SQL Server provides two modes of concurrency control: pessimistic concurrency and optimistic concurrency. When pessimistic concurrency control is being used, SQL Server controls concurrent access by using locks. Locks can be either shared or exclusive. Exclusive lock grants the user exclusive access to the data - no other user can access the data as long as the lock is held. Shared locks are used when some data is being read - multiple users can read from data locked with a shared lock, but not acquire an exclusive lock. The latter would have to wait for all shared locks to be released.

The Full-Text Search functionality has been integrated with the database engine, which simplifies management and improves performance.


Pic showing SQL Server Full Text Search Service Architecture

SQL Server includes better compression features, which also helps in improving scalability. It also includes Resource Governor that allows reserving resources for certain users or workflows. It also includes capabilities for transparent encryption of data as well as compression of backups. SQL Server 2008 supports the ADO.NET Entity Framework and the reporting tools, replication, and data definition will be build around the Entity Data Model.

On the management side, SQL Server 2008 includes the Declarative Management Framework which allows configuring policies and constraints, on the entire database or certain tables, declaratively.

I will be covering some other features of this tool in my coming posts.

Happy Learning!!...

Cheers

Madhu S

Friday, October 24, 2008

MS SQL Server

Hi Friends
Today I will be discussing Q&A on SQL Server.

Q. What is Cascade and Restrict when we use DROP table in SQL SERVER?
Ans. When we are using Drop table in SQL the syntax is simple. Drop table table_name(CASCADE / RESTRICT). We use cascade to drop table although it have some dependencies just like triggers, strored procedures, primary key,foreign key it will be deleted first. But if we use Restrict an error message is shown on using of DROP if the table have some dependencies.

Q. What is DTS in SQL Server?
Ans. If an organization is big then they might be using multiple options to store data; some people might be using EXCEL some using ACCESS and some of them might be using SQL SERVER or in some other formats also but there a problem arises that how to merge that data into one format. SQL SERVER DTS helps in this problem. It provides a set of tools using which we can customise the database according to our need. DTSRun is a command-prompt
utility used to execute existing DTS packages.

Q. What are the different types of Locks?
Ans. There are three main types of locks in SQL Server.
(1) Shared locks are used for operations that does not allow to change or update data, such as a SELECT statement.
(2) Update locks are used when SQL Server intends to modify a page, and later promotes the update page lock to an exclusive page lock before actually making the changes.
(3) Exclusive locks are used for the data modification operations, such as UPDATE, INSERT, or DELETE.

Q. What is the use of DBCC commands?
Ans. DBCC stands for Database Consistency Checker. We use these commands to check the consistency of the databases i.e., maintenance, validation task and status checks. Some of the commands are: DBCC CHECKDB - Ensures that tables in the db and the indexes are correctly linked. DBCC CHECKALLOC To check that all pages in a db are correctly allocated. DBCC SQLPERF - It gives report on current usage of transaction log in percentage. DBCC CHECKFILEGROUP - Checks all tables file group for any damage.

Happy Reading!!...

Cheers

Padhaku Einstein
Contact me at einstein.padhaku@gmail.com

Friday, October 17, 2008

ADO.Net - ActiveX Data Object.Net

Hi Friends
Today I will be discussing Q&A on ADO.Net.

Q. What are Asynchronous Database Commands ?
Ans. When we execute any database, thread that is executing the command waits before the command get fully executed before executing any additional code. Thread is blocked for another process. Asynchronous Database Commands solve this problem when database command is executing, current thread can continue any other process. Thread can execute a no of database commands simultaneously. There are two benefits of using Asynchronous Database Commands.

1) Executing Multiple Database Commands simultaneously improve performance.
2) Since ASP.Net framework uses a limited pool service for request, when anyone request for a page it assigns a thread to handle the request.

Q. Why is ADO.NET serialization slower than ADO ?
Ans. ADO uses binary serialization while ADO.NET uses text based serialization. Since the text takes more space, it takes longer to write it out.
Q. How to get database schema information when connection object is established in ADO.NET ?

Ans. There is a method that helps in getting schema information that is GetSchema() and this method is called in three different ways; first way is when we call this method without any parameter it returns the metadata (table, view, stored procedure, indexes etc). When method is called by passing metadata collection name and filter criteria returns the items from the collection after applying the filter criteria and last way is when we called by passing a metadata collection name returns information about items found in the specified collection.

Q. Which one is better in .Net WebService or Remoting ?

Ans. Both of these are good but have little difference. WebService is helpful where the user who is using WebService doesnot have the .NET plateform. On the otherside for remoting we need .Net plateform on both server side and client side so in both of these remoting is faster then webservice.

Q. What is MARS support in ADO.NET ?

Ans. In First version of ADO.NET we could only do one connection on one result set. But the new feature allows us to do multiple commands on the same connection. Another feature is we can switch back and forth in command objects in connection. MARS means (Multiple Active ResultSets).
Keep Reading!!...
Cheers
Padhaku Einstein
Contact me at einstein.padhaku@gmail.com

Saturday, October 11, 2008

OOPS - Object Oriented Programming and Systems

Hi Friends
Today I will be discussing Q&A on Object Oriented Techniques.

Q. What Is OOPS ?
Ans. OOPS is an Object Oriented Programming language,which is the extension of Procedure Oriented Programming language.OOPS reduce the code of the program because of the extensive feature of Polymorphism. OOPS have many properties such as Data-Hiding,Inheritence,Data Absraction,Data Encapsulation and many more. It also increases the reusability of the code. Everything in the world is an object. The type of the object may vary. In OOPS, we get the power to create objects of our own, as & when required.

Q. what is Class ?

Ans. A group of objects that share a common definition and that therefore share common properties, operations, and behavior. A user-defined type that is defined with the class-key 'class,' 'struct,' or 'union.' Objects of a class type consist of zero or more members and base class objects.Classes can be defined hierarchically, allowing one class to be an expansion of another, and classes can restrict access to their members.

Q. What are Constructors and Destructors?
Ans. When we create instance of class a special method of that class is called that is constructor. Similarly, when the class is destroyed, the destructor method is called. These are general terms and usually not the actual member names in most object-oriented languages. It is initialized using the keyword New, and is destroyed using the keyword Finalize.

Q. What is Abstract Class ?
Ans. Classes that cannot be instantiated. We cannot create an object from such a class for use in our program. We can use an abstract class as a base class, creating new classes that will inherit from it. Creating an abstract class with a certain minimum required level of functionality gives us a defined starting point from which we can derive non-abstract classes. An abstract class may contain abstract methods & non-abstract methods. When a class is derived from an abstract class, the derived class must implement all the abstract methods declared in the base class. We may use accessibility modifiers in an abstract class.An abstract class can inherit from a non-abstract class. In C++, this concept is known as pure virtual method.

Q. What do u mean by Function Overloading ?
Ans. When more than one function is created with the same name, but difference is of their arguments . In other words, function names can be overloaded. A function may also have the same name as an attribute. In the case that there is an ambiguity between a function on a complex type and an attribute of the complex type, the attribute will always be used.
Q. What is diff. between abstract class and an interface?
Ans. An abstract class and Interface both have method only but not have body of method. The difference between Abstract class and An Interface is that if u call Abstract class then u have to call all method of that particular Abstract class but if u call an Interface then it is not necessary that u call all method of that particular interface.
Keep Reading!!...
Cheers
Padhaku Einstein

Thursday, October 2, 2008

Net Beans

Hi Friends

Today I am going to talk about NetBeans. NetBeans refers to both a platform for the development of Java desktop applications, and an integrated development environment (IDE) developed using the NetBeans Platform. NetBeans IDE is open-source and free. It Runs on Windows, Linux, Mac OS X and Solaris.

In computing, an integrated development environment (IDE) is a software application that provides comprehensive facilities to computer programmers for software development. An IDE normally consists of a source code editor, a compiler and/or interpreter, build automation tools, and (usually) a debugger.

The NetBeans Platform allows applications to be developed from a set of modular software components called modules. A module is a Java archive file that contains Java classes written to interact with the NetBeans Open APIs and a manifest file that identifies it as a module. Applications built on modules can be extended by adding new modules. Since modules can be developed independently, applications based on the NetBeans platform can be extended by third party developers.

NetBean Platform

The NetBeans Platform is a reusable framework for simplifying the development of other desktop applications. When an application based on the NetBeans Platform is run, the platform's Main class is executed. Available modules are located, placed in an in-memory registry, and the modules' startup tasks are executed. Generally, a module's code is loaded into memory only as it is needed.

The platform offers services common to desktop applications, allowing developers to focus on the logic specific to their application. Among the features of the platform are:

- User interface management (e.g. menus and toolbars)

- User settings management

- Storage management (saving and loading any kind of data)

- Window management

NetBeans IDE

The NetBeans IDE is an open-source integrated development environment written entirely in Java using the NetBeans Platform. NetBeans IDE supports development of all Java application types (J2SE, web, EJB and mobile applications).

Modularity: All the functions of the IDE are provided by modules. Each module provides a well defined function, such as support for the Java language, editing etc. NetBeans contains all the modules needed for Java development in a single download, allowing the user to start working immediately. Modules also allow NetBeans to be extended.

The latest stable version of NetBeans IDE is 6.1 and can be downloaded free from http://www.netbeans.org/.

NetBeans Scope

In Netbeans I would like to talk about scope which is the availability (or context) of an object and its intended life span in a web application. As long as a user stays on a page, the component values are remembered even when the page redisplays, such as when the user clicks a button that returns null. However, when the user leaves the page, the component values disappear.
To make values available to other pages, or to make values available to the same page, should the user return to it, you need to store the values. When you create a project from the IDE, the IDE creates three managed beans for storing values:

- RequestBean1

- SessionBean1

- ApplicationBean1

The following figure shows the Navigator window with the default managed beans.
A managed bean is a JavaBeans object that a JavaServer Faces web application instantiates and stores in either request scope, session scope, or application scope. The web application stores RequestBean1 in request scope, SessionBean1 in session scope, and ApplicationBean1 in application scope.

I will be talking about some of the more exciting features of NetBeans which makes it one of the most well accepted IDE for Application Development.
Happy Learning!!...

Cheers

Madhu S