Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Help with sqlite please

  1. #1
    Junior Member
    Join Date
    Jul 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Help with sqlite please

    Hi. I am new to this forum. I haven't done any Java programming in close to 15 years. I am trying to write a class to connect to a sqlite db. I am trying to personalize some existing API software for a popular online trading platform. I have been following the wikibooks JDBC sqlite tutorial. I pretty much copied the example class from there:

    package com.ib.client.examples;

    import java.sql.*;

    /**
    *
    * @author Trader
    */
    public class Mydb extends DatabaseInterface{

    public Mydb (String sDriverKey, String sUrlKey) {
    init (sDriverKey, sUrlKey);
    }

    public void init(String sDriverVar, String sUrlVar) throws Exception {
    setDriver(sDriverVar);
    setUrl(sUrlVar);
    setConnection();
    setStatement();
    }
    .
    .
    .
    I am running into this error:

    error: unreported exception Exception; must be caught or declared to be thrown

    Any help is greatly appreciated. Thank you.


  2. #2
    Super Moderator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,099
    Thanks
    169
    Thanked 779 Times in 725 Posts
    Blog Entries
    5

    Default Re: Help with sqlite please

    Please read the forum rules. Double posting is not allowed (your duplicate post has been removed), and please wrap your code in the code tags.

    error: unreported exception Exception; must be caught or declared to be thrown
    The error pretty much says it all. The code throws an Exception, which you must catch or declare thrown so that it may be caught. Surround your code with a try/catch/finally, or have your method throw the appropriate Exception. See http://docs.oracle.com/javase/tutori...al/exceptions/

Similar Threads

  1. SQLite and Desktop Application
    By urosz in forum JDBC & Databases
    Replies: 12
    Last Post: November 2nd, 2009, 02:50 AM