Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java and JDK > Pro Java
Password Reminder
Register
| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
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..

Reply With Quote
  #2 (permalink)  
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.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 08:47 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.