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();
               }
   }

}                       
     









Sunday, 3 February 2013

My Windows 8 Review

Many years after the release of Windows 7, when a new version was announced, It created much curiosity in the market because 7 was a good combination of beauty and performance. Although it too had some flaws i it, the new version might have something to remove it. After surfing for details regarding it, I've go to know many things about it. Windows 8 was under its development even before windows 7 was launched! the existence of the same was revealed in CES 2011, and then a user preview version of it was released. it then raised the hopes among the users with its much enhanced user interface and support for touch interface. Windows 8 was released for three forms of computing: tablets, Laptops and Desktops. Also a mobile version of it for use in windows phones called Windows RT: that finds compatibility for smart phones with ARM architecture was also released. Now we have all together four forms of Windows Operation System for computation in the market.


Windows Phone 7.5 was another form of Windows' new Operating System optimized for smartphones. Nokia Lumia was one among many companies to adopt this Operating System, to their hardware.

Lets Explore the Desktop:

Windows 8 has is an operating system  that mostly works with the help of internet: i'm not saying you can't work without internet, but its true that most of the programs: apps cannot work without internet connection. So for enjoying the features, go get a internet connection. You need a Windows Live account or mostly a Hotmail account to work with windows 8.

Requirements for Desktop:

Processor: 1 gigahertz (GHz) or faster with support for PAE, NX, and SSE2 (more info)

RAM: 1 gigabyte (GB) (32-bit) or 2 GB (64-bit)

Hard disk space: 16 GB (32-bit) or 20 GB (64-bit)

Graphics card: Microsoft DirectX 9 graphics device with WDDM driver

There's no thing called log in and log out with your username, you can log in with your live mail id, like with your username. All the programs you have in windows 8 actually have to called as apps. Because they look and feel are much like apps than programs. There are some apps that create interest in the users:




As I have mentioned earlier, you need to possess a live account for you, or most likely a Hotmail account so that you can enjoy the features of this OS. All the apps in windows 8 need a Microsoft account to get worked.






The start menu in windows 8 is the main attraction: its much enhanced, elaborated and is dynamic! the colors and background can be changed, the boxes represent the thumbnails of the applications present in the computer. its similar to the start menus of win 7 or XP, but its much stylish than them!                                   

The Messages app in the start menu, is interesting as a dedicated chatting app for windows. It supports windows live accounts and Facebook accounts. So you never need to look after a new Facebook messenger for you!

The Video app in the start menu, is a dedicated movie/ video player for windows, other than WMP. It supports mp4, mkv etc., formats but doesn't have support for 3gp videos. Also the plyer displays a list of xbox videos, that can be streamed.

Windows 8 also has a Weather ap powered by Bing. This can show you the current weather conditions in your place. But this too needs a Microsoft account to access.

The sports app, gives you the sports news and matches and lots more! a complete app dedicated for sports.

Music app, is a music player for windows 8, that provides a beautiful play of all the music files on your computer. 

The photos app helps to view all the photos located on your computer. but the photos that are present in the pictures library are only displayed. 

The people app, is like a social network app that gives a summary of the feeds of social networking sites like Facebook  twitter, linked in etc., its a great app, with the options of notifications, chat and wall feeds.

Tip: I've come to know that if we want to take a screen shot, just press windows key + Prt Scr


Tuesday, 29 January 2013

Thursday, 24 January 2013

World's Leading Automobile Manufacturers and Their Homes


Manufacturers and their Headquarters/Homes:

Toyota---- 


Home/HQ: Toyota City, Aichi, Japan


General Motors---


Home/HQ: Detroit, USA


Volkswagen---


Home/HQ: Wolfsburg, Germany


Hyundai---


Home/HQ: Seoul, South Korea


Ford---


Home/HQ: Dearborn, USA


Nissan---


Home/HQ: Nishi-ku, Yokohama, Japan


Honda---


Home/HQ: Kikuchi-gun, kumamoto, Japan



PSA Peugeot Citroen---


Home/HQ: Paris, France



Suzuki--- 



Home/HQ:Japan


Renault---


Home/HQ: Boulogne-Billancourt, France


Fiat---


Home/HQ: Turin, Italy


Daimler AG---

Benz is a product of Daimler AG

Home/HQ: Stuttgart, Baden-Württemberg, Germany



BMW---


Home/HQ: Munich, Germany


Ferrari---


Home/HQ: Modena, Italy


These were some of the top Car manufacturers in the World, as described by most of the automobile critics, based on their production and market. But have you observed anything from their homes??? Let me share my inferences


My Inference


out of 14:-


4 are from Japan,

3 from Germany,

2 from USA,

2 from Italy,

2 from France,

1 from South Korea...

That's why we call Japan, an Automobile Giant!

Monday, 24 December 2012

General Keyboard Shortcuts used in Windows XP

Its obvious that the most used peripheral device connected to the computer is mouse, after the Monitor: when talking about a basic user. Considering myself as an instance of a basic level user, I can't do anything without using a mouse. Even I've been using mouse more than keyboard in typing this post. But, moved by the question that: 'Why can't we use only keyboard in place of a mouse?' I've searched and found something interesting. Microsoft has designed some shortcuts for the functionality that can be done with a keyboard only. They have categorized them into several aspects, I've replicated some of them: the most general functions we do everyday, with a mouse. I've categorized them based on the key we use in the operation. I see some keys that are basically built for specific functionality. They are the 12 Function keys (F1-F12), Shift, Control (Ctrl), Alternate (Alt).


