Tuesday, July 24, 2012

creating database table by using jdbc


//Table creation
import java.sql.*;
import java.io.*;

public class JdbcDemo
{
            public static void main(String args[]) throws Exception
            {
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");//Type1
            Connection con=DriverManager.getConnection("jdbc:odbc:das","scott","tiger");
            Statement st=con.createStatement();
            int i=st.executeUpdate("create table employee4(eno number(10),ename varchar2(50), esal
             number(10))");
            System.out.println(i);
                        if(i==-1)
                        {
                                    System.out.println("Table created");
                        }
                        else
                        {
                                    System.out.println("Table not created.");
                        }
                        st.close();
                        con.close();
            }
}

Saturday, July 21, 2012

Why java is suitable for internet?

Java is suitable for internet because of two main reasons.

  1. It is system independent and hence its programs can run on any type of computer available on  internet.
  2. It eliminates a lot of security problems for data on internet.

What is the difference between an executable(.exe) file and .CLASS file?


The .exe file contains machine language instructions for the microprocessor and is system dependent. .CLASS file contains byte code instructions for the JVM and is system idependent.