Tuesday, September 30, 2014

ORA-00904: invalid identifier Error in Oracle 11g database - Solved

If you have worked in Oracle database ever, you would definitely have seen ORA-00904: invalid identifier error. Doesn't matter which version you are working 10g, 11g or 12g, this is one of the most common error comes while doing CRUD (Create, Read, Update, and Delete) operations in Oracle. By the way, if you are beginner, SELECT, INSERT, UPDATE and DELETE are used to perform CRUD operation in Oracle database. What do you do if you get this error while running in SQL script? Like any error, you should first pay attention to error message, what is Oracle trying to say here. Invalid identifier means the column name entered is either missing or invalid, this is one of the most common cause of this error but not the only one. Some time it come if you use names, which happened to be reserved word in Oracle database. Now how do you resolve it?  We will learn in this article, by following series of examples which first reproduce this error and later suggest how to fix it.

Thursday, September 25, 2014

Java 8 Certification - Oracle Java SE 8 Programmer 1 (1Z1-808) - Latest OCPJP Exam

Today one of my reader asked about what is the latest OCPJP or SCJP exams available,  which prompted me to browse through Oracle's certification website. During my casual browsing, I noticed this new Java 8 certification. I said great, within six month of Java 8 release we now have Java SE 8 certification available, programmer still digesting changes form Java 8 now have chance to be certified on latest Java 8 . The certification is called "Oracle Certified Associate, Java SE 8 Programmer - 1Z1-808" and has written for the Java SE 8 release. Format of exam is similar to previous certification e.g. Java SE 7 Associate and Professional exams (1Z1-803 and 1Z1-804). The exam is in beta and as per their website, exam score reports will be available in CertView approximately 11 weeks after the close of the beta Exam. You will receive an email with instructions on how to access your beta exam results. Number of question is very high (150-225), comparing to old SCJP days, and you will get 2.5-3.5 hours to answer all questions. Given this exam is available, I am sure programmers will start getting confused that whether should they go for Java SE 7 or go for this beta exam, or wait for some time to get certified in Java SE 8. My suggestion to all of them is that it depends, if you are fresh graduate from college and looking for job, do Java SE 7 as soon as possible, it will help you to lend a Job faster. If you already got a job and settling there, you can wait for sometime until Java SE 8 exam come out of Beta or try this one because it doesn't cost you much. If you are still not sure, then read this article about why you should do Java certification. If I read correctly, it will cost you around 60 USD. Considering cost of Oracle Certified Associate, Java SE 7 Programmer, which is around 350$, this is much more cheaper, but remember it's still in beta.

Monday, September 22, 2014

Common Multi-threading Mistakes in Java - Calling run() instead of start()

Writing multi-threaded and concurrent programs is not easy, not even in Java.  Even senior developers, including myself, make mistakes while writing concurrent Java applications. This is also one of the trickiest area of Java programming language, where misconceptions outnumbers concepts. Considering amount of misconception an average Java programmers has about multi-threading and concurrency, I thought to start a new series about common multi-threading mistakes done by Java programmers; what is better way to learn from common real word mistakes. Learning from mistakes has another name Experience, but if you only learn from your mistakes then there is only limited things you can learn, but if you learn from other peoples mistake, you can learn much more in short span of time. Have you ever thought, Why writing multi-threaded code is difficult? IMHO, primarily reason for this is that it multi-threading makes it hard for a code to speak for itself. Programmer read code sequentially to understand how it's executed, but it is only correct if one and only one thread is executing it. That's why Single threaded code are easy to read and debug. As soon as two threads comes into picture, It become very difficult to make prediction about how your code behave, especially in the absent of any synchronization rules e.g. rules enforced by Java Memory Model. Without JMM you can not make correct prediction about your code in a multi-threaded environment, because it's possible for one thread to stop at arbitrary point and another thread at different point. Situation becomes even more tricky if those threads are sharing data between them e.g. in form of objects, a poorly written multi-threaded program can cause deadlock, race condition and responsiveness issues, which will prevent a Java application to fulfil it's promise. I hope, in this series we can learn from each other's mistake and take a step forward on writing correct multi-threaded application in Java.