Tuesday, 10 December 2013

JNTU Kakinada to Change the pattern of Evaluation to Online

It was recently intimated to all the colleges under the affiliation of JNTU Kakinada, that the pattern of conducting and evaluating the end examinations: semesters are being changed to online system: that the papers from now will be valuated through an online systems. Although students may feel it embarrassing, the thing is that the papers are corrected manually, but the marks will be posted through an automated system, so that there won't be any more blunders in the evaluation. The principals of the affiliated colleges were informed to reflect the changes suggested accordingly. There are news that the changes will come into effect after 20th December 2013, while some say that this will apply to all the examinations held in and after december. However students are advised for the following while writing exams:

  1. Use only black ink ball point pen for writing the exam
  2. Use only HB pencil for diagrams
  3. The Question numbers are to be marked in the boxes given on the left side.
  4. Avoid strikes and over writings on the paper.

Sunday, 27 October 2013

About SELECT Command




I would like to discuss about a very simple command, but the most used at the same time. Its the only display statement we have in our Oracle SQL. Hence it gets the most importance. Its the SELECT Query. Its called a Data Query Language Command: a Special set which is used to retrieve and display the rows from a table. We have different types of modifications in the command to suite the different modulations of the output: for example selective rows, differed names etc.,

There can have three types of operations basically a table can have:
  1. Selecting a few Rows from the table.
  2. Selecting a few Columns from the table.
  3. Joining two tables and getting together the output.

There are three types of syntax modifications for the three types of retrievals:




SELECT FROM  

This gets you the suggested columns from the table. 

For example:  We have 

Student(num, name,total,average,section) 

and the query goes: 



SELECT num,name,section FROM Student;