Control (Ctrl) Family:- 



The set of keys that come under this are, mainly file operations and some special functions. 



Ctrl+C : Copy
Ctrl+X : Delete selected item and save a copy to the clipboard
Ctrl+V           : Paste
Ctrl+Z           : Undo
Ctrl while : dragging an item (Copy the selected item)
Ctrl+Shift : while dragging an item (Create a shortcut to the selected item)
Ctrl+Right Arrow  : Move the cursor to the beginning of the next word
Ctrl+Left Arrow    : Move the cursor to the beginning of the previous word
Ctrl+Down Arrow  : Move the cursor to the beginning of the next paragraph 
Ctrl+Up Arrow : Move the cursor to the beginning of the previous paragraph
Ctrl+F4 : Close the active document in programs that enable multiple documents to be open at the same time
Ctrl+Shift with any arrow key : Highlight a block of text
Ctrl+A : Select all
Ctrl+Shift+Esc : Open Task Manager
Ctrl+Esc : Display the Start menu



Alternate (Alt) Family:-



The main function of the Alt key is to swap between processes, tasks etc., the keys in this are:


Alt+Enter         : View the properties for the selected item
Alt+F4         : Close the active item, or exit the active program 
Alt+Enter         : Display the properties of the selected object 
Alt+ Space-bar  : Open the shortcut menu for the active window
Alt+Tab                 : Switch between the open items
Alt+Esc                 : Cycle through items in the order in which they were opened
Alt+ Space-bar  : Display the System menu for the active window
Alt+Underlined letter in a menu name : Display the corresponding menu


Shift Family:-



Shift as the name indicates, shifts the control from one process or task to another, the keys in this:


Shift+F10 : Display the shortcut menu for the selected item
Shift+Delete : Delete the selected item permanently without moving the item to the Recycle Bin
Shift with any arrow key : Select more than one item in a window or on the desktop, or select text in a document
Shift when you insert a CD into the CD drive : Prevent the CD from automatically playing


Function Keys:-



There are 12 function keys exactly placed at the top of the keyboard, right in the first row:


F2 key : Rename the selected item
F3 key : Search for a file or a folder
F4 key : Display the Address bar list in My Computer or in Windows Explorer
F5 key : Update the active window (Refresh)
F6 key : Cycle through the screen elements in a window or on the desktop
F10 key : Activate the menu bar in the active program


Other Key Commands:-



There are other combinations, that provide several specific functionality. they are:


Underlined letter in a command name on an open menu : Perform the corresponding command
Right Arrow : Open the next menu to the right, or open a sub menu
Left Arrow   : Open the next menu to the left, or close a sub menu
Backspace : View the folder one level up in My Computer or Windows Explorer
Esc : Cancel the current task
Delete   : Delete








Tuesday, 4 December 2012

BSNL Recruitment Notification for DGMs


Good news for BE/B Tech pass outs, BSNL announces recruitment for 106 posts of DGMs technical and 56 DGMs in finance. The particulars are as follows :-

BE/B Tech pass outs, with minimum percentage of 60% in the branches of ECE, EEE, IT, CS  The DGM  finance will be for CA/ICWA/CS. The pay scale will be between 32,000-58,000 with all the additional allowances like DA, TA, HRA etc. The last date of application is 7.11.2012 and the examination is through online on 30.01.2013 in four cities Delhi, Kolkata, Mumbai, Chennai. 

further details can be seen here:

                               view pdf

Wednesday, 14 November 2012

Children's Day: A Wake up Call

We Celebrate this day, as a token of  appreciation for children. Though the dates change with the places, all the nations pledge for a better future for their children. A child has no selfishness, jealous or any other like the people are. Children are pure as water and sweet and are noble in their thoughts and feelings.



"when I used to get to my brother at his 5,I used to make him cry for no reason being myself angry for nothing. But as soon as i'm upset he used to console me, tried to make laugh and finally when my anger's gone he used to feel happy."- says a friend of mine, remembering the cute things of his brother who's 15 now.

I'm telling this all to convey only one message- Children are the direct descendants of God, they are so Noble that they try to make us happy, for us its worth nothing-but for them, its their own way of happiness.

India celebrates its Children's Day on 14th of November every year, as a remembrance of our first Prime Minister and a National Freedom Leader Pandit Jawaharlal Nehru. He was himself fond of this childish charisma, that he used to be called as "Chacha" (Uncle) to denote him, as a lovable person of children. He use to feel that Children are the bright future of India.



Children play with joy on this day in schools, with many cultural programs and activities for them and played by them. This day is truly a day for them, for the noble and kind heart they have and the love they shower on us.

But, the fact is that children are loosing their beautiful childhood. no one is nowadays happy, everyone's feeling this burden by the education methods and the blind marks we shun them for. but this is all in people of better economic classes. but what about the poor and the poorest among them? children are being forced to work and refrain from studies. they're not only loosing their childhood. they're loosing their future. Nehru's dream is not child labour and encouraging India. He dreamt fo a nation with children being free to study and choose their future.

Let this Children's Day be the initiative for a better Society for Children- 

For A Better Nation