<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.3" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>DataStax Support Forums &#187; User Favorites: hsliberato</title>
		<link><a href='http://www.datastax.com/support-forums/profile/hsliberato'>hsliberato</a></link>
		<description>Software, Support, and Training for Apache Cassandra</description>
		<language>en-US</language>
		<pubDate>Thu, 20 Jun 2013 00:52:44 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.3</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://www.datastax.com/support-forums/search.php</link>
		</textInput>
		<atom:link href="http://www.datastax.com/support-forums/rss/profile/" rel="self" type="application/rss+xml" />

		<item>
			<title>affy on "Cassandra-JDBC 1.1.2: cannot create KEYSPACE on Cassandra 1.2 using CQL 3 syntax"</title>
			<link>http://www.datastax.com/support-forums/topic/cassandra-jdbc-112-cannot-create-keyspace-on-cassandra-12-using-cql-3-syntax#post-9176</link>
			<pubDate>Wed, 27 Feb 2013 04:05:00 +0000</pubDate>
			<dc:creator>affy</dc:creator>
			<guid isPermaLink="false">9176@http://www.datastax.com/support-forums/</guid>
			<description>&#60;p&#62;I downloaded source files and complied them in IDE, I then used jar command to create the jar file manually. Some other jar files are needed to compile these source files, and fortunately, the project I am working on has all of required jar files included. You likely can find all of dependent jar files from here: &#60;a href=&#34;http://cassandra.apache.org/download/&#34; rel=&#34;nofollow&#34;&#62;http://cassandra.apache.org/download/&#60;/a&#62;.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>hsliberato on "Cassandra-JDBC 1.1.2: cannot create KEYSPACE on Cassandra 1.2 using CQL 3 syntax"</title>
			<link>http://www.datastax.com/support-forums/topic/cassandra-jdbc-112-cannot-create-keyspace-on-cassandra-12-using-cql-3-syntax#post-9079</link>
			<pubDate>Wed, 20 Feb 2013 12:14:43 +0000</pubDate>
			<dc:creator>hsliberato</dc:creator>
			<guid isPermaLink="false">9079@http://www.datastax.com/support-forums/</guid>
			<description>&#60;p&#62;Hi guys, I have the same problem. How can I build a .jar file from this URL?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>affy on "Cassandra-JDBC 1.1.2: cannot create KEYSPACE on Cassandra 1.2 using CQL 3 syntax"</title>
			<link>http://www.datastax.com/support-forums/topic/cassandra-jdbc-112-cannot-create-keyspace-on-cassandra-12-using-cql-3-syntax#post-8963</link>
			<pubDate>Thu, 07 Feb 2013 01:18:29 +0000</pubDate>
			<dc:creator>affy</dc:creator>
			<guid isPermaLink="false">8963@http://www.datastax.com/support-forums/</guid>
			<description>&#60;p&#62;Thanks for helping out.  I built Cassandra-JDBC from the URL mentioned above, and it works with Cassandra 1.2.&#60;/p&#62;
&#60;p&#62;By the way, is there any plan to create a Cassandra-JDBC-1.2.* jar file and make it publicly available?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Julien.Campan on "Cassandra-JDBC 1.1.2: cannot create KEYSPACE on Cassandra 1.2 using CQL 3 syntax"</title>
			<link>http://www.datastax.com/support-forums/topic/cassandra-jdbc-112-cannot-create-keyspace-on-cassandra-12-using-cql-3-syntax#post-8936</link>
			<pubDate>Wed, 06 Feb 2013 08:28:19 +0000</pubDate>
			<dc:creator>Julien.Campan</dc:creator>
			<guid isPermaLink="false">8936@http://www.datastax.com/support-forums/</guid>
			<description>&#60;p&#62;Hello,&#60;br /&#62;
