<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question JDBC Connection to phoenix failed in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/JDBC-Connection-to-phoenix-failed/m-p/232767#M194602</link>
    <description>&lt;P&gt;I have tried the below sample code from Phoenix website by copying the phoenix client jar from /usr/hdp/current/phoenix-client in my server. I tried running it locally as well as on the server, but i keep getting the below error:&lt;/P&gt;&lt;P&gt;Exception in thread "main" java.sql.SQLException: No suitable driver found for jdbc:phoenix:zk1,zk2,zk3:2181:/hbase-unsecure&lt;/P&gt;&lt;P&gt;Are there any other prerequisites other than including the client jar in the code to connect to phoenix? &lt;/P&gt;&lt;P&gt;PS: I had no problems connecting to phoenix from command line.&lt;/P&gt;&lt;PRE&gt;import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.PreparedStatement;
import java.sql.Statement;

public class test {

	public static void main(String[] args) throws SQLException {
		Statement stmt = null;
		ResultSet rset = null;
		
		Connection con = DriverManager.getConnection("jdbc:phoenix:zk1,zk2,zk3:2181:/hbase-unsecure");
		stmt = con.createStatement();
		
		stmt.executeUpdate("create table test (mykey integer not null primary key, mycolumn varchar)");
		stmt.executeUpdate("upsert into test values (1,'Hello')");
		stmt.executeUpdate("upsert into test values (2,'World!')");
		con.commit();
		
		PreparedStatement statement = con.prepareStatement("select * from test");
		rset = statement.executeQuery();
		while (rset.next()) {
			System.out.println(rset.getString("mycolumn"));
		}
		statement.close();
		con.close();
	}
}&lt;/PRE&gt;</description>
    <pubDate>Tue, 22 Aug 2017 23:01:50 GMT</pubDate>
    <dc:creator>arohit91</dc:creator>
    <dc:date>2017-08-22T23:01:50Z</dc:date>
  </channel>
</rss>

