SUN CA : University of Delhi Agraj's Weblog

Tuesday May 27, 2008

I have already answered some FAQ's on SCJP 1.5 certification examination in my previous blog entry. Just wanted to share some more information on the exam that i got to know.
There are 7 sections in the exam with equal weightage to each :

  1. Declarations, Initialization and Scoping
  2. Flow Control
  3. API Contents
  4. Concurrency
  5. OO Concepts
  6. Collections / Generics
  7. Fundamentals

 The exam consists of 72 MCQ's in total and you are given time of 3 hours to solve them. More than enough, I say.

In Delhi, there are a few prometric test centers where you can take the test. The one i know about, is NIIT Limited, located at P-17/90, Madras Hotel Complex, Connaught Place. It is located near the popular Sarvana Bhawan and McDonalds, so you won't be having much trouble finding it. You can also call them on 011-41516458 to know more.
The examination costs about Rs. 7000/- as of now but most of the times they (NIIT people) offer some kind of discount vouchers, so don't forget to ask for one. You might just get lucky. Otherwise also, the amount's not much really if you look at the advantages of being a SCJP certified professional.

Here are a few useful links:
To learn more about Sun Microsystems certification programs visit here
To register for any Sun Microsystems exam, logon here

Friday May 09, 2008

I'm glad to announce that 18 students from Department of Computer Science, University of Delhi would be
doing Summer Projects related to Glassfish. A list of involved students can be seen here.

These students got this wonderful opportunity of working on open-source projects and it would definitely
help them in increasing their technical expertise on Java EE and Glassfish and work under the able guidance
and support of mentors assigned to them.

I would like to thank Arun Gupta, Judy Tang, Sriram, Gopal Jorapur for their endless efforts and encouragement.

 

Sunday May 04, 2008


This post shows how to send Email using Java.....this means you can write a simple Java Program that sends a mail using your mail account details or you can embed this functionality in your Web Application. Instead of explaining details of how it works, i will first give you the code that i used and then direct you to some useful links/resources that help you to understand better.

Resources Required:
JavaMail
JavaBeans Activation Framework
JAF(JavaBeans Activation Framework) is already shipped with Java SE 6, so Java SE 6 users need not download it separately.
NetBeans 6.1 IDE
Needless to say, NetBeans 6.1 IDE has helped me and other students of my University in completing assignments and projects on time and with ease. So, if you don't have it, download it right away here. You can also order NetBeans Starter Kit DVD here.

Why you need to download them ?
JavaMail consists of various jar files such as mail.jar, mailapi.jar, smtp.jar, pop3.jar whereas JAF mainly consists of activation.jar file. You need to download them and include these jar files in your CLASSPATH so that your JVM(Java Virtual Machine) can find the JAF classes.

Getting Started

Open the NetBeans 6.1 IDE.


Pretty fast than previous releases. Took about only 14.35 seconds on my machine.
Go to File --> New Project
Under Categories, choose "Web" and then select to create a simple Web Application.



Click Next and Type in Project Name : JavaMail. Be sure to select Glassfish as your server.

 

Click Finish and allow NetBeans to create files for your project.

Now, index.jsp opens up in the editor by default. Copy and paste the following code in your index.jsp file. It simply creates a HTML form that asks for the receiver's email address, subject and message body of the email.
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title> Java Mail </title>
    </head>
    <body>
        <form action="sendMail.jsp" method="POST">
            <table border="0" align="center" cellpadding="5">
                <tbody>
                    <thead><tr> <td colspan="3" align="center">
                    <b> Send Mail </b> </td> </tr> </thead>
                    <tr>
                        <td> To </td> <td> : </td>
                        <td> <input type="text" name="to" value="" /> </td>
                    </tr>
                    <tr>
                        <td> Subject </td> <td> : </td>
                        <td> <input type="text" name="subject" value="" /> </td>
                    </tr>
                    <tr>
                        <td> Message </td> <td> : </td>
                        <td> <textarea name="message" rows="8" cols="30">
                        </textarea></td>
                    </tr>
                    <tr>
                        <td colspan="3" align="center">
                        <input type="submit" value="Send Mail" />
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <input type="reset" value="Reset" />
                        <td>
                    </tr>
                </tbody>
            </table>
        </form>
    </body>
</html>

Save your index.jsp and it looks like


 

