Friday, 25 December 2015

JDBC Driver

  1. JDBC Driver:

    JDBC Driver is a software component that enables java application to interact with the database.JDBC drivers implement the defined interfaces in the JDBC API, for interacting with your database server.
    There are 4 types of JDBC drivers: 
    •  JDBC-ODBC Bridge Driver

    •  JDBC-Native API(partial java driver)

    •  Network protocol Driver(pure java driver)

    • Thin driver  ( Pure Java driver)

       1.1 JDBC-ODBC Bridge Driver:

      In a Type 1 driver, a JDBC bridge is used to access ODBC drivers installed on each client machine. Using ODBC, requires configuring on your system a Data Source Name (DSN) that represents the target database.
    bridge driver
    When Java first came out, this was a useful driver because most databases only supported ODBC access but now this type of driver is recommended only for experimental use or when no other alternative is available.

    Advantages:
  • Easy to use.
  • can be easily connected to any database.

          Disadvantages:
  • Performance degraded because JDBC method call is converted into the ODBC function calls.
  • The ODBC driver needs to be installed on the client machine.

1.2 Native-API driver:

  • In a Type 2 driver, JDBC API calls are converted into native C/C++ API calls, which are         unique to the database. 
  • These drivers are typically provided by the database vendors and used in the same manner as the JDBC-ODBC Bridge.
  •  The vendor-specific driver must be installed on each client machine.
  • If we change the Database, we have to change the native API, as it is specific to a database and they are mostly obsolete now, but you may realize some speed increase with a Type 2 driver, because it eliminates ODBC's overhead. 
  • The Oracle Call Interface (OCI) driver is an example of a Type 2 driver

 Native-API driver 
Advantage:
  • performance upgraded than JDBC-ODBC bridge driver.
Disadvantage:
  • The Native driver needs to be installed on the each client machine.
  • The Vendor client library needs to be installed on client machine.

1.3 Network Protocol driver:

  • In a Type 3 driver, a three-tier approach is used to access databases. The JDBC clients use standard network sockets to communicate with a middleware application server. 
  • The socket information is then translated by the middleware application server into the call format required by the DBMS, and forwarded to the database server.
  • This kind of driver is extremely flexible, since it requires no code installed on the client and a single driver can actually provide access to multiple databases.
Network Protocol driver 
You can think of the application server as a JDBC "proxy," meaning that it makes calls for the client application. As a result, you need some knowledge of the application server's configuration in order to effectively use this driver type.
Your application server might use a Type 1, 2, or 4 driver to communicate with the database, understanding the nuances will prove helpful.
Advantage:

  • No client side library is required because of application server that can perform many tasks like auditing, load balancing, logging etc.

Disadvantages:

  • Network support is required on client machine.
  • Requires database-specific coding to be done in the middle tier.
  • Maintenance of Network Protocol driver becomes costly because it requires database-specific coding to be done in the middle tier.

 1.4 Thin driver:

  • In a Type 4 driver, a pure Java-based driver communicates directly with the vendor's database through socket connection. 
  • This is the highest performance driver available for the database and is usually provided by the vendor itself.
  • This kind of driver is extremely flexible, you don't need to install special software on the client or server. Further, these drivers can be downloaded dynamically.
Thin driver 
MySQL's Connector/J driver is a Type 4 driver. Because of the proprietary nature of their network protocols, database vendors usually supply type 4 drivers.
Advantage:

  • Better performance than all other drivers.
  • No software is required at client side or server side.

Disadvantage:

  • Drivers depends on the Database.
BEST DRIVER:
  • If you are accessing one type of database, such as Oracle, Sybase, or IBM, the preferred driver type is 4.
  • If your Java application is accessing multiple types of databases at the same time, type 3 is the preferred driver.
  • Type 2 drivers are useful in situations, where a type 3 or type 4 driver is not available yet for your database.
  • The type 1 driver is not considered a deployment-level driver, and is typically used for development and testing purposes only.


Steps to connect to the database in Java

