I am trying to catch SQL Expection. whats the best way to do that?
Shall I use try and catch block?
try{
DataSource dataSource1 = DataSource.get(DataSourceProperties.SSO_CLIENT_DATA_SOURCE);
DSRequest dsUserRequest = new DSRequest();
dsUserRequest.setOperationId(DataSourceProperties.RETRIEVE_CLIENT_ID);
dataSource1.fetchData(createCriteria(StringClientDefinitions.CLIENT_CODE, getStrIataCode()),
new DSCallback() {
@Override
public void execute(DSResponse dsResponse, Object o, DSRequest dsRequest) {
getClientID(dsResponse, eventBus, appLayout);
thumbNailNavigator(eventBus);
}
}, dsUserRequest);
} catch(Exception e)
{
String msg = e.getMessage();
}
I am running above code when the database is down, it's throwing error before entering to catch statement.
Basically i want to catch a error when DB goes down.
Can you please suggest a way to catch it?
Shall I use try and catch block?
try{
DataSource dataSource1 = DataSource.get(DataSourceProperties.SSO_CLIENT_DATA_SOURCE);
DSRequest dsUserRequest = new DSRequest();
dsUserRequest.setOperationId(DataSourceProperties.RETRIEVE_CLIENT_ID);
dataSource1.fetchData(createCriteria(StringClientDefinitions.CLIENT_CODE, getStrIataCode()),
new DSCallback() {
@Override
public void execute(DSResponse dsResponse, Object o, DSRequest dsRequest) {
getClientID(dsResponse, eventBus, appLayout);
thumbNailNavigator(eventBus);
}
}, dsUserRequest);
} catch(Exception e)
{
String msg = e.getMessage();
}
I am running above code when the database is down, it's throwing error before entering to catch statement.
Basically i want to catch a error when DB goes down.
Can you please suggest a way to catch it?
Comment