Now, we create a bean in which we store all the mail related information : sender's email id and password and receiver's email id, subject and message body of the email and the name of the smtp server that we use to send email.

Right-click the project node and select New --> Java Class
A wizard like the following appears, fill in the appropriate details as
Class Name : Mail
Package Name : jMail


Mail.java class open up in the editor.
Add the following instance variables to the bean:
String to;
String from;
String message;
String subject;
String smtpServ;

Generate the getter, setter methods for them by right-clicking in the editor and select Refactor --> Encapsulate Fields. Then check all the setter and getter methods and click Refactor so that NetBeans 6.1 generates code for them.

 

It is here, we make use of the JavaMail API and send mail using the following code. But before doing that, import the required packages.
import javax.mail.*;
import javax.mail.internet*;
import java.util.*;

Now, as you has already noticed, NetBeans is showing errors showing that it doesn't know of javax.mail package even if you have correctly downloaded and installed the JAF and JavaMail API. To make NetBeans aware of the existence of these packages, perform the following steps:
Right click the project node (JavaMail), click to Properties to change properties of the project
Now go to Libraries Tab. (since we need to add jar files to our project)


Click on Add JAR/Folder Button. A window opens up.
Browse to the location where you have installed/unzipped your JavaMail API and then include

  • activation.jar
  • pop3.jar
  • mail.jar
  • mailapi.jar
  • smtp.jar 

If you do not perform this step, then NetBeans will not recognize JAF and JavaMail classes and hence will not compile the program given below which makes use of classes such as Message, Session, Transport etc.
Compile your program to check whether you have been able to successfully include these jar files or not.

Now, the main function sendMail( ), which is actually responsible for sending mail:
public int sendMail(){
        try
        {
            Properties props = System.getProperties();
              // -- Attaching to default Session, or we could start a new one --
              props.put("mail.transport.protocol", "smtp" );
              props.put("mail.smtp.starttls.enable","true" );
              props.put("mail.smtp.host",smtpServ);
              props.put("mail.smtp.auth", "true" );
              Authenticator auth = new SMTPAuthenticator();
              Session session = Session.getInstance(props, auth);
              // -- Create a new message --
              Message msg = new MimeMessage(session);
              // -- Set the FROM and TO fields --
              msg.setFrom(new InternetAddress(from));
              msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(to, false));
              msg.setSubject(subject);
              msg.setText(message);
              // -- Set some other header information --
              msg.setHeader("MyMail", "Mr. XYZ" );
              msg.setSentDate(new Date());
              // -- Send the message --
              Transport.send(msg);
              System.out.println("Message sent to"+to+" OK." );
              return 0;
        }
        catch (Exception ex)
        {
          ex.printStackTrace();
          System.out.println("Exception "+ex);
          return -1;
        }
  }

// Also include an inner class that is used for authentication purposes

private class SMTPAuthenticator extends javax.mail.Authenticator {
        @Override
        public PasswordAuthentication getPasswordAuthentication() {
            String username =  "Java.Mail.CA@gmail.com";           // specify your email id here (sender's email id)
            String password = "javamail";                                      // specify your password here
            return new PasswordAuthentication(username, password);
        }
  }

Save the file and compile it.
Now add another JSP, name it sendMail.jsp
Add the following code to it that instantiates JavaBean Object and set properties of JavaBean using the parameters passed to it using index.jsp
<jsp:useBean id="mail" scope="session" class="jMail.Mail" />
<jsp:setProperty name="mail" property="to" value="to" />
<jsp:setProperty name="mail" property="from" value="Java.Mail.CA@gmail.com" />
<jsp:setProperty name="mail" property="smtpServ" value="smtp.gmail.com" />
<jsp:setProperty name="mail" property="subject" param="subject" />
<jsp:setProperty name="mail" property="message" param="message" />

The main point to note here is the value of smtpServ that we have passed. Here, we are using a gmail id, so its smtp server name should be used, which is "smtp.gmail.com". If you want to use your own email id, then you have to make few changes as specified above and also change the value of smtpServ property to your smtp server name.
Add the following code to sendMail.jsp that calls the sendMail() method of the bean. Yes, a bean can have other methods except getter and setter methods. Its perfectly legal. :-)

 <%
String to = mail.getTo();
int result;
result = mail.sendMail();
if(result == 0){
    out.println(" Mail Successfully Sent to "+to);
}
else{
    out.println(" Mail NOT Sent to "+to);
}  
%>

       
Save your project and Run it to see that it actually works :-)
The whole project is available here for download. 