There are 5 steps to connect any java application with the database in java using JDBC. They are as follows:
  • Register the driver class
  • Creating connection
  • Creating statement
  • Executing queries
  • Closing connection

2.1 Register the driver class:

Class.forName() is used to load the driver class explicitly.

Example to register the OracleDriver class:

Class.forName("oracle.jdbc.driver.OracleDriver");  

Example to register with JDBC-ODBC Driver:


Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); 

2.2 Create the connection object:

getConnection() method of DriverManager class is used to create a connection. 

Syntax:
getConnection(String url)
getConnection(String url, String username, String password)
getConnection(String url, Properties info)
Example establish connection with Oracle Driver:


Connection con = DriverManager.getConnection
                    ("jdbc:oracle:thin:@localhost:1521:XE","username","password");

 Example establish connection with JDBC-ODBC Driver:

 Connection con = DriverManager.getConnection("jdbc:odbc:TOY2","root","root");

 2.3 Create the Statement object: 

The createStatement() method of Connection interface is used to create statement. The object of statement is responsible to execute queries with the database. 

Syntax:


public Statement createStatement() throws SQLException

Example to create a SQL statement:
Statement s=con.createStatement();
 

2.4 Execute the query:


The executeQuery() method of Statement interface is used to execute queries to the database. This method returns the object of ResultSet that can be used to get all the records of a table.

Syntax :

public ResultSet executeQuery(String sql)throws SQLException  
 
Example to execute query:

ResultSet rs=stmt.executeQuery("select * from emp");     
while(rs.next())
{   
System.out.println(rs.getInt(1)+" "+rs.getString(2));   
}  

2.5 Close the connection object:


By closing connection object statement and ResultSet will be closed automatically. The close() method of Connection interface is used to close the connection.

Syntax:

public void close()throws SQLException  
 
Example to close connection:

con.close(); 

How to Delete your old or unused Website Accounts(Gmail,yahoo,youtube,skype,Flikr,Linkedin,etc.,)

Now a days internet is Essential to every persons.so for using internet and downloading some files  we had create an account  on different web sites,but some times we wish to remove or delete that account.For Example:when we don't want to use that particular website,when we got more mails and ads form that particular website,when we want to create an new account. so like that in so many situations  we wish to delete our unused accounts.but  deleting an account is differ on different websites.so justdelete.me website guides how to delete different website accounts using our E-mails.in that site they listed the lot of websites like google,yahoo,skype etc.,
 

 This site also shows us to  deleting a particular website account is easy ,hard,or impossible.


and some of the websites ask us to create an account   after create an account only we enter into particular sites for that  here(justdelete.me) You can create an Temporary accounts with temporary username&password Through Fake Identity Generator.

Go to that site Click Here

Java JDBC Tutorial

--------------------------------------------------------------------------------------------------------------
  • Java JDBC is a java API(Application programming interface) to connect and execute query with the database. JDBC API uses jdbc drivers to connect with the database.
  • Before JDBC, ODBC API was the database API to connect and execute query with the database. 
  • But, ODBC API uses ODBC driver which is written in C language (i.e. platform dependent and unsecured). 
  • That is why Java has defined its own API (JDBC API) that uses JDBC drivers (written in Java language). 
  1. JDBC Driver
  2. Steps to connect to the Database 
  3. Connecting to Access Database using JDBC-ODBC Bridge Driver 



Wednesday, 23 December 2015

TANCET 2016

TANCET 2016

Anna University is going to conduct the exam as Tamil Nadu Common Entrance Test 2016. The exam is conducted for the candidates to get the admission in various PG courses offered by Anna University. The interested candidates can apply for this application form to get admission in various PG programmes as M.E / MBA /MCA / M.Arch. The candidates have to submit the form as soon as possible. The last date of the admission form is April 2016.   
Courses Offered:
  • Master of Business Administration (M.B.A)
  • Master of Computer Applications (M.C.A)
  • Master of Engineering (M.E) / Master of Technology (M.Tech) / Master of Architecture (M.Arch) / Master of Planning (M.Plan)
