You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by jh...@apache.org on 2015/08/01 00:43:21 UTC
[44/50] [abbrv] incubator-calcite git commit: In sample code in
README.md, rename optiq to calcite (Ethan)
In sample code in README.md, rename optiq to calcite (Ethan)
Close apache/incubator-calcite#79
Project: http://git-wip-us.apache.org/repos/asf/incubator-calcite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-calcite/commit/3fd4fa5b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-calcite/tree/3fd4fa5b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-calcite/diff/3fd4fa5b
Branch: refs/heads/branch-release
Commit: 3fd4fa5bdc327f7841b50690e6910a0b7e9cfc48
Parents: eea9158
Author: Ethan <ca...@gmail.com>
Authored: Sun Apr 26 20:15:09 2015 -0500
Committer: Julian Hyde <jh...@apache.org>
Committed: Sun May 17 21:33:15 2015 -0700
----------------------------------------------------------------------
README.md | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/3fd4fa5b/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 2b64932..be6d841 100644
--- a/README.md
+++ b/README.md
@@ -53,15 +53,15 @@ public static class HrSchema {
public final Department[] depts = ...;
}
-Class.forName("net.hydromatic.optiq.jdbc.Driver");
+Class.forName("org.apache.calcite.jdbc.Driver");
Properties info = new Properties();
info.setProperty("lex", "JAVA");
Connection connection = DriverManager.getConnection("jdbc:calcite:", info);
-OptiqConnection optiqConnection =
- connection.unwrap(OptiqConnection.class);
-ReflectiveSchema.create(optiqConnection,
- optiqConnection.getRootSchema(), "hr", new HrSchema());
-Statement statement = optiqConnection.createStatement();
+CalciteConnection calciteConnection =
+ connection.unwrap(CalciteConnection.class);
+ReflectiveSchema.create(calciteConnection,
+ calciteConnection.getRootSchema(), "hr", new HrSchema());
+Statement statement = calciteConnection.createStatement();
ResultSet resultSet = statement.executeQuery(
"select d.deptno, min(e.empid)\n"
+ "from hr.emps as e\n"
@@ -88,8 +88,8 @@ library. But Calcite can also process data in other data formats, such
as JDBC. In the first example, replace
```java
-ReflectiveSchema.create(optiqConnection,
- optiqConnection.getRootSchema(), "hr", new HrSchema());
+ReflectiveSchema.create(calciteConnection,
+ calciteConnection.getRootSchema(), "hr", new HrSchema());
```
with
@@ -98,9 +98,10 @@ with
Class.forName("com.mysql.jdbc.Driver");
BasicDataSource dataSource = new BasicDataSource();
dataSource.setUrl("jdbc:mysql://localhost");
-dataSource.setUsername("sa");
-dataSource.setPassword("");
-JdbcSchema.create(optiqConnection, dataSource, rootSchema, "hr", "");
+dataSource.setUsername("username");
+dataSource.setPassword("password");
+JdbcSchema.create(calciteConnection.getRootSchema(), "name", dataSource,
+ null, "hr");
```
and Calcite will execute the same query in JDBC. To the application, the