From 7b696f435e57a0e6d665df23a031c5b32adf5d05 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Thu, 17 Apr 2014 12:00:51 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E7=BC=96=E8=AF=91=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. POM 里面 net.sf.json-lib 依赖加 classifier 2. mock SimpleDateSource 实现接口 --- .gitignore | 1 + manager/pom.xml | 1 + .../com/alibaba/cobar/manager/mock/SimpleDateSource.java | 7 +++++++ 3 files changed, 9 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7301567 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/manager/target/ \ No newline at end of file diff --git a/manager/pom.xml b/manager/pom.xml index 841e98a..df8a85b 100644 --- a/manager/pom.xml +++ b/manager/pom.xml @@ -138,6 +138,7 @@ net.sf.json-lib json-lib 2.2.3 + jdk15 xpp3 diff --git a/manager/src/main/java/com/alibaba/cobar/manager/mock/SimpleDateSource.java b/manager/src/main/java/com/alibaba/cobar/manager/mock/SimpleDateSource.java index da560eb..c881d69 100644 --- a/manager/src/main/java/com/alibaba/cobar/manager/mock/SimpleDateSource.java +++ b/manager/src/main/java/com/alibaba/cobar/manager/mock/SimpleDateSource.java @@ -19,6 +19,8 @@ import java.io.PrintWriter; import java.sql.Connection; import java.sql.SQLException; +import java.sql.SQLFeatureNotSupportedException; +import java.util.logging.Logger; import javax.sql.DataSource; @@ -72,4 +74,9 @@ public Connection getConnection(String username, String password) throws SQLExce return null; } + @Override + public Logger getParentLogger() throws SQLFeatureNotSupportedException { + throw new SQLFeatureNotSupportedException("Not supported yet."); + } + } From 15913f9464dd9208c2665e9441d995b381167a22 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Thu, 17 Apr 2014 13:23:30 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E7=BC=96=E8=AF=91=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit JDBC 4.1 兼容 --- .gitignore | 4 +++- .../main/java/com/alibaba/cobar/jdbc/Driver.java | 13 ++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 7301567..ece011d 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ -/manager/target/ \ No newline at end of file +/manager/target/ +/driver/target/ +/server/target/ \ No newline at end of file diff --git a/driver/src/main/java/com/alibaba/cobar/jdbc/Driver.java b/driver/src/main/java/com/alibaba/cobar/jdbc/Driver.java index 7b4eade..5a9633e 100644 --- a/driver/src/main/java/com/alibaba/cobar/jdbc/Driver.java +++ b/driver/src/main/java/com/alibaba/cobar/jdbc/Driver.java @@ -21,17 +21,19 @@ import java.util.Properties; import com.mysql.jdbc.NonRegisteringDriver; +import java.sql.SQLFeatureNotSupportedException; +import java.util.logging.Logger; /** * 在使用集群时提供负载均衡的功能,其他情况和MySQLDriver一样。 - * + * *
  * 使用方法:
  *   Class.forName("com.alibaba.cobar.jdbc.Driver");
  *   String url = "jdbc:cobar://host:port/dbname?user=xxx&password=xxx";
  *   ...
  * 
- * + * * @author xianmao.hexm 2012-4-27 */ public class Driver extends NonRegisteringDriver implements java.sql.Driver { @@ -51,7 +53,7 @@ public class Driver extends NonRegisteringDriver implements java.sql.Driver { /** * Construct a new driver and register it with DriverManager - * + * * @throws SQLException if a database error occurs. */ public Driver() throws SQLException { @@ -73,4 +75,9 @@ public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws return super.getPropertyInfo(UrlProvider.getMySQLUrl(url), info); } + @Override + public Logger getParentLogger() throws SQLFeatureNotSupportedException { + throw new SQLFeatureNotSupportedException("Not supported yet."); + } + }