Notes:
There is much to JavaMail than what is mentioned here. For more read on
JavaMail & Glassfish
Read the following links to understand what's actually happening in the code given above
JavaMail Quick Start
jGuru : Fundamentals of JavaMail API

Related & Advanced :
Creating JavaMail Client On NB

Please do not modify the password for the account Java.Mail.CA@gmail.com I created it only for demo purposes and have given out the account details as on all tutorials/demos about JavaMail that i have seen online leave these fields empty and also leave smtp server name fields empty, which only adds to confusion for novices.
Any comments, suggestions and corrections are welcome.       


Friday May 02, 2008

I have been bugged with this question many a times so finally i have decided to write a small blog entry on the same. :-)

An Application Server (like Glassfish) is more sophisticated and complex (read intelligent) when compared with a Web Server (like Tomcat). A Web server is based on HTTP request-response model and generally acts as a web container for JSP's and Servlets. You give it a request and back comes the reply.

On the other hand, an Application Server can be used to serve business logic to applications programs, generally in a n-tier architecture (n>2), through any number of protocols (HTTP, HTTPS, IIOS/SSL). It is this capability of an appserver to cater the needs of a separate business layer in a 3-tier architecture through a component API (like EJB's) that makes enterprise level applications far more scalable. By separating the business logic from presentation layer, we make the business logic reusable between and within applications. Moreover, an application server manages its own resources. It takes care of other important issues like Transaction Management, Security, Database Connection Pooling, Clustering, Scalability and Messaging etc. A web server cannot provide these.

An Application server like Glassfish also provides the administrator with something known as Glassfish Admin Console, using which he/she can easily manage and utilize various resources like Connection Pools, JavaMail Sessions. More on this coming up soon.

Generally, all application servers contain a web server in them or you can say that a web server is a small subset of what comprises of an Application Server. Generally, all application server comes with two types of containers:

  • Web Container
  • EJB(Enterprise JavaBeans) Container

Difference b/w Glassfish & Tomcat in Arun Gupta's words,

- Tomcat is only a JSP/Servlet container. Everything else such as Web services, all the "Web 2.0" style processing, etc need to be installed in the container. Because it's only JSP/Servlet container, it's light-weight.
- Glassfish is a full Java EE 5 compliant App server. JSP/Servlet is just one component of Java EE 5, then there is Enterprise Java Beans, Web services, XML Binding, Security, Reliability, Transactions, Clustering, High Availability, Fault Tolerance and such enterprise features. GlassFish comes pre-bundled and pre-configured to handled those. In case of Tomcat, you need to install additional software for each of these components.

As a matter of fact, i'm an avid follower of Glassfish and strongly recommend Glassfish to developers worldwide, various reasons pamper me to do so:

  • It is Open Source
  • It's supported, maintained & developed by Sun Microsystems and others too.
  • It is fully Java EE 5 compliant and any new technology as and when introduced (even in future), GF will support that also.

Monday Apr 14, 2008

Sun Microsystems has always been innovative in introducing technology to students via different measures. Apart from the various resources(free softwares, study material, tech tips on blogs) that it offers to students via various open source communities and forums, it has also introduced some online courses for students:

Introduction to Solaris and opensolaris.org
An introduction to the Solaris Operating Environment and the
opensolaris opensource project. You will learn about some key
technologies that makes Solaris to be a leading Operating Environment,
ZFS - a new generation of filesystems, Solaris Containers - OS level
Virtualization and DTrace - an revolution in tracing frameworks.

Real World Technologies, NetBeans GUI Builder, JRuby, JavaFX, and Java ME
This is an introduction level course that leads you to the basics of JavaFX, NetBeans GUI, JRuby, and JavaME programming.

These courses are free of cost. You only need a SDN account, that comes for free after simple registration process.
And add to that, you will also earn a certificate on successful completion of the course. What else can you ask for ? :-)
So, what are you waiting for. Go take these courses and make the best use of your time.

Thursday Apr 10, 2008


TV as you know is a form of entertainment. On other other hand, NetBeans is a multi-lingual IDE, a community and a platform, let's say something inherently technical.