Eligibility Criteria:
For M.B.A: 
Candidate should be passed Bachelor’s degree of minimum 3 years duration and general category contenders obtained at least 50 % marks and candidates belonging to reserved category should have obtained 45% marks in qualifying degree examination.
For M.C.A: 
Aspirants should have cleared Bachelor’s degree of minimum 3 years duration with mathematics at 10+2 level or at Graduate level and obtained at least 50 % (45% in case of candidates belonging to reserved category) in qualifying examination.
For M.E./M.Tech./M.Arch./M.Plan Degree programmes: 
Contenders should possess Bachelor’s degree from recognized university or its equivalent in relevant field with at least 50 % marks in given examination.
Application Fee:
Candidates have to submit Rs.500/- as application fee in form of demand draft drawn in favour of “The Secretary, TANCET, Anna University, Chennai “ and payable at Chennai.
Application fee for SC/SCA/ST candidates belonging to Tamil Nadu are required to pay Rs.250/-
Candidate applying for more than one programme has to pay requisite amount for each additional programme.
Selection Process:
Selection will be done on the basis of candidate’s performance in written test and after that qualified aspirants will be called for Counselling.
Process to apply:
Candidates must visit to the official website of TANCET
After that open the home page and select the career link
Then fill the details of the form and
And take the print of the form and send to the address given below
Postal Address:
The Secretary, TANCET
Centre for Entrance Examinations
Anna University
Chennai – 600 025
Important dates:
Exam Events
Important Dates
Commencement of Registration in Person / Internet
April, 2016
Last Date for Registration through Internet
April, 2016
Receipt of Applications Registered through Internet
April, 2016
Last date for Registration at Co-coordinating Centers
April, 2016
Last date for Spot Registration at Chennai centre
April, 2016
TANCET 2016 Exam Dates
May, 2016
Result
June, 2016

Thursday, 20 November 2014

Method Overloading

What is Method overloading?
                                    A class is have two or more methods having same name,but their argument lists are different(Number of Parameters,data type of paraameters,Sequence of Data type of parameters) it is called method overloading.
It is also known as Static Polymorphism.
Advantages: It increases the readability of the program
--------------------------------------------------------------
Example 1: Different number of parameters in the argument list
class calc
{
void add(int a,int b)
{
System.out.pritnln(a+b);
}
void add(int a,int b,int c)
{
System.out.pritnln(a+b+c);
}
public static void main(String args[])
{
calc obj1=new calc();
obj1.add(10,20,30);
obj1.add(10,20);
}
}
OUTPUT:60
             30
--------------------------------------------------------------
Example 2: Difference in data type of argument 
class calc
{
void add(int a,int b)
{
System.out.pritnln(a+b);
}
void add(float a,float b )
{
System.out.pritnln(a+b);
}
public static void main(String args[])
{
calc obj1=new calc();
obj1.add(10.5,10.5)
obj1.add(10,20);
}
}
OUTPUT:21
             30
--------------------------------------------------------------






Wednesday, 19 November 2014

OOPS CONCEPTS IN JAVA




1.Method overloading  2. Method overriding  3. Exception handling 
4. Method overloading vs Overriding   5. Constructors 6. Constructor overloading
7. private constructor 8. Constructors in interfaces 9. Constructor chaining
10. Aggregation 11. Association 12. OOPs basics
13. Polymorphism in java   14. Types of polymorphism 15. Inheritance
16. Types of inheritance 17. Hybrid inheritance 18. Hierarchical inheritance
19. Multilevel inheritance 20. Multiple inheritance 21. Encapsulation
22. Static and dynamic binding in java 23. Static class 24. Static methods
25. Static variables 26. Static import 27. Static constructor
28. Inner classes 29. Abstract class and methods 30. Interfaces in java
31. Abstract class vs interface 32. Access modifiers 33. Packages in java
34. Final Keyword 35. Super keyword

HOW TO STOP WINDOWS 10 AUTO UPDATE