Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > Pro Java
| Search | Today's Posts | Mark Forums Read
Pro Java Expert level Java questions not about a specific book. Please indicate your version.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro Java section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 8th, 2008, 03:34 AM
Authorized User
 
Join Date: Dec 2007
Location: india, kerala, India.
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to annumol
Default exception is never thrown in body of try statement

part of my program is this

import java.sql.*;
import javax.naming.*;
import java.util.*;

 public void dbConnection()
     {
        try
        {

    Class.forName("com.mysql.jdbc.Driver");

    m_connection=DriverManager.getConnection("jdbc:mys ql://localhost/libsoft","root","test");

             }
     catch (SQLException se)
           {
        System.out.println("SQL Error while connecting to the database : "+
                            se.toString());

           }
    catch (NamingException ne)
     {
        System.out.println("Naming exception Error while connecting to the database : "+ ne.toString());


      }
     catch (Exception e)
     {
        System.out.println("Other Error while connecting to the database : "+
                            e.toString());

     }
  }
when I compile this one error shows me.

 exception javax.naming.NamingException is never thrown in body of corresponding try statement
        catch (NamingException ne)
        ^
1 error
Please help me..

 
Old February 11th, 2008, 06:53 AM
jomet
Guest
 
Posts: n/a
Default

Hi,

Check this link
http://www.javaworld.com/javaworld/j...34.html?page=2

Cheers,

jomet.
---------------------------------------------
Once you start a working on something,
dont be afraid of failure and dont abandon it.
People who work sincerely are the happiest.




Similar Threads
Thread Thread Starter Forum Replies Last Post
error thrown by: Void AbortInternal() prv299 ASP.NET 2.0 Professional 1 June 12th, 2008 07:48 AM
Database does not update, no exception thrown hexOffender VB Databases Basics 5 November 24th, 2006 03:28 PM
Exception has been thrown by the target of an invo rajasarkar ASP.NET 1.0 and 1.1 Professional 2 June 19th, 2006 03:19 AM
Autosuggest Exception thrown jellie BOOK: Professional Ajax ISBN: 978-0-471-77778-6 3 March 14th, 2006 10:19 AM
Exception thrown Invalid_Viewstate r_ganesh76 ASP.NET 1.0 and 1.1 Professional 1 December 2nd, 2005 04:32 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.