mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improved postgresql support
This commit is contained in:
@@ -915,7 +915,7 @@ public class DruidDataSource extends DruidAbstractDataSource
|
||||
} else if (realDriverClassName.equals("com.sybase.jdbc2.jdbc.SybDriver")) {
|
||||
this.exceptionSorter = new SybaseExceptionSorter();
|
||||
|
||||
} else if (realDriverClassName.equals("org.postgresql.Driver")) {
|
||||
} else if (realDriverClassName.equals(JdbcConstants.POSTGRESQL_DRIVER)) {
|
||||
this.exceptionSorter = new PGExceptionSorter();
|
||||
|
||||
} else if (realDriverClassName.equals("com.alibaba.druid.mock.MockDriver")) {
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.alibaba.druid.bvt.pool.vendor;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.postgresql.util.GT;
|
||||
import org.postgresql.util.PSQLException;
|
||||
import org.postgresql.util.PSQLState;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import com.alibaba.druid.pool.vendor.PGExceptionSorter;
|
||||
|
||||
public class PGExceptionSorterTest extends TestCase {
|
||||
|
||||
public void test_pg() throws Exception {
|
||||
PGExceptionSorter exSorter = new PGExceptionSorter();
|
||||
|
||||
PSQLException ex = new PSQLException(GT.tr("Expected an EOF from server, got: {0}", new Integer(0)),
|
||||
PSQLState.COMMUNICATION_ERROR);
|
||||
Assert.assertTrue(exSorter.isExceptionFatal(ex));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user