hey all, I\'m new to Java and was wondering if I define a method to return a database object
like
import java.sql.*;
public class DbConn {
public
You should just eliminate your entire try/catch
block and allow exceptions to propagate, with an appropriate exception declaration. This will eliminate the error that Eclipse is reporting, plus right now your code is doing something very bad: by catching and re-throwing all exceptions, you're destroying the original stack trace and hiding other information contained in the original exception object.
Plus, what is the purpose of the line Class.forName("com.mysql.jdbc.Driver").newInstance();
? You're creating a new mysql Driver
object through reflection (why?) but you're not doing anything with it (why?).