SELECT /* FROM  
WHERE ; 
                           
This gets you the selected rows for a table. For example in our previous Student table, if we want to retrieve the details of a student of number 101 from the table then, We have the following Query: 


SELECT * FROM Student WHERE num=101;

SELECT FROM ,.... WHERE ;
         
This gets you rows from two tables that share a common thing. Now that in our example if we have another table Marks 

Marks(num,sub1,sub2,sub3)

If we want to have the marks of the student with number and name printed along with the marks, then: The Query will be,

SELECT s.num,s.name,m.sub1,m.sub2 from Student s,Marks m where s.num=m.num;

Now that we have seen the ways to have our select query, we can also use some constants while displaying the values: using an operator || . The constant is enclosed under ' '.


Example: SELECT num,||' is '||, name FROM Student;

This statement displays number and name with 'is' in the middle. Another interesting this is the use of keywords in the middle. Oracle uses keywords like 'SYSDATE' , 'USER' etc., for specific things. For Example: 

SELECT USER FROM DUAL; 

displays the current working user, while 

SELECT SYSDATE FROM DUAL; 

displays the current date.

Constraints in Oracle SQL

The methods by which the database provides security and Integrity are the constraints that provide some restriction on data. There are mainly three types of Constraints in Oracle. they are:
  • Integrity Constraints
  • Domain Constraints
  • Referential Constraints
Now we'll look at some keywords which have their impact on the database, as constraints. they are:
  1. NOT NULL
  2. UNIQUE
  3. PRIMARY KEY
  4. FOREIGN KEY
  5. CHECK

NOT NULL: This constraint provides the restriction that : the data shouldn't be given a NULL, this implies that we shouldn't leave the column empty without giving any value. The syntax for using NOT NULL, is as follows: 

Syntax:  NOT NULL

Example: 
create table Teacher_Details(
         id number(5),
        name varchar2(15),
        class_Room number(3) NOT NULL
);

UNIQUE: This constraint provides the restriction that: the data we enter shouldn't contain duplication, this implies that there should not be any repeated values in the table. the syntax for the above can be in two ways: one straight after the data definition and other after the definitions at the end of the table.

Syntax: constraint UNIQUE

Example:
create table Teacher_Details(
         id number(5),
        name varchar2(15) constraint name_un UNIQUE,
        class_Room number(3) NOT NULL
);


PRIMARY KEY: Its like a combination of UNIQUE and NOT NULL. It provides a facility to the table: it uniquely identifies a row in a table.

syntax: constraint PRIMARY KEY

Example:
create table Teacher_Details(
         id number(5) constraint id_pk PRIMARY KEY,
        name varchar2(15),
        class_Room number(3) NOT NULL
);

FOREIGN KEY: Its like a link between to related tables, that in turn provides a parent child relationship like we see in inheritance. Yes, we can say that Oracle too implements inheritance with the help of foreign key constraint, but regarding other properties: I don't know!

It helps a lot in joining two tables, suppose that we divide students and classes into two tables, we can have a column in common called, class_num say. Now if we want to search for a class then we can join the tables while query using this foreign key. a foreign key attribute can't be deleted if there's an entry in the parent table and viceversa. hence in such cases, we first delete the entry in the child table and then go for the parent one.

Syntax: constraint REFERENCES ()

Example:

//Parent Table
create table Teacher_Details(
         id number(5) constraint id_pk PRIMARY KEY,
        name varchar2(15),
        class_Room number(3)
);

//Child Table
create table Class_Details(
        class_Room number(3) constraint class_fk REFERENCES Teacher_Details(class_Room),
        class_strength number(100),
        class_Status char(2) NOT NULL
);

Data types in Oracle SQL



You all know that we are aiming at one common thing in every programming language: that is data. yes, we target data in every programming methodology with the use of types of data. in the oracle too, we have data types to work with different types of data. they are:
  • Number(n)
  • Number(p,q)
  • char(n)
  • varchar2(n)
  • varchar
  • Date
  • Nchar(n)
  • Nvarchar2(n)
First of all, we'll go for the very first one in the line: Number. Have you noticed that there are two Number types i have shown? The first one has only a single parameter in the braces, while the second one has two entries. We'll go for number(n).

number(n) is used to store or define numbers or integers of n digits. This means that if we declare an attribute by the type Number(n), then the attribute can hold a value of at most n digits.

Example:
                          create table Student_Number(snum number(5));

However, when we add another value m to the Number(n) syntax, it would become Number(n,m) which is used to define float type or decimal type variables. the variable will be at most n digits with n-m-1 as left to decimal and m to the right of decimal.

For example, if we define Number(5,2) for an attribute, then the attribute can hold:
  1. 5 total digits, including decimal
  2. 2 digits as number
  3. 2 digits as decimal
  4. one is reserved for the decimal (.)
Example:
                         create table Item_Price(price Number(10,2));

The third type is character, it is obviously used to store alpha numeric characters, or strings. If we define an attribute as char(n), then the attribute can hold at most of n characters. the dis advantage of using char(n) for defining strings is that, if the data stored is either less or equal: the fixed block of memory is given. If our data is lesser than allocated, its sure a waste. Hence a new type has been developed, its varchar2(n). it has the answer for the above discussed problem. the data is given memory up to the needed, but not excess. this sure saves memory. Hence we generally declare strings with varchar2().

Example:

create table Student_Name(initial char(1)name varchar2(10)last_name varchar2(10));

If you question me that why we're talking all the way about varchar2() and not varchar() ? well the answer is like what we would see in Java, Reserved Keywords. In the same sound, varchar() is also reserved for future use. Date type is used to store the date, Oracle supports Date in the format "DD-MON-YY". Hence the date in that format will be stored.

Example:

create table Student_Register(initial char(1), name varchar2(10)last_name varchar2(10)doj date);

Nchar() and Nvarchar2() are similar to the char() and varchar2() in their properties and behavior  but the thing that changes is the data stored. Nchar and Nvarchar2 store data in uni code format.

DCL Commands and Introduction to Programming in Oracle

DCL commands are generally used in controlling the permissions of a designer on a table. there are the following commands in the DCL category:
  • Grant: This command grants permissions to the user of a database. He can be given permissions to get connected, utilize the resources like manipulation commands (insert, delete etc.,)
  •  Revoke: This is the opposite of the grant: it removes the permissions of an user on a database.

Summary of the Commands:



Creating User into Oracle:

The steps are:
  1. Download a version of Oracle database from Oracle site ( I prefer Oracle 10xe).
  2. Install The Database onto your disk, the system will start functioning as your database.
  3. Now open the Oracle command-line.
  4. The window will some what be similar to the windows command-line.


    After you have obtained the above state, go for the following sequence of commands to have your own user and password. Oracle will provide by default an username and a password, it can be chosen while installing the oracle itself. The default user can be system/system or system/manager. My notation is here of the form username/password style.

    1. connect
    2. Enter username: system
    3. Enter password: system/manager
    4. now you should get the result as "connected." Now type in
    5. create user identified by ;
    6. you'll get a sign "user created." Now type in
    7. grant connect,resources to
    8. you'll get a sign "grant succeeded." Now type in
    9. connect
    10. username:
    11. password:
    12. you'll get "connected." 
    To check whether you are in which username, type in "show user". You'll get 
    USER is

    To clear the screen, type "cl scr"


    Remember, every time you are to use your oracle, you must connect with your username and password combination. We'll now create a small table Student, with the following attributes:

    • snum : number
    • sname : string (alpha numeric)
    • class : string (pure character)
    • subject : string (alpha numeric)
    For now just think that alpha numeric can be expressed in the best way as using "varchar2" datatype in oracle. we'll discuss the datatypes in our next issue.

    the command for the above table is as:


    create table student(snum number(5), sname varchar2(10), class varchar2(5), subject varchar2(5));


    the result should be " table created".


    Now we'll insert some data into the table:


    insert into student values (1101, 'rambabu', 'section1', 'java');


    output: '1 row(s) inserted'


    update table student set snum=101 where snum=1101;


    output: '1 row(s) updated'


    delete * from student where snum=101;


    output: '1 row(s) deleted'


    select * from tab;


    output: "This shows the tables that are present in your user directory"

    DML Commands

    Previously, we've been talking about the various commands of sql used in oracle database programming. Now we'll continue our talks with the next category of commands. they are the DML commands. DML stands for Data Manipulation Language commands. the commands that come under this category are:
    • Select
    • Insert
    • Update
    • Delete
    SELECT:

    This command is called a query, its basically used to retireve the data present in the table ofour data base. It has the following full syntax:

    Syntax:

    SELECT column_names FROM table_name [WHERE condition];

    This is in case of a varied number of rows. If we want to retrieve the entire rows of a given table, we simply replace our column_names by a * .


    SELECT * FROM table_name [WHERE condition];

    Example: 

    1. SELECT sno,sname,sec FROM student;
    2. SELECT* FROM student;

    Although SELECT command can be used in more lengthy manner, we'll restrict our syntax to here for now. we'll have a complete syntax after we have further more commands.


    INSERT:


    This is a command that can be used for adding rows to a table. we use this to add a row having all the attributes to a table. the unknown attributes are left with a NULL, that can be replaced later.


    The syntax of an INSERT command is:


    Syntax:


    INSERT INTO table_name VALUES ( value_1, value_2, value_3,...);


    Example:


    INSERT INTO student VALUES (1101, ram, s2);


    UPDATE:


    this command can be used to modify an old value of a table with a new value, obviously used in replacements of entries. The syntax for this command is:


    Syntax:


    UPDATE TABLE table_name SET column_value=new_value WHERE column_value=old_new;


    Example:

    UPDATE TABLE student SET sno=1102 WHERE sno=1101;

    DELETE:

    this command deletes a row or a number of rows from the table, if we want to retain the table structure clearing all the entries, we can use * in place of the column names. the syntax of the command will be as follows:

    Syntax:

    DELETE column_names FROM table_name WHERE condition;

    Example:

    DELETE sno,sname FROM student WHERE sno=1101;

    Summary:

    SQL Command Types



    As we've seen in the last discussion, the heart of any database lies in the query language. This is similar to the case that sql is the heart of database systems. There are three types of SQL Commands
    • Data Definition Language
    • Data Manipulation Language
    • Data Control Language
    Data Definition Language:
    This is what a database needs to be created: a basic set of commands used to create, and drop the data from the database. We use these commands with one flexibility, that they are auto saved commands. This is one we need to look at now:

    There's a command called commit, in the Oracle's Sql list. This command saves the previously modified data. Since its all related to Data manipulation, every DML command must be accompanied by a commit command.


    DDL command are auto saved in this sense: once they are executed, they are auto committed. Hence we need not explicitly save them.


    The commands in the DDL class are:


    CREATE

    This command creates and entirely new table, we specify the attributes of the table along with the entity at this level. we also use the data types for each attribute.

    Syntax:

                                      CREATE TABLE table_name (
                                                  data_1 TYPE,
                                                  data_2 TYPE,
                                                  data_3 TYPE,
                                                            .
                                                            .
                                                            .
                                                            .
                                       ); 

    Example: 


    CREATE TABLE student (sno number(5), sname varchar2(10), course varchar2(5), avg number(5,2));       

    One thing we have to observe here is that Oracle command line is dependent on the ';' used. Unless and until you put a ; all the thing written will be treated as a single statement only!

    ALTER:

    this command alters the things such as column names, types and new columns. we can use two commands in sync with this command, they are:
    • ADD
    • MODIFY
    • DROP

    ADD command adds a new attribute to the table, this can be used to append new columns to the created table.

    MODIFY command can be used to change the data type or the name of the column, in an already created table.

    DROP command can be used to simply drop a column form the table. The data associated with it, will also be deleted.

    syntax


    ALTER TABLE table_name ADD data_1 type1;

    ALTER TABLE table_name MODIFY data_name new_type; 

    ALTER TABLE table_name DROP column_name;

    DROP:

    this command simply drops the entire table, it deletes all the data and associated structures, and the deletion is unchangeable. This means once dropped, we cannot bring back the data. 

    Syntax
    DROP TABLE table_name;

    A Summary of the Data Definition Language commands is given below:



    Transforming Schema into Programming

    Till now we've been discussing the various concepts and qualities of a relational databases. These were the most efficient and most used databases now a days. Now we'll throw some light on the practical database examples.

    In general, a database has a programming environment apart from the traditional File management systems. This was first developed by IBM corporation in the 20th century, and later was adapted by other companies too! This programming language used for creating, manipulating and accessing database is called Structured Query Language (SQL). This was a query type language, this means the commands we give to the database is in the form of a query, a structured command that runs with the database System. 


    The various database systems available in the market are:

    • Oracle
    • My SQL
    • SQL Server
    • DB 2
    • MS access etc.,
    The benefit of SQL is that its a universally accepted language for databases, this means that though the interfaces may change: all the database systems use the same language for the processing. Here our scope of learning is limited to oracle. After the completion of this, we'll move on to another database system: My SQL.

    Coming to the History of Oracle, Its an American Software and Hardware Manufacturer co-Founded by its CEO Lary Ellison in 1977. It operates from California, USA. Its the 3rd Largest Corporation in the world in terms of its revenue. The First released product from it was Oracle 2, in 1979. From then, till now Oracle has been developing products for Database Systems. The Latest Product launched is Oracle 11g. Oracle has also won acquisition of Sun Microsystems in 2010. Now its the official owner of Java!



    In SQL Programming, there are mainly 3 types of Language Commands. These are the major commands used in Creating, manipulating and accessing a database. They are:
    • DDL :    Data Definition Language
    • DML :   Data Manipulation Language
    • DCL :   Data Control Language

    Refining The Database Schema



    Till now we've seen various models, and ways of creating a database. we've primly discussed about  the evolution of the ER Model, and the different types of keys that are seen in a relation. Today we'll see one of the most important step in the construction of a database. If we buy something, don't we check before using it? if we don't i don't say its bad, but the chances of bad quality are not null anyways. Hence in every aspect we check and try to purify things for refining and optimizing its efficiency.

    In the same trend, once we create a relation for a given problematic data, its not directly implemented. Its first checked for some hidden errors that may cause the database to have run time disorders. First of all, we'll have a close look at the errors that might cause the following limitations of database:
    • Delayed Processing of Requests
    • Errors in responses
    • Sometimes database may fail to result in the right response.
    Redundancy is the prime of all the errors that occurs in a database, its simply the occurrence of  duplicates of a data. This may result in many further disorders in the relation.

    There are three main errors that creep into a database, due to bad design of relation. they are:
    • Insert
    • Delete
    • Update
    These errors are called Anomalies, in the database terminology.

    Insert Anomaly occurs, when data cannot be inserted without the presence of other information.

    Delete Anomaly occurs, when deletion of a data causes loss of some other information.

    Update Anomaly occurs, when updating a data needs to be done again and again.

    The method of refining a relation by removing the redundancies that creep into the database, is called Normalization. Here we refine and if needed trim the relation, so that the relation in turn becomes simple and with no anomalies.

    A Relation when satisfies a rule of Normalization is said to be called a Normal Form.

    There are basically 5 Normal Forms, each having a rule to be satisfied to be called so:
    • 1 NF
    • 2 NF
    • 3 NF
    • BCNF
    • 4 NF
    1st Normal Form: The Relation should have a single value in each cell, multiple values should be removed or made into new rows.

    2nd Normal Form: The Relation should be made free of Functional Dependency, there by causing the anomalies to be flushed off.

    3rd Normal Form: The Relation should be freed of Partial and Transitive Dependencies.

    3.5th Normal Form or Boyce- Codd Normal Form (BCNF)

    A Relation is in BCNF iff an FD X->A is such that: 

    • A belongs to X and 
    • X is a Super Key
    4th Normal Form: The relation should not contain multi valued dependencies.

    We'll have a close look at each of the Normal Forms in the next Posts....

    The ER Model



    In our previous sessions, we've been some what brief to the relational database models. Toady, we'll have an in detail examination of what is what. Basically, in R DBMS everything that is data before is now a relation. Hence, a relational database consists of relation aka tables which have rows and columns.

    • Rows are called Tuples.
    • Columns are called attributes.
    • Number of rows in a table constitute the cardinality.
    • Number of columns in a table constitute the arity.
    • The intersection of a row and a column is called a cell.
    Hence, we work entirely on the cells, at each tuple of an attribute. the relational database was constructed based on a theory called the ER model. The ER model describes how a relation can be established, given a problem. The entities are the things that are under our examination. here we can assume an entity to be a table. An attribute describes the entity well. hence it is a description of the entity. we can assume this attribute to the columns of our table. A Relation is the thing that relates two entities: an intersection of two entities. We try to work out the model in our construction of a table. The model uses a diagrammatic approach for different cases of entities and attributes, and for a relation. The main elements of ER model are:

    • Entity
    • Attribute
    • Relation
    Entity is represented by a rectangular box, an attribute by an ellipse and relationship is done by a Rhombus. A small example of ER model is discussed below:

    Problem: a Student Joins in a College

    Model:

    There are principally 3 types of relationships, by their nature. They are:

    • One-to-One
    • One-to-Many/ Many-to-One
    • Many-to-Many
    One to One relationship involves two entity relationship, One to Many involves more relations while many to many involves even more relations.

    The Above problem can be modified to all the types like:

    a Student Joins in a College (1-1)




    many Students Join a College (m-1)



    many Students Join many Colleges (m-m)




    Another important element in the construction of a database, is the selection of the keys. A key is an attribute of a relation that uniquely identifies each tuple. For example if we take all the students information in a relation, then obviously student roll number or his admission number or his registration number will be unique of each student. hence they are all alternatives for the key.

    One such attribute selected is called a Primary Key. If two relation have a common key that uniquely identifies its Tuples, is called a foreign key. This is similar to a Parent-Child relationship in class and objects concept: inheritance. If two or more keys are combined in case of forming a single key for a table, its called  a composite key. Hence there are:

    • Primary Key
    • Foreign Key
    • Composite Key
    • Candidate Key
    in a table. The ER model of a relation is mapped in order to construct a database table. Hence we involve the following steps in the construction of a database:

    • Referring the Problem
    • Identifying the Entities, attributes and Relations
    • Framing a model for the problem
    • Mapping the model for our database table.

    Relational Database Management Systems


    We've seen one of the factors that throw a great impact on the efficiency of data and types of database management schemes present in the development and manipulation of an efficient database. One thing must be clear for you by this time that a database is simply a powerful storage than a Hard Disk, made so because of the management we have for it. DBMS is the software version of such management/ governing scheme. There are Some goals that an efficient DBMS must aim at:
    • Creation of a Database
    • Efficient Handling of manipulations like add, modify or delete on the data
    • Employ constraints for Database Security
    Hence our DBMS must somehow satisfy these needs to have an efficient handling of data. One thing is that how much large the data may be, it must be stored such that the operations must be responded very quickly. For Example let us consider a reservation database, that handles the seats in a vehicle, a Bus say. If our database is so slow that each query takes considerable time in responding, passengers will sure have to struggle a lot. Because since the tickets are such a data which can't be shared, if a ticket is issued to two people, then we'll have a fight!!!

     Relational database solves such problems by employing table constructs on the data construction. The rows are all entirely data, and columns map to the owners or the identifier variables. The cell is an intersection of a row and a column. For example in the above figure, tutorial_id, title, company are the variables which hold the values below in the respective columns. In RDBMS, the table is a relation, a row and a column being the values of the relation. Here we need to know about two things about the entries in the table, they are 
    • Entity
    • Attribute
    An Entity is the item being described in the table, and attribute being the values. Hence a table consists of Entities and attributes for the entities. A Relational Database is represented in the form of a relation between the attributes, the tables we generally speak about will be of the form

    D(d1,d2,d3,.......dn) where d1, d2,... are all attributes which hold the column values.

    Edgar F. Codd was the man behind the origin of a Relational Database Management Systems. He defined a relation as a one that satisfies 12 rules to be called so. We'll pause our discussion at this point and we'll discuss them in their full view next time...

    Effect of Physical Media on Database Performance



    In our previous discussions, we've seen things such as some typical fields of applications and Driving Force behind databases. You Can refer them Here.

    Driving back to our King, like all other things we have some factors that influence the efficient utilization of a database. We'd now look at one of them: the Physical medium of Communication between the Database and the user. User can basically need to connect to a database before getting served by it. This connection can be in two ways materially, One is a Physical Link, and the other is a Virtual link.

    A Physical Link is one connection that is visible and can be accessed physically  What i'm trying to say is that physical links are generally wired media. Our cables, are the best examples for it. 

    A Virtual Link is one link that can't be viewed, its a software type. For example consider a Bluetooth connection between two devices, can we see the connection between them? We can't view them, but in the devices, the transfer can be witnessed. This is what, the most easy technique but at the same time, can't be wholly reliable. This is because that, the packets of data we share can't be traced once they are sent out of the device. Since the entire transmission is a medium independent, there's no scope for reliability. All we can see here is Hardware simplicity and fast access. WLAN, Bluetooth, etc., work on this technique. On the counter side, Ethernet is one best example of a wired type communication.

    Actually, this topic needs more clarification because there are many related concepts of Data Communications with the discussed one above. I've related them to our discussion though they're not of great importance, because that we're here thinking about factors and the efficiency of a database depends on these links since these vary with the data rates.

    Lets get back to our discussion, a Database is generally a collection of logically related data. The data are stored in database in the form of rows and columns of a table. Hence, a Database typically contains tables. The data are retrieved and manipulated based on these tables. 

    Database management means use of tools in creating a database and maintaining it. There are two main ways in database management, the first one is the traditional management system. its called Files Management System, that uses programmatic way in creating and manipulating tables. Examples are the Files in C, C++ etc. but this is less user friendly and has its limitations too!

    Hence we move on to an advanced method called Database Management Systems (DBMS). This uses the so discussed, Table format for a database management. This is widely used nowadays. In the DBMS, there are two more approaches, or the sub classes for it. They are the Relational DBMS and Object Oriented Databases.



    DBMS:-
    •  RDBMS
    • OODBMS or ODBMS 
    Relational Database is one which has a relation between the values of the table. The table is itself treated as a relation and we apply our relational mathematics on it. Object Oriented approach of the RDBMS is the next type called ODBMS. We'll have a detail account of these things and also beginning of the syntactical approach in our next discussion.

    Database Systems










    Previous Class: Here

    I hope that you might have well understood the need of a database in present day applications.
    we'll have a brief discussion on the applications of  database in various fields. Then we'll throw 
    some flash on the underlying software that handles the king: Database.

    1. As we've assumed previously, the main aim of database is to provide data sharing among several users. The aim of database has extended to such a manner that its now providing data sharing at a remote level. For example we know that we all access our mail accounts, send and receive mails. But we would wonder that these mails are not stored in our computer. right? We can access them anywhere and anytime, irrespective of the device we use: we can have the same mails accessed through our desktops and even from our mobiles. I'm just talking about the data we access, not how its being accessed. This example might confuse you a little bit because, database is generally a software driven Hardware. So we should talk about the software while mentioning the hardware too!

    Well we'll leave the other things out of our scope here, such as the way in which we access them: data communications. here actually each person or the owner of mail has his mailbox or more naively, his very own virtual postbox in the database located somewhere else in this world. He'd log on to his account through some client address, and then checks his mails. Here the Database acts merely as a combo of a Huge Post Office and Post Box.

    2. Internet, is all we're using somehow in our work. Even you are reading my bundles of notes through your internet right? but the internet is just a software: its a network. The driving force of Storage behind internet is the large use of Database Servers. A Server is a software and database is a storage. Together they provide the functionality of inter networking. The things you see on an internet are all simply web scripts: pages, bundles and bundles written in some language other than English :) These web pages are stored in the dedicated databases which are accessed remotely by the client systems when need some page to load. The browser acts as a dish in which your potato fry: i mean the pages are served by the server: in my sense database....
    Just don't mingle Server and database here, we'll see that some other time.

    3. Cloud, is the next level of database computing, in which the database is remotely accessed and offers several advantages like Single application being run on many systems etc.,

    Now that you are aware of the application aspects of a database. if still the thing's not clear, just have a search on this thing. because applications include reservation systems, and many other online services, I've classified them in another form: the way in which a database functions.

    Now we'll return to our concept of Database Systems. A System is generally a physical entity. But in this context we'll imagine this to be a Driving force. A Database is simply a Jumbo size storage disk for a Computer. But the thing's that even though we own a car for us, what's the driving force for it? Just don't say simply fuel, its the car keys!

    In the same way, a Database needs a key to control it: a software that governs the functionality of the database. I just don't want to confuse and prolong it anymore, in the straight way, its the database system. Its a software installed to provide the functionality of a database. To be a successful thing, you must put some effort in your efficiency. In the same way, in order to build a successful database, we should concentrate on building an efficient software. 



    We'll pause our story of King DB here, and next time we'll see DB System in detail and have a brief introdution of DBMS.

    Introduction to Databases




    Hello folks!

    I'm sure its pretty well known to you that with the immense increase of technology and rapid growth in the utilization of services, the amount of data being produced has been terribly increasing. Its obvious that we need to save data after we are done working with it. this in the case of a single user. But in our scenario of data sharing between users: accessing of data by more that one individual is a bit to be thought. if the same situation occurs in an office where a single file has to be accessed by several users of several different systems, how can we satisfy their wish? we can't pull out the disk every time and pass it among them right! Or you may think to use removable storage in such cases, but what would you do when the data to be multiply accessed by people is terribly large? For example let us assume that all the files of a branch office has to be accessed by multiple users. How can that be satisfied with removable storage devices? Hence the expectations and the need broadens and the need for a stable storage that can satisfy our wish here arises. This Stable Storage is what we call as Database...

    A Database is generally a Huge dump of data: a Collective Noun for Data we can say ( I'm not sure about Grammar here). This Huge dump of Data is present in some protected corner of the place and is wired to all other systems. These Systems connected to this Highest Degree Storage pass the wishes if the users to their master: the Database. The master in turn listens to their wishes and tries to quench their thirst: here data i mean. The wish sent by the user or issued b ya system is called a Request. The satisfaction provided by the King is called the Response. Hence accessing a Database involves series of Requests and Responses.

    the accessing of database will be very frequent, so as the requests to the database. But the king can't delay and postpone these pleas, so as the judges do: every second counts. Hence a database must be maintained very efficiently so that it can process such requests very fast and save time. The schemes we apply on the database effects its performance. One such scheme is the type of structure we impose on the data to be stored in the database. I mean here, that the data structures we use in the database. Generally the databases are indexed and hashed to improve the efficiency of search and retrieval. Other Data Structures might also be used, we'll see that later.

    Databases need not only Data structures to store and manipulate the data, they also need some mechanisms to preserve its stability while responding to several requests at a time. Here we get the name of a manager who looks after this duty. He's our DBMS...

                                                                        Data Base Management Systems

    He looks after the stability of the database, and impose security and protection constraints to serve multiple usages.

    I'll pause our discussion here....

    we'll see the methods in which a database can maintain stability and how the database management provides this. Also we'll have a detail account on the structure of a database.

    Saturday, 8 June 2013

    JNTU Kakinada B tech R10 4-1 CSE Subjects for the Semester


    The following are the Subjects for the 4-1 Semester, CSE, JNTU Kakinada, Syllabus will be updated soon...

    Subjects:
    1. Cryptography and Network Security
    2. UML and Design Patterns
    3. Data Ware Housing and Data Mining
    4. Mobile Computing
    5. Open Elective:
      1. MAT LAB (Except CSE, IT, ECE, EEE)
      2. Web Services (except CSE, IT)
      3. Open Source Software
      4. Cyber Laws
    6. Elective I:
      1. Computer Forensics
      2. Cloud Computing
      3. Software Project Management
      4. Machine Learning
      5. Distributed Databases
    7. UML & Design Patterns Lab
    8. Mobile Application Development Lab
    The Subjects carry 4 credits each (Including the Electives) and the Labs carry 2 credits each...

    Good Luck!

    Monday, 18 March 2013

    Java Data Base Connectivity (JDBC)

    Java provides the connectivity of the user's program to a database, using a set of programming Interfaces, API called JDBC. JDBC is an acronym of Java Data Base Connectivity, using which we can connect and manipulate data on a database. The support for JDBC has begun from Java Standard Edition JSE 1.1 Since the motto of Java is to provide platform independent usability, JDBC too aims at the Database vendor Independence of the programming. 

    To get connected to any database, it is general to use a driver, which is specific for a vendor. Java Data Base Connectivity provides four types of Drivers, popularly called JDBC Drivers for connectivity. they are:

    Type 1: JDBC-ODBC Driver---

    This is used for small scale database connectivity  which makes use of a JDBC-ODBC bridge driver to get connected to the database. The client system must contain an installed ODBC driver for this purpose, which is done in the following steps.

    1. Open Control Panel
    2. Open Administrative Tools (present in the Category View)
    3. Open Data sources (ODBC)
    4. Click the Tab User Dsn and click Add
    5. Look for "Microsoft ODBC for Oracle" and the give the Name
    6. Click OK and you are done!

    Type 2: Native API partly Java Technology Enabled Driver--

    This type of driver converts JDBC calls into calls on the client API for Oracle, Sybase, Informix, DB2, or other DBMS. Note that, like the bridge driver, this style of driver requires that some binary code be loaded on each client machine. 

    Type 3: Pure Java Drive for Data Base Middle ware--


    This style of driver translates JDBC calls into the middle ware vendor's protocol, which is then translated to a DBMS protocol by a middle ware server. The middle ware provides connectivity to many different databases.

    Type 4: Java to Database Pure Java Driver---

    This is also called a light weight driver, this can be used to directly connect a client side system to a remote server system. a light weight driver and can be used free of cost. This style of driver converts JDBC calls into the network protocol used directly by DBMS allowing a direct call from the client machine to the DBMS server and providing a practical solution for intranet access. 


    The interfaces and classes in the JDBC are in the java.sql package.





    Out of all the interfaces present in the package we mostly come across three major interfaces, 
    • Connection
    • Statement
    • ResultSet
    Connection : java.sql.Connection, this interface is used to establish a connection to a database.

    Statement: java.sql.Satement, this interface is used to write the sql statements in through the java programming language. and get them executed.

    ResultSet: java.sql.ResultSet, this interface is used to store the resultant rows, it acts like a buffer that can be retrieved row wise.


    Let me Demonstrate with the following Example----

    import java.sql.*;                    //To use the interfaces and classes of JDBC we use this statement

    public class DataBaseDemo{
        
                public static void main(String[] args)throws Exception{
                   
                         Connection con=null;
                 Statement st=null;               //The variables of the types are initially assigned to null
                 ResultSet rs=null;

                         try{

    // The interfaces raise an exception SQLException, for which we use try-catch block to handle them.
                                       
                           Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                                 // This statement calls the type of driver to be used.
           
                           con= DriverManager.getConnection("jdbc:odbc:dsn","scott","tiger");
                                // Here we get the connection to the database using the JDBC-ODBC driver
           
                           st = con.createStatement();          
                                // An environment for sql statements is created.
                           
                           rs = st.executeQuery("SELECT * FROM student");
                                // Here the method executes the Query, select * from student and returns the rows to the Resultset variable, rs which acts like an implicit cursor to work with.

                           while(rs.next()){
                                    System.out.print(rs.getInt(1)+"\t"+rs.getString(2)+"\t"+rs.getString(3));
                    // here the individual columns are represented by the getter methods for the respective data types.
                            }
                 
                    }


                   catch(SQLException e){
                         System.out.print(e.getMessage());
                   }
                   finally{
                                 rs.close();
                                 st.close();
                                 con.close();
                   }
       }

    }