2013-04-29 91 views

回答

3

如果您在做catch (Exception e)message應該從e.getMessage()可用。

如果您正在做catch (SQLException e)(或任何異常類型適用於您的數據訪問包)message仍然應該從e.getMessage()可用。此外,-20001應通過e.getErrorCode()。請注意,它可能通過絕對值(20001而不是-20001);你必須嘗試。

1

我覺得這篇文章對您會有幫助:Error catching

catch (GenericJdbcException ge) { 

IF (se.getErrorCode() == -20001) 

如果你不使用Hibernate,你可能需要更改的錯誤類型。

相關問題