NetBeans T.V. is an amalgamation of both, i.e. an effort that joins both your hands. Explore it here. The part which i liked the most were the high-quality screencasts that really make your life simpler by delivering tutorials in an out-of-box fashion. Other than screencasts, it boasts of latest tech-news related to NetBeans and a wonderful community that is always ears to your problems.

Another worth mentioning resource, which i personally prefer is NetBeans Master Index available here. It has it all. Everything that you would ever need to know about NetBeans can be found here. And yes, you can also contribute it in. We at Sun encourage you to write tutorials, articles describing any new feature you want to.

Also you can have a look at the multi-faceted face of NetBeans here.

Friday Apr 04, 2008

Here's a quick review of Questions and Answers that i'm normally asked when i talk about various Sun Certifications in my demos

Q.  What's SCJP ?
A.  SCJP stands for Sun Certified Java Programmer. It is one of the many certifications that Sun Microsystems offers to students and professionals alike to distinguish them from the rest and appraise their expertise. This foundation certification is for programmers interested in demonstrating proficiency in the fundamentals of Java Programming Langugae

Q. Why SCJP ?
A. Having a certification certainly distinguishes you from the herd. And as a student, it only adds to your value and to your resume. Any software organization would prefer having certified students/professionals rather than those who it might need to train. And may be that's why, its costs around Rs. 7000 as of now.

Q. INR 7000 ? Isn't is too costly ?
A. Depends on how you look at it. If you look at the benefits of being certified, it certainly is not costly. And with SAI (Sun Academic Initiative) in your reach, the cost boils down by around 40% (now thats really cool)

Q. SCJP and SAI ??
A. Learn more about SAI here, and if your institute is registered, then you can take free online practice tests, passing which avails you the benefit of a discount upto 40% on the total cost of the examination. I'm not too sure of these figures though. :-)

Q. Any idea about the exam pattern of SCJP ?
A. Its entirely based on personal experience. 2 months back, my brother cleared it, so i know from his experience. At that time, it consist of around 72 questions with 3 hours given to solve them. And the paper can be taken online only at certain NIIT centers as far as Delhi is concerned. All the questions were multiple-choice with only one choice being the correct one.

Q. SCJP Resources ?

A. If you google over it, there is a huge world which might make you go crazy. :-) On a more serious note, the best place to start for a Java Programmer is to study a very good book by Kathy Sierra, especially written for the certification purposes. The book is self-sufficient and explains all the necessary concepts in a clean manner illustrating with examples and figures when necessary. Apart from it, one should also got for several mock exams (available over net for free) to get a feel of the real exam. The book can be easily found by googling over it. In case you are unable to find it, do let me know.

Q. I'm a newbie to Java. Where should i start from ?
A. Unfortunately, the examination is not for you (at the moment). First, one should get a feel and basic hold of the programming language and then only start thinking in terms of getting certified.

Q. Which one should i go for ? SCJP 5.0 or SCJP 6.0 ?
A. In my opinion, the best place to start with, is SCJP 5.0 as SCJP 4.0 is useless in today's scenario and SCJP 6.0 is really advanced. Although SCJP 5.0 would also contain many new concepts and mechanims unknown to programmers who worked on JDK 1.4 and below (examples - things like var args, generics, autoboxing etc) but they can be learned easily using the Kathy Sierra Book i mentioned earlier

Q. Where to go next ?? i.e after SCJP ?
A. Depending on what you want to do with the certification and your
preference. If you prefer working on the web front-end, go for SCWCD.
If you are using EJB and developing enterprise app, you can go for
SCBCD. Each of these certifications aims at different technologies.

Q. What other certifications Sun offers ?
A. Have a look at this and you will know.
 

The content of this blog is based on my personal experience interacting with different SCJP certified professionals as well as with students and it does not reflect in any way the opinion of my employer.

Any suggestions, updations and corrections are welcome. Please post them as comments.

Saturday Mar 22, 2008

To all my friends, who are web developers and frequently have problems debugging their code, I would strongly recommend using Firebug Debugger.
It is an amazing tool that integrates well with Firefox and is capable of editing, debugging and monitoring Javascript, CSS, HTML, DOM API, and AJAX. Some of its widely used features:

  • Logging for web pages - get rid of alert boxes
  • JavaScript Debugging
  • Ajax Request Spy - can log all Ajax request and response messages
  • Live Editing - let you edit some parts of DOM

 So what are you waiting for. Get Firebug Now!!

An excellent tutorial about Debugging JavaScript with Firebug can be found here.

