Friday, February 12, 2010

Blogger Static Home page



To make a static start page add this code just after <body> tag n before main-wrapper



<b:if cond='data:blog.url == data:blog.homepageUrl'> 

   <div id='startpage'>

    <!-- Start Page-->

    </div>

<b:else/> 

     <div id='main-wrapper'>

        <b:section class='main' id='main' showaddelement='no'>

        <b:widget id='Blog1' locked='true' title='Blog Posts' type='Blog'/>

        </b:section>

      </div>

</b:if>

Tuesday, February 2, 2010

Oracle thin driver on Eclipse

1.      Add jar files
In Eclipse, after creating a new project -> right click on projname-> properties -> select Java Buildpath-> Add External Jars-> jar file path -> Ok
Jar file pathàC:\oraclexe\app\oracle\product\10.2.0\server\jdbc\lib
2.      Start adding new class file
To use the DriverManager class to create connection objects, you need to know how to make a connection URL that provides access information to the Oracle server. The Oracle connection URL for the thin client-side driver ojdbc14.jar has the following format:
jdbc:oracle:thin:[user/password]@[host][:port]:SID
jdbc:oracle:thin:[user/password]@//[host][:port]/SID

  user - The login user name defined in the Oracle server.

  password - The password for the login user.

  host - The host name where Oracle server is running.
         Default is 127.0.0.1 - the IP address of localhost.

  port - The port number where Oracle is listening for connection.
         Default is 1521.

  SID  - System ID of the Oracle server database instance.
By default, Oracle Database 10g Express Edition creates one database instance called XE.

Ex:       try {
                                      Connection con=null;
                                      Class.forName("oracle.jdbc.driver.OracleDriver");
                                      con=DriverManager.getConnection(
                                        "jdbc:oracle:thin:@localhost:1521:XE",
                                        "system",
                                        "password");
                                      Statement s=con.createStatement();
                                      s.execute("insert into emp values('attr1')");
                                      s.close();
                                      con.close();
                   } catch(Exception e){e.printStackTrace();}