if you want to use Cassandra-JDBC driver with Cassandra 1.2.x , you have to download the trunk version of Cassandra-JDBC. &#60;/p&#62;
&#60;p&#62;You can find it and build it in &#60;a href=&#34;https://code.google.com/a/apache-extras.org/p/cassandra-jdbc/source/browse/?name=trunk#git%2Fsrc%2Fmain&#34; rel=&#34;nofollow&#34;&#62;https://code.google.com/a/apache-extras.org/p/cassandra-jdbc/source/browse/?name=trunk#git%2Fsrc%2Fmain&#60;/a&#62; &#60;/p&#62;
&#60;p&#62;You will have a cassandra-jdbc-1.2.0-SNAPSHOT.jar and this one is compatible with cassandra 1.2.x.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>affy on "Cassandra-JDBC 1.1.2: cannot create KEYSPACE on Cassandra 1.2 using CQL 3 syntax"</title>
			<link>http://www.datastax.com/support-forums/topic/cassandra-jdbc-112-cannot-create-keyspace-on-cassandra-12-using-cql-3-syntax#post-8930</link>
			<pubDate>Wed, 06 Feb 2013 01:46:02 +0000</pubDate>
			<dc:creator>affy</dc:creator>
			<guid isPermaLink="false">8930@http://www.datastax.com/support-forums/</guid>
			<description>&#60;p&#62;I am new to Cassandra. I have a Cassandra 1.2 installed on a Linux box (java 1.6.0_38) which is configured to AllowAllAuthenticator. I also have a Java test program running on a Windows XP box (java 1.6.0_18) which tries to access Cassandra 1.2 using Cassandra-JDBC 1.1.2.&#60;/p&#62;
&#60;p&#62;The Java test program tries to execute two statements using CQL 3 syntax:&#60;br /&#62;
   (1) &#34;CREATE KEYSPACE test_1 WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 3 };&#34;&#60;br /&#62;
   (2) &#34;SELECT keyspace_name, strategy_class FROM system.schema_keyspaces;&#34;;&#60;br /&#62;
Execution of (1) failed and the following exception is thrown:&#60;br /&#62;
   java.sql.SQLSyntaxErrorException: line 1:97 no viable alternative at character '}'&#60;br /&#62;
        at org.apache.cassandra.cql.jdbc.CassandraStatement.doExecute(CassandraStatement.java:179)&#60;br /&#62;
        at org.apache.cassandra.cql.jdbc.CassandraStatement.executeUpdate(CassandraStatement.java:236)&#60;br /&#62;
        at TestCassandraClient.executeDDL(TestCassandraClient.java:70)&#60;br /&#62;
        at TestCassandraClient.main(TestCassandraClient.java:41)&#60;br /&#62;
   Caused by: InvalidRequestException(why:line 1:97 no viable alternative at character '}')&#60;br /&#62;
        at org.apache.cassandra.thrift.Cassandra$execute_cql_query_result.read(Cassandra.java:36625)&#60;br /&#62;
        at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:78)&#60;br /&#62;
        at org.apache.cassandra.thrift.Cassandra$Client.recv_execute_cql_query(Cassandra.java:1525)&#60;br /&#62;
        at org.apache.cassandra.thrift.Cassandra$Client.execute_cql_query(Cassandra.java:1511)&#60;br /&#62;
        at org.apache.cassandra.cql.jdbc.CassandraConnection.execute(CassandraConnection.java:397)&#60;br /&#62;
        at org.apache.cassandra.cql.jdbc.CassandraConnection.execute(CassandraConnection.java:421)&#60;br /&#62;
        at org.apache.cassandra.cql.jdbc.CassandraStatement.doExecute(CassandraStatement.java:161)&#60;br /&#62;
        ... 3 more&#60;br /&#62;
Execution of (2) succeeded.&#60;/p&#62;
&#60;p&#62;The URL used by the test program to create a java.sql.Connection is similar to the one shown below:&#60;br /&#62;
   &#34;jdbc:cassandra://10.168.11.220:9160/system?version=3.0.0&#34;&#60;br /&#62;
The test program is a standalone Java program which only includes cassandra-jdbc-1.1.2.jar and jar files shipped with Cassandra 1.2 in its -classpath.&#60;br /&#62;
The test program is included below FYI.&#60;/p&#62;
&#60;p&#62;I can execute (1) in 'cqlsh' without any problem. After (1) is executed in 'cqlsh', execute the test program again, the newly created test_1 KEYSPACE will be listed by (2) as shown below:&#60;br /&#62;
   ====== List Keyspace ======&#60;br /&#62;
   Result 1: name=[test_1], class=[org.apache.cassandra.locator.SimpleStrategy]&#60;br /&#62;
   Result 2: name=[system_auth], class=[org.apache.cassandra.locator.SimpleStrategy]&#60;br /&#62;
   Result 3: name=[system], class=[org.apache.cassandra.locator.LocalStrategy]&#60;br /&#62;
   Result 4: name=[DEMO], class=[org.apache.cassandra.locator.NetworkTopologyStrategy]&#60;br /&#62;
   Result 5: name=[system_traces], class=[org.apache.cassandra.locator.SimpleStrategy]&#60;br /&#62;
   Total rows retrieved: 5&#60;/p&#62;