I do not understand why Gmail shows up this ugly warning when using Firebug with it:

 Gmail says Firebug makes it slow !!

May be because Gmail makes excessive use of technologies like Ajax and JavaScript and if Firebug is actively trapping all Ajax request-response traffic, then it might just eat up a substantial portion of your RAM after being active for a longer time.
 

Saturday Mar 15, 2008

Oh yeah, jMaki "rules" at DUCS (Delhi University Computer Science Deparment) :)

It was very much expected, especially after the last talk i gave. It was on Building Ajax applications with NetBeans 6.0 .
In that demo, i talked in brief about various jMaki (not jMonkey) :) toolkits and that really took students by surprise.
They were left impressed to see the ease by which one can create good looking web pages.

Although all widgets are pretty good and come handy for various requirements but some of my personal favorites
which i plan to use in building my website(as a part of my semester project) are:
--> jMaki Dojo
       <> Accordion (for leftsidebar)
       <> Drop Down Date Picker
       <> Fish Eye (really cool one)
       <> Tabbed View (this one u gotta see) -- much like orkut tabbed profile browsing
       <> Tree (for making sitemaps)
--> jMaki Google
       <> Map
--> jMaki Yahoo
       <> Menu
       <> Tooltip
       <> Slider

After using these basic widgets, one might want to divulge into details, and make your widget and hence your
application more useful by binding the widgets with the back-end database.
To do so, the ideal place to start with is to see the following entry:
Dynamic data in jMaki Widgets
A big thanks to Arun Gupta for making the task look so simple.

Other such entries:
Dynamic Ajax Table Example using jMaki and JPA on Glassfish
CRUD using jMaki & JPA

I'm still hunting more tutorials on using jMaki toolkits.
The one i always look back is located at JavaPassion.Com

Other than that, i would recommend students to post queries on various online forums that exists to help you out:
-- java.net forum - Project jMaki
-- java.net forum - Project Glassfish

Also have a look at Ajax FAQ's for more information on Ajax.

Please drop me a comment if you have some useful links.

         

Friday Mar 07, 2008

So finally we had a demo on Building AJAX Applications with NetBeans 6.0 today with few teachers
and a reasonable amount of students attending the tech talk. It lasted for 75 minutes.
The talk started with a brief introduction of NetBeans and its various features.

It followed with an introduction to AJAX, its usage and comparison against the conventional web applications.
Then i showed them a small yet useful Ajax demo and talked in detail about its anatomy describing
how the asynchronous communication is taking place.

The technologies that are used in AJAX are
--> JavaScript
--> DOM API (Document Object Model - Application Programmable Interface)
--> CSS (Cascading Style Sheets)
--> XMLHttpRequest Object.

A very good tutorial on the same can be found on http://www.javapassion.com/ajaxcodecamp
Hats off to Sang Shin for maintaining and making such a friendly and resourceful website.
Its a boon for students and developers alike.

Coming back to the talk, I also showed to the students various jMaki toolkits and widgets that facilitate easy
drag and drop development of web applications by showing them the jMaki Dojo Toolkit esp.
<> The Tabbed View,
<> The Fish Eye,
<> The Accordion,
<> The Dojo Clock,
<> The Dojo Tree and some more widgets.


                     --- Making my point across ---

The students were left impressed and asking for more. :)
The session was overall interactive with students participating and i also distributed
Sun's Caps, Mugs and Pens to the curious, willing and interactive students.

               All Smiles after the talk was over !!

The presentation can be found on Java User Group Of Delhi University

Thursday Mar 06, 2008

This article can prove useful for novices (like me) who do not have much experience working with Solaris
or for that matter with any flavour of Linux.

If you have two or more Operating Systems installed in your machine, then you must have seen a blue screen
asking you for your choice of operating system to boot into. That is, the GRUB bootloader for you.

To change the default booting Operating System or to edit the Timeout interval (the time for which the screen appears),
one must edit the grub.conf file or menu.lst file

The steps are :

1. Locate the required file in your machine.
Normally it is located in /etc/grub.conf or /boot/grub/grub.conf
With Solaris 10, it is present in /boot/grub/menu.lst (menu.lst is an alias for grub.conf)

2. Following represent some selected information from menu.lst:

#pragma ident "@(#)menu.lst 1.2 07/01/10 SMI"
#
# default menu entry to boot
default 0
#
# menu timeout in second before default OS is booted
# set to -1 to wait for user input
timeout 10

