提交 b49b361f 编写于 作者: Z zyyang

change

上级 62b857e4
...@@ -249,6 +249,7 @@ public class TSDBDriver implements java.sql.Driver { ...@@ -249,6 +249,7 @@ public class TSDBDriver implements java.sql.Driver {
return null; return null;
// parse properties // parse properties
String urlForMeta = url;
int beginningOfSlashes = url.indexOf("//"); int beginningOfSlashes = url.indexOf("//");
int index = url.indexOf("?"); int index = url.indexOf("?");
if (index != -1) { if (index != -1) {
...@@ -271,6 +272,10 @@ public class TSDBDriver implements java.sql.Driver { ...@@ -271,6 +272,10 @@ public class TSDBDriver implements java.sql.Driver {
} }
} }
} }
// parse Product Name
String dbProductName = url.substring(0, beginningOfSlashes);
dbProductName = dbProductName.substring(dbProductName.indexOf(":") + 1);
dbProductName = dbProductName.substring(0, dbProductName.indexOf(":"));
// parse dbname // parse dbname
url = url.substring(beginningOfSlashes + 2); url = url.substring(beginningOfSlashes + 2);
int indexOfSlash = url.indexOf("/"); int indexOfSlash = url.indexOf("/");
...@@ -291,6 +296,9 @@ public class TSDBDriver implements java.sql.Driver { ...@@ -291,6 +296,9 @@ public class TSDBDriver implements java.sql.Driver {
if (url != null && url.length() > 0 && url.trim().length() > 0) { if (url != null && url.length() > 0 && url.trim().length() > 0) {
urlProps.setProperty(TSDBDriver.PROPERTY_KEY_HOST, url); urlProps.setProperty(TSDBDriver.PROPERTY_KEY_HOST, url);
} }
this.dbMetaData = new TSDBDatabaseMetaData(dbProductName, urlForMeta, urlProps.getProperty(TSDBDriver.PROPERTY_KEY_USER));
/* /*
String urlForMeta = url; String urlForMeta = url;
String dbProductName = url.substring(url.indexOf(":") + 1); String dbProductName = url.substring(url.indexOf(":") + 1);
......
...@@ -57,6 +57,12 @@ public class TSDBDriverTest { ...@@ -57,6 +57,12 @@ public class TSDBDriverTest {
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
try {
Class.forName("com.taosdata.jdbc.TSDBDriver");
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册