Welcome to my blog, hope you enjoy reading

Monday, 25 June 2012

How to format a USB or external drive?


Monday, 18 June 2012

creating the hosts in the tomcat server in ubuntu

creating the hosts in the tomcat server in Ubuntu

step1:  In the /var/lib/tomcat6/conf/Catalina path we create folder with hostname 
           example: 'restarant'

step2: In that folder we create the file with name  'ROOT.xml'

step3: put following code in the ROOT.xml file

           <?xml version='1.0' encoding='utf-8'?>
           <Context displayName="hostname" docBase="/var/lib/tomcat6/webapps/warfilename/"                                                path=""  workDir="work/Catalina/hostname/_">

            example :
           <?xml version='1.0' encoding='utf-8'?>
           <Context displayName="restaurant" docBase="/var/lib/tomcat6/webapps/Restaurant/" path=""

step4:  In the /var/lib/tomcat6/conf/server.xml file  host tag(<Host>) data will be re paste in the file after close the host tag(</Host> and change the data in the 

<Host name="hostname"  appBase="webapps/warfilename/"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">

        <!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html -->
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />

        <!-- Access log processes all example.
             Documentation at: /docs/config/valve.html -->
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="localhost_access_log." suffix=".txt" pattern="common" resolveHosts="false"/>


step5: in Filesystem/etc/hosts file add the hostname and localhost port like
example: restaurant

step6: restart the server

step7: In browser enter url like
example:  http://restaurant:8080/(hostname:portnumber)

Tuesday, 5 June 2012

database and java

Changing the engine in the all tables of the database progrmetically for mysql

                     Connection connection = null;
                     //for getting the connecion  
    connection =                                                       DriverManager.getConnection("jdbc:mysql://localhost:3306/hydhouse","root","password");
           // Create statement object
           Statement stmt = connection.createStatement();

                            //for getting the tables from that database
           DatabaseMetaData dbm = connection.getMetaData();
 String[] types = {"TABLE"};
 ResultSet rs = dbm.getTables(null,null,"%",types);
 while (rs.next()){
 String table = rs.getString("TABLE_NAME");

//for change the engine in mysql
 String sql="ALTER TABLE "+table+" ENGINE = innodb ";
 int i=stmt.executeUpdate(sql);
       catch (SQLException s){
         System.out.println("SQL Exception " + s);