#---------- ADDED BY BOOTADM - DO NOT EDIT ----------
title Solaris Express Community Edition snv_76 X86
kernel$ /platform/i86pc/kernel/$ISADIR/unix
module$ /platform/i86pc/$ISADIR/boot_archive
#---------------------END BOOTADM--------------------
#---------- ADDED BY BOOTADM - DO NOT EDIT ----------
title Solaris xVM
kernel$ /boot/$ISADIR/xen.gz
module$ /platform/i86xpv/kernel/$ISADIR/unix /platform/i86xpv/kernel/$ISADIR/unix
module$ /platform/i86pc/$ISADIR/boot_archive
#---------------------END BOOTADM--------------------
#---------- ADDED BY BOOTADM - DO NOT EDIT ----------
title Solaris failsafe
kernel /boot/platform/i86pc/kernel/unix -s
module /boot/x86.miniroot-safe
#---------------------END BOOTADM--------------------

title Windows
rootnoverify (hd0,0)
chainloader +1

3. We will now change the default booting Operating system, its name and the timeout interval

To change the name of the OS, the 4th entry (with title) must be changed as follows:
"title Windows" is changed to "title Windows Vista" or anything of your choice

To double the timeout interval,
"timeout 10" is changed to "timeout 20" which means the blue screen will appear for 20 seconds now.

To change the default booting Operating system, change
"default 0" to "default x" where x is the position of the OS entry in menu.lst
for example to boot into Windows,
change "default 0" to "default 3"

4. Save the changes and bingo !! You are done.

5. Reboot to check that it has been done correctly.

Note 1 : Please do not edit any part of menu.lst file, which you do not know about, as it might
result in some unexpected behaviour.

Note 2 : Comments can be given in menu.lst by starting the line with # symbol

Note 3 : There is enough help given in the menu.lst file, just read the comments carefully and you will never fail.

Note 4 : Full tutorial on grub can be found on http://www.dedoimedo.com/computers/grub.html

Disclaimer : If you find anything wrong or missing, please leave a comment. Thanks.

Tuesday Mar 04, 2008

So here comes time for another Tech-Talk.
This time on Building AJAX Applications with Netbeans 6.0.1

Taking care of the fact that AJAX is something new for all the students,
the demo will start from the very basics. :)

The talk is scheduled on 7th March, 2008 in the Seminar Room,
Department of Computer Science, University of Delhi at 1500 hours.

For any queries, please mail me on Agraj.Mangal@Sun.Com

Friday Feb 29, 2008

Following comparison of world's two most popular database management systems (DBMS) is based on their use as a database for making web based applications.

            

Now that MySQL is officially a part of Sun, i would any day prefer MySQL for making my web based applications than any other huge (read heavyweight) databases, which probably offers so many features that are basically not needed for creating such applications.
Read Jonathan Schwartz's Blog to find more.

As regards Comparison, i would like to highlight following points:

Firstly being Open Source, MySQL comes as a free download for developers worldwide. On the other hand, for using Oracle, you need a license (and for that matter a pretty costly license)

With Google, Facebook and Sina.com prefering MySQL for creating network services, one cannot doubt over MySQL capability of handling high volumes of data (perhaps in terabytes or even more)

MySQL is already known for its faster data retrieval, and impressive clustering and replication features and with MySQL 5.0 supporting stored procedures, views and triggers, the situation has only improved.

If you are a newbie to this world of Databases, i would recommend you to start with MySQL and then gradually shift to some other, if need be.

Its not that Oracle is not useful or because i'm a SUN CA, I will continue to praise Sun's technology and products. :)

The truth remains that Oracle provides a huge array of features as compared to any other existing DBMS, let alone MySQL. Oracle is considered as a giant in the world of database installations.
For these reasons, it is heavyweight and installation and uninstallation can get a bit tricky for novices.
In a nutshell, features is surely one area where MySQL loses to Oracle, but then MySQL is devoid of various disadvantages of Oracle.

Also Oracle 9i and 10g both can also be used a ORDBMS(Object Relational Database Management Systems) and supports ORSQL which only a few other databases like Informix and IBM's DB2 does, but MySQL cannot be used to implement a ORDBMS design.

