This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

java.sql.DriverManager.getConnection()


I've done a little test to deliberately break things. When I shutdown my
local mysql database and I try to connect to it anyway, I've followed the
entire exception stream all the way up through the jdbc driver's source. I
can see the method com.mysql.Driver.connect() throwing an SQLException right
into java.sql.DriverManager.getConnection() in libjava.

Then, I get the message "abnormal program termination"; gdb says that
libjava exits with code 03.

(gdb) step
30                              con = DriverManager.getConnection(url,
"root", "");
(gdb) step

Program exited with code 03.
(gdb) quit

Since java.sql.DriverManager.getConnection() receives the SQLException, why
doesn't it simply throw the exception into my program? Why does it exit with
code 03?

I've made the mysql Driver throw an exception as soon as it gets invoked by
java.sql.DriverManager:

    public synchronized java.sql.Connection connect(String url,
                                                    Properties info)
                                             throws java.sql.SQLException {
	     System.out.println("throwing dummy exception");
	     if(true) { throw new SQLException("dummy exception"); } //ALWAYS THROW
AN EXCEPTION
	...

Therefore we can say that whatever exception is thrown to
java.sql.DriverManager, it will result in "abnormal program termination".

Does anybody know why?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]