This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Firstly - 2 tips: use [code] tags, to post code, and check the 'Disable smilies in this post', to avoid the and . You can edit the post if you like.
Secondly - the answer - you're missing a return. You've declared the method to expect a return type of Connection - at the end try block you do return one, but what happens if one of your exceptions is thrown?
Hi Shaan. Next time you post a code use UBB please. It makes it tidier. What I can see from your program is that your method getConnect() returns a Connection. Therefore, under whatever circumstance, you must return a value. Say from example the program goes through catch(ClassNotFoundException e), then you aren't returning anything. Try something like this:
Note: You must declare "con" outside the try statement [ February 01, 2008: Message edited by: Olivier Legat ]