To summarize, i would say that In the world of databases, there is no "one size fits all".
If you need the Oracle features, MySQL isn't going to work for you.
Conversely, if you don't need the Oracle features(which is most often the case), MySQL is a lot cheaper,
even with the license and the support contract.
And with Sun acquiring it, the situation is only going to improve. :)

Top Exec Speaks Up

Mr. Charles Phillips, president of Oracle, once made a statement at some conference about the comparison between Oracle and MySQL: "We're both in the transportation business," Mr Phillips said. "We have a 747, and they have a Toyota."
Mr. Marten Mickos, CEO of MySQL is more than happy with the comparison made, since there are many more Toyotas sold than 747s. "Toyota is a very profitable company," he added. :)
Mr Mickos maintained that the company is still more interested in new web-based application customers than it is in replacing existing database installations.
(taken from http://www.cbronline.com/article_news.asp?guid=9231B8BD-3788-4DB2-B85F-707E75857B58 )

Disclaimer:
The above comparison is based on my personal experience with both DBMS. If you find some missing/wrong information, please leave a comment.

Friday Feb 22, 2008

So finally we had a Successful Sun Seminar @ Sankalan 2008.
For those, who do not know what Sankalan is, its a technical festival organized annually by
Department of Computer Science, University of Delhi.
It was well attended by 65 teams all over India with more than 350 students.

Coming to Sun's participation in the tech-fest, it was dominated by Mr. Ajay Ahuja's Talk on
the topic "Sun Microsystems: Choice, Innovation & Value".


              Ajay Ahuja Sir @ Sankalan

He talked about various Certifications and Trainings offered by Sun Microsystems to
the students and also about the discount offered to SAI registered schools.
He also talked about Solaris and its various amazing features.
All in all, it was an entertaining and informative session enjoyed by students and teachers alike.

Tuesday Feb 12, 2008

As planned, today I conducted a techtalk-cum-demo on JDBC Connectivity, i.e. how to
connect a Java Application with a RDBMS(Relational Database Management System).
The target audience was totally new to the concept so i started off from the very scratch.
Following was the agenda:
# What is JDBC ?
# JDBC Architecture
-- 2 tier Architecture
-- 3 tier Architecture
# JDBC Drivers
# Connecting to Database
# Java Persistence API


It included the discussion of the importance of the application logic layer
and a brief comparison of Web Server and Application Server

It also emphasized the growing existence and importance of an application server like Glassfish in the industry.
At this point, i would like to mention that the students of the department have agreed to use Glassfish
in place of Tomcat as the application server.

2 Tier Applications embed the application logic in the jsp files and hence is visible to the user
3 tier apps add another layer which takes care of the business logic making it transparent to the user
and hence more preferred over corresponding 2 tier web apps.

One of the most popular way of implementing the application logic layer is to use Javabeans that can be easily
called in jsp files thus abstracting the details from the user.

I then talked in brief about the JDBC product components viz. the
JDBC API (java.sql and javax.sql) and
JNDI (Java Naming and Directory Interface)

Next, came information about different kinds of JDBC drivers. There are currently 221 drivers that
can be used to support a wide variety of databases. These drivers can be categorized into 4 major types.

The crux of the presentation was the actual code necessary to connect to the database.
As such, the process can be divided into three parts:
1. Load the driver
2. Connect to the database
3. Query the database

We use various classes and functions provided by JDBC API to achieve the above mentioned steps.



It followed with a demo with me building a small web app using Netbeans 6.0 + Glassfish
that interacts with MySQL and it worked !! :-)
The students were happy to see that its so easy to connect and query the database
and i think this presentation will surely helped them in doing their semester projects
(i.e. to create a dynamic website using JSP)

After demonstrating to them how easy it was to use JDBC, i switched back to ppt and
introduced to them the concept of JPA (Java Persistence API)
I talked about how it is the next-generation industry standard for connectivity with DBMS/RDBMS
and is gaining popularity with each passing day.

I will strongly recommend reading Mr. Arun Gupta's blog entry:
http://blogs.sun.com/arungupta/entry/hello_jpa_world
showing how simple it is to build a Hello JPA World Application. Do read it!

The presentation ended with giving them a repertoire of web resources and talking about
Certifications and Trainings offered by Sun Microsystems.

The presentation ended with a round of applause, i hope that best describes how it went !! :-)

The presentation for the same can be found on JUG-DU (the google group)

For any queries, please contact me on Agraj.Mangal@Sun.Com