<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to Sample Codes</title><link>https://sourceforge.net/p/jackhare/wiki/Sample%2520Codes/</link><description>Recent changes to Sample Codes</description><atom:link href="https://sourceforge.net/p/jackhare/wiki/Sample%20Codes/feed" rel="self"/><language>en</language><lastBuildDate>Wed, 18 Apr 2012 10:17:06 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/jackhare/wiki/Sample%20Codes/feed" rel="self" type="application/rss+xml"/><item><title>WikiPage Sample Codes modified by Dean</title><link>https://sourceforge.net/p/jackhare/wiki/Sample%2520Codes/</link><description>&lt;pre&gt;--- v17 
+++ v18 
@@ -26,7 +26,7 @@
 ------------------------
 JackHare is JDBC API compliant, which means that your client code only depends on the _java.sql.\*_ and _javax.sql.\*_, so the following operations are the identical JDBC API operations you are already familiar on other RDB products.
 
-You can download sample code [**here**](http://sourceforge.net/p/jackhare/code/30/tree/trunk/CloudComputing/projects/JackHareSampleCode)
+You can download sample code [**here**](http://sourceforge.net/p/jackhare/code/30/tree/trunk/CloudComputing/projects/JackHareSampleCode).
 
 CREATE CONNECTION
 ------------------------
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Dean</dc:creator><pubDate>Wed, 18 Apr 2012 10:17:06 -0000</pubDate><guid>https://sourceforge.net2e4f3b1dc9c4c8bab8976ad3a84ad9a6c56e7bdd</guid></item><item><title>WikiPage Sample Codes modified by Dean</title><link>https://sourceforge.net/p/jackhare/wiki/Sample%2520Codes/</link><description>&lt;pre&gt;--- v16 
+++ v17 
@@ -26,6 +26,7 @@
 ------------------------
 JackHare is JDBC API compliant, which means that your client code only depends on the _java.sql.\*_ and _javax.sql.\*_, so the following operations are the identical JDBC API operations you are already familiar on other RDB products.
 
+You can download sample code [**here**](http://sourceforge.net/p/jackhare/code/30/tree/trunk/CloudComputing/projects/JackHareSampleCode)
 
 CREATE CONNECTION
 ------------------------
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Dean</dc:creator><pubDate>Wed, 18 Apr 2012 10:16:39 -0000</pubDate><guid>https://sourceforge.net26e1acd81049a14070113c0222f15aff46119a11</guid></item><item><title>WikiPage Sample Codes modified by Kyle</title><link>https://sourceforge.net/p/jackhare/wiki/Sample%2520Codes/</link><description>&lt;pre&gt;--- v15 
+++ v16 
@@ -49,7 +49,7 @@
 props.setProperty("user", USER_NAME);
 props.setProperty("password", PASSWORD);
 props.setProperty("hbase.client.scanner.caching", "20000");
-props.setProperty("jackhare.schema", "SCHEMA_NAME");
+props.setProperty("jackhare.schema", SCHEMA_NAME);
 props.setProperty("jackhare.metadata.repository.jdbc.derby", "net.jackhare.sql.metadata.derby.DerbyMetaDataRepositoryImpl");
 props.setProperty("jackhare.metadata.driver.jdbc.derby", "org.apache.derby.jdbc.ClientDriver");
 props.setProperty("jackhare.schema.create", "true");
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Kyle</dc:creator><pubDate>Thu, 12 Apr 2012 08:16:08 -0000</pubDate><guid>https://sourceforge.nete8235be39aa399d7568e4672983bdb2e74c368a1</guid></item><item><title>WikiPage Sample Codes modified by Kyle</title><link>https://sourceforge.net/p/jackhare/wiki/Sample%2520Codes/</link><description>&lt;pre&gt;--- v14 
+++ v15 
@@ -1,52 +1,58 @@
 Connection String
 ------------------------
 ------------------------
-Because the JackHare incorporates with two datastores, one is target noSQL DB, other is metadata store, so the connection string is a little bit of complicated. let's take look at it !!
-
+Because the JackHare incorporates with two datastores, one is target noSQL DB, another is metadata store, so the connection string is a little bit of complicated. let's take look at it !!
+
 _jdbc:jackhare:\[**noSqlconnectionString**\]:metastore:\[**metaDataStoreConnectionString**\]_
 
 The variables described as follows...
 
 **_noSqlconnectionString_**: the connection string link to the target noSQL DB
 
 **_metaDataStoreConnectionString_**: the connection string link to the metadata store
 
 For example, if the target noSQL DB is HBase, and the metadata store is Derby by default, the connection string would be...
 
-_jdbc:jackhare:hbase://192.168.1.50:metastore:jdbc:derby://localhost/derbyTestDb_
+_jdbc:jackhare:hbase://192.168.1.50?SCHEMA=TEST_SCHEMA&amp;SCHEMA_CREATE=true:metastore:jdbc:derby://localhost/derbyTestDb_
+
+(The properties SCHEMA and SCHEMA_CREATE of metadata store are both optional)
 
 __NOTICE__
 
 The connection strings for both target noSQL DB and metadata store, follow the specifications defined by it's corresponding data store. JackHare just simply redirects the connection string to the corresponding data store server, so you can put any extra-parameters needed for your data store for any purpose :)
 
 Sample Codes
 ------------------------
 ------------------------
 JackHare is JDBC API compliant, which means that your client code only depends on the _java.sql.\*_ and _javax.sql.\*_, so the following operations are the identical JDBC API operations you are already familiar on other RDB products.
 
 
 CREATE CONNECTION
 ------------------------
 You can use two _java.sql.DriverManager.getConnection_ methods to create _java.sql.Connection_.
 
 By default, you can call getConnection method with three arguments, connectionString, userName and password as follows...
 
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 :::java
 Connection conn = null;
 conn = DriverManager.getConnection(CONNECTION_STRING, USER_NAME, PASSWORD);
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-If you want to set more parameters to the target noSQL DB, you can use another method as follows...
+
+If you want to set more parameters to the target noSQL DB, you can use another method as follows...(Using Derby for example)
 
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 :::java
 Connection conn = null;
 Properties props = new Properties();
 props.setProperty("user", USER_NAME);
 props.setProperty("password", PASSWORD);
-//sample for passing noSQL bound parameter
 props.setProperty("hbase.client.scanner.caching", "20000");
+props.setProperty("jackhare.schema", "SCHEMA_NAME");
+props.setProperty("jackhare.metadata.repository.jdbc.derby", "net.jackhare.sql.metadata.derby.DerbyMetaDataRepositoryImpl");
+props.setProperty("jackhare.metadata.driver.jdbc.derby", "org.apache.derby.jdbc.ClientDriver");
+props.setProperty("jackhare.schema.create", "true");
 conn = DriverManager.getConnection(CONNECTION_STRING, props);
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Kyle</dc:creator><pubDate>Thu, 12 Apr 2012 08:14:55 -0000</pubDate><guid>https://sourceforge.net8e177efb2d1a4634ae5037acb6e70a76d55d8f0d</guid></item><item><title>WikiPage Sample Codes modified by takeshi.miao</title><link>https://sourceforge.net/p/jackhare/wiki/Sample%2520Codes/</link><description>&lt;pre&gt;--- v13 
+++ v14 
@@ -158,3 +158,16 @@
 statement = conn.prepareStatement(SQL_ALTER_TABLE);
 statement.executeUpdate();
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+DROP TABLE
+------------------------
+
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+:::java
+private static final String SQL_DROP_TABLE =
+	"DROP TABLE EMPLOYEE ";
+//...
+PreparedStatement statement = null;
+statement = conn.prepareStatement(SQL_DROP_TABLE);
+statement.executeUpdate();
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">takeshi.miao</dc:creator><pubDate>Thu, 19 Jan 2012 02:43:32 -0000</pubDate><guid>https://sourceforge.net9f99a7b3e10107ebd9f4d5971b90e1e894b50faf</guid></item><item><title>WikiPage Sample Codes modified by Dean</title><link>https://sourceforge.net/p/jackhare/wiki/Sample%2520Codes/</link><description>&lt;pre&gt;&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Dean</dc:creator><pubDate>Fri, 13 Jan 2012 07:43:41 -0000</pubDate><guid>https://sourceforge.net2fa13cfa24501a55e37bb408f697219e18649519</guid></item><item><title>WikiPage Sample Codes modified by takeshi.miao</title><link>https://sourceforge.net/p/jackhare/wiki/Sample%2520Codes/</link><description>&lt;pre&gt;--- v11 
+++ v12 
@@ -45,6 +45,7 @@
 Properties props = new Properties();
 props.setProperty("user", USER_NAME);
 props.setProperty("password", PASSWORD);
+//sample for passing noSQL bound parameter
 props.setProperty("hbase.client.scanner.caching", "20000");
 conn = DriverManager.getConnection(CONNECTION_STRING, props);
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">takeshi.miao</dc:creator><pubDate>Thu, 12 Jan 2012 03:36:22 -0000</pubDate><guid>https://sourceforge.net6777be824589f96051440547978f99c6f8ec9c1a</guid></item><item><title>WikiPage Sample Codes modified by takeshi.miao</title><link>https://sourceforge.net/p/jackhare/wiki/Sample%2520Codes/</link><description>&lt;pre&gt;--- v10 
+++ v11 
@@ -32,119 +32,127 @@
 By default, you can call getConnection method with three arguments, connectionString, userName and password as follows...
 
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Connection conn = null;
+:::java
+Connection conn = null;
 conn = DriverManager.getConnection(CONNECTION_STRING, USER_NAME, PASSWORD);
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 If you want to set more parameters to the target noSQL DB, you can use another method as follows...
 
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+:::java
 Connection conn = null;
 Properties props = new Properties();
 props.setProperty("user", USER_NAME);
 props.setProperty("password", PASSWORD);
 props.setProperty("hbase.client.scanner.caching", "20000");
 conn = DriverManager.getConnection(CONNECTION_STRING, props);
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 
 CREATE TABLE
 ------------------------
 
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+:::java
 private static final String SQL_CREATE_TABLE =
 	"CREATE TABLE EMPLOYEE ( " +
 	"	ID INTEGER PRIMARY KEY NOT NULL, " +
 	"	FNAME VARCHAR(50) NOT NULL, " +
 	"	LNAME VARCHAR(50) NOT NULL " +
 	") ";
-...
+//...
 PreparedStatement statement = null;
 statement = conn.prepareStatement(SQL_CREATE_TABLE);
 statement.executeUpdate();
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 INSERT TABLE
 ------------------------
 
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+:::java
 private static final String SQL_INSERT_TABLE =
 	"INSERT INTO EMPLOYEE (ID, FNAME, LNAME) " +
 	"VALUES(?, ?, ?) ";
-...
+//...
 PreparedStatement statement = null;
 statement = conn.prepareStatement(SQL_INSERT_TABLE);
 statement.setLong(1, 1);
 statement.setString(2, "Scott");
 statement.setString(3, "Miao");
 statement.executeUpdate();
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 SELECT TABLE
 ------------------------
 
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+:::java
 private static final String SQL_SELECT_TABLE_ALL =
 	"SELECT ID, FNAME, LNAME FROM EMPLOYEE ";
-...
+//...
 PreparedStatement statement = null;
 ResultSet rs = null;
 //get all records
 statement = conn.prepareStatement(SQL_SELECT_TABLE_ALL);
 rs = statement.executeQuery();
 while(rs.next()) {
 	System.out.println("ROW#" + rs.getLong(1) + ", " + rs.getString(2) + ", " + 
 	rs.getString(3));
 }
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 UPDATE TABLE
 ------------------------
 
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+:::java
 private static final String SQL_UPDATE_TABLE_BY_ID =
 	"UPDATE EMPLOYEE " +
 	"SET FNAME = ?, LNAME = ? " +
 	"WHERE ID = ? ";
-...
+//...
 PreparedStatement statement = null;
 ResultSet rs = null;
 final String CHANGED_FNAME = "AAAA";
 final String CHANGED_LNAME = "BBBB";
 final long ID = 1;
 		
 //execute update
 statement = conn.prepareStatement(SQL_UPDATE_TABLE_BY_ID);
 statement.setString(1, CHANGED_FNAME);
 statement.setString(2, CHANGED_LNAME);
 statement.setLong(3, 1);
 statement.executeUpdate();
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 DELETE TABLE
 ------------------------
 
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+:::java
 private static final String SQL_DELETE_TABLE_BY_ID =
 	"DELETE FROM EMPLOYEE WHERE ID = ? ";
-...
+//...
 PreparedStatement statement = null;
 ResultSet rs = null;
 final long ID = 1;
 //execute delete
 statement = conn.prepareStatement(SQL_DELETE_TABLE_BY_ID);
 statement.setLong(1, ID);
 statement.executeUpdate();
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 ALTER TABLE
 ------------------------
 
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+:::java
 private static final String SQL_ALTER_TABLE =
 	"ALTER TABLE EMPLOYEE " +
 	"ADD COLUMN ADDRESS VARCHAR(50) ";
-...
+//...
 PreparedStatement statement = null;
 statement = conn.prepareStatement(SQL_ALTER_TABLE);
 statement.executeUpdate();
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">takeshi.miao</dc:creator><pubDate>Tue, 03 Jan 2012 08:38:03 -0000</pubDate><guid>https://sourceforge.netae4750184982d23d6b28752b0e0c4faee9ffcf6c</guid></item><item><title>WikiPage Sample Codes modified by takeshi.miao</title><link>https://sourceforge.net/p/jackhare/wiki/Sample%2520Codes/</link><description>&lt;pre&gt;--- v9 
+++ v10 
@@ -136,3 +136,16 @@
 statement.setLong(1, ID);
 statement.executeUpdate();
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ALTER TABLE
+------------------------
+
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+private static final String SQL_ALTER_TABLE =
+	"ALTER TABLE EMPLOYEE " +
+	"ADD COLUMN ADDRESS VARCHAR(50) ";
+...
+PreparedStatement statement = null;
+statement = conn.prepareStatement(SQL_ALTER_TABLE);
+statement.executeUpdate();
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">takeshi.miao</dc:creator><pubDate>Tue, 03 Jan 2012 08:33:42 -0000</pubDate><guid>https://sourceforge.netbbd373e304faf21559674646bb257906bb6d7a46</guid></item><item><title>WikiPage Sample Codes modified by takeshi.miao</title><link>https://sourceforge.net/p/jackhare/wiki/Sample%2520Codes/</link><description>&lt;pre&gt;--- v8 
+++ v9 
@@ -97,3 +97,42 @@
 	rs.getString(3));
 }
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+UPDATE TABLE
+------------------------
+
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+private static final String SQL_UPDATE_TABLE_BY_ID =
+	"UPDATE EMPLOYEE " +
+	"SET FNAME = ?, LNAME = ? " +
+	"WHERE ID = ? ";
+...
+PreparedStatement statement = null;
+ResultSet rs = null;
+final String CHANGED_FNAME = "AAAA";
+final String CHANGED_LNAME = "BBBB";
+final long ID = 1;
+		
+//execute update
+statement = conn.prepareStatement(SQL_UPDATE_TABLE_BY_ID);
+statement.setString(1, CHANGED_FNAME);
+statement.setString(2, CHANGED_LNAME);
+statement.setLong(3, 1);
+statement.executeUpdate();
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+DELETE TABLE
+------------------------
+
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+private static final String SQL_DELETE_TABLE_BY_ID =
+	"DELETE FROM EMPLOYEE WHERE ID = ? ";
+...
+PreparedStatement statement = null;
+ResultSet rs = null;
+final long ID = 1;
+//execute delete
+statement = conn.prepareStatement(SQL_DELETE_TABLE_BY_ID);
+statement.setLong(1, ID);
+statement.executeUpdate();
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">takeshi.miao</dc:creator><pubDate>Tue, 03 Jan 2012 08:31:42 -0000</pubDate><guid>https://sourceforge.netbb56886948d4e2259e00b3f1acd9e424ff983b2d</guid></item></channel></rss>