&#60;p&#62;In 'cqlsh', after test_1 is created, I do 'DROP KEYSPACE test_1;' followed by 'SELECT * FROM system.schema_keyspaces;', test_1 won't be listed.  However, if I execute the test program again, test_1 is still listed with NULL class, as shown below:&#60;br /&#62;
   ====== List Keyspace ======&#60;br /&#62;
   Result 1: name=[test_1], class=[null]&#60;br /&#62;
   Result 2: name=[system_auth], class=[org.apache.cassandra.locator.SimpleStrategy]&#60;br /&#62;
   Result 3: name=[system], class=[org.apache.cassandra.locator.LocalStrategy]&#60;br /&#62;
   Result 4: name=[DEMO], class=[org.apache.cassandra.locator.NetworkTopologyStrategy]&#60;br /&#62;
   Result 5: name=[system_traces], class=[org.apache.cassandra.locator.SimpleStrategy]&#60;br /&#62;
   Total rows retrieved: 5&#60;/p&#62;
&#60;p&#62;I have two questions and would appreciate if someone can help me out:&#60;br /&#62;
(a) Does Cassandra-JDBC 1.1.2 work with Cassandra 1.2/CQL3?  If it does, why a syntax error exception is thrown when (1) is executed in the test program?&#60;br /&#62;
(b) If Cassandra-JDBC 1.1.2 does work with Cassandra 1.2/CQL3, why test_1 KEYSPACE is still included in the query result returned by (2) after it is dropped by 'cqlsh'?  And, why test_1 is not reported by 'SELECT * FROM system.schema_keyspaces;' when executed in 'cqlsh'?&#60;/p&#62;
&#60;p&#62;Thanks&#60;/p&#62;
&#60;p&#62;&#60;code&#62;&#60;br /&#62;
// ------ Below is the test program FYI ------&#60;/p&#62;
&#60;p&#62;import java.sql.Connection;&#60;br /&#62;
import java.sql.DriverManager;&#60;br /&#62;
import java.sql.ResultSet;&#60;br /&#62;
import java.sql.Statement;&#60;br /&#62;
import java.util.Properties;&#60;br /&#62;
import org.apache.log4j.PropertyConfigurator;&#60;/p&#62;
&#60;p&#62;public class TestCassandraClient&#60;br /&#62;
{&#60;br /&#62;
    public static void main(String[] args) {&#60;br /&#62;
        String host = &#34;10.168.11.220&#34;;&#60;br /&#62;
        String port = &#34;9160&#34;;&#60;br /&#62;
        String keyspace = &#34;system&#34;;&#60;/p&#62;
&#60;p&#62;        for( int i=0; i&#38;lt;args.length; i++ ) {&#60;br /&#62;
            String argument = args[i];&#60;br /&#62;
            if ( argument.equals(&#34;-h&#34;) ) {&#60;br /&#62;
                host = args[++i];&#60;br /&#62;
            } else if ( argument.equals(&#34;-p&#34;) ) {&#60;br /&#62;
                port = args[++i];&#60;br /&#62;
            } else if ( argument.equals(&#34;-k&#34;) ) {&#60;br /&#62;
                keyspace = args[++i];&#60;br /&#62;
            }&#60;br /&#62;
        }&#60;br /&#62;
        String url = &#34;jdbc:cassandra://&#34; + host + &#34;:&#34; + port + &#34;/&#34; + keyspace + &#34;?version=3.0.0&#34;;&#60;br /&#62;
        debug(&#34;URL is being set to [&#34; + url + &#34;]&#34;);&#60;/p&#62;
&#60;p&#62;        initLogger();&#60;/p&#62;
&#60;p&#62;        Connection conn = null;&#60;br /&#62;
        Statement stmt = null;&#60;br /&#62;
        ResultSet rs = null;&#60;br /&#62;
        try {&#60;br /&#62;
            Class.forName(&#34;org.apache.cassandra.cql.jdbc.CassandraDriver&#34;);&#60;br /&#62;
            conn = DriverManager.getConnection(url);&#60;br /&#62;
            debug(&#34;Connection to server established.&#34;);&#60;/p&#62;
&#60;p&#62;            debug(&#34;------ Create Keyspace ------&#34;);&#60;br /&#62;
            String ddl = &#34;CREATE KEYSPACE test_1 WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 3 };&#34;;&#60;br /&#62;
            executeDDL(conn, ddl);&#60;/p&#62;
&#60;p&#62;            debug(&#34;====== List Keyspace ======&#34;);&#60;br /&#62;
            String query = &#34;SELECT keyspace_name, strategy_class FROM system.schema_keyspaces;&#34;;&#60;br /&#62;
            stmt = conn.createStatement();&#60;br /&#62;
            rs = stmt.executeQuery(query);&#60;br /&#62;
            int count = 0;&#60;br /&#62;
            while( rs.next() ) {&#60;br /&#62;
                ++count;&#60;br /&#62;
                String ksName = rs.getString(1);&#60;br /&#62;
                String ksClass = rs.getString(2);&#60;br /&#62;
                debug(&#34;Result &#34; + count + &#34;: name=[&#34; + ksName + &#34;], class=[&#34; + ksClass + &#34;]&#34;);&#60;br /&#62;
            }&#60;br /&#62;
            debug(&#34;Total rows retrieved: &#34; + count);&#60;/p&#62;
&#60;p&#62;        } catch(Exception e) {&#60;br /&#62;
            e.printStackTrace();&#60;br /&#62;
        } finally {&#60;br /&#62;
            close(rs);&#60;br /&#62;
            close(stmt);&#60;br /&#62;
            close(conn);&#60;br /&#62;
        }&#60;br /&#62;
    }&#60;/p&#62;
&#60;p&#62;    private static void executeDDL(Connection conn, String ddl) {&#60;br /&#62;
        Statement stmt = null;&#60;br /&#62;
        try {&#60;br /&#62;
            debug(&#34;Executing DDL: [&#34; + ddl + &#34;]...&#34;);&#60;br /&#62;
            stmt = conn.createStatement();&#60;br /&#62;
            int rowCount = stmt.executeUpdate(ddl);&#60;br /&#62;
            debug(&#34;DDL executed, row count = &#34; + rowCount);&#60;br /&#62;
        } catch(Throwable t) {&#60;br /&#62;
            debug(&#34;Failed to execute DDL:&#34;);&#60;br /&#62;
            t.printStackTrace();&#60;br /&#62;
        } finally {&#60;br /&#62;
            close(stmt);&#60;br /&#62;
        }&#60;br /&#62;
    }&#60;/p&#62;
&#60;p&#62;    private static void close(ResultSet rs) {&#60;br /&#62;
        if ( rs != null ) {&#60;br /&#62;
            try { rs.close(); } catch(Throwable ignore) { }&#60;br /&#62;
        }&#60;br /&#62;
    }&#60;br /&#62;
    private static void close(Statement stmt) {&#60;br /&#62;
        if ( stmt != null ) {&#60;br /&#62;
            try { stmt.close(); } catch(Throwable ignore) { }&#60;br /&#62;
        }&#60;br /&#62;
    }&#60;br /&#62;
    private static void close(Connection conn) {&#60;br /&#62;
        if ( conn != null ) {&#60;br /&#62;
            try { conn.close(); } catch(Throwable ignore) { }&#60;br /&#62;
        }&#60;br /&#62;
    }&#60;/p&#62;
&#60;p&#62;    private static void initLogger() {&#60;br /&#62;
        Properties p = new Properties();&#60;br /&#62;
        p.setProperty(&#34;log4j.rootLogger&#34;, &#34;warn, CONSOLE&#34;);&#60;br /&#62;
        p.setProperty(&#34;log4j.appender.CONSOLE&#34;, &#34;org.apache.log4j.ConsoleAppender&#34;);&#60;br /&#62;
        p.setProperty(&#34;log4j.appender.CONSOLE.layout&#34;, &#34;org.apache.log4j.PatternLayout&#34;);&#60;br /&#62;
        PropertyConfigurator.configure(p);&#60;br /&#62;
    }&#60;/p&#62;
&#60;p&#62;    private static void debug(String msg) {&#60;br /&#62;
        System.out.println(msg);&#60;br /&#62;
    }&#60;br /&#62;
}&#60;br /&#62;
&#60;/code&#62;
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
