mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
remove hdriver
This commit is contained in:
@@ -1,44 +0,0 @@
|
||||
package com.alibaba.druid.hbase;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.Properties;
|
||||
|
||||
import com.alibaba.druid.hdriver.HDriver;
|
||||
import com.alibaba.druid.util.JdbcUtils;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
|
||||
public class HBQLShowTableTest extends TestCase {
|
||||
public void test_select_0 () throws Exception {
|
||||
HDriver driver = new HDriver();
|
||||
Connection conn = driver.connect("jdbc:druid-hbase:10.20.153.63", new Properties());
|
||||
|
||||
PreparedStatement stmt = conn.prepareStatement("SHOW TABLES");
|
||||
stmt.setInt(1, 6);
|
||||
|
||||
ResultSet rs = stmt.executeQuery();
|
||||
JdbcUtils.printResultSet(rs);
|
||||
// while (rs.next()) {
|
||||
// System.out.print(rs.getString("name"));
|
||||
// System.out.print(' ');
|
||||
// System.out.print(rs.getString("owner"));
|
||||
// System.out.print(' ');
|
||||
// System.out.print(rs.getString("familys"));
|
||||
// System.out.print(' ');
|
||||
// System.out.print(rs.getLong("maxFileSize"));
|
||||
// System.out.print(' ');
|
||||
// System.out.print(rs.getLong("memStoreFlushSize"));
|
||||
// System.out.print(' ');
|
||||
// System.out.print(rs.getString("regionSplitPolicyClassName"));
|
||||
// System.out.print(' ');
|
||||
// System.out.println();
|
||||
// }
|
||||
rs.close();
|
||||
stmt.close();
|
||||
|
||||
conn.close();
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
package com.alibaba.druid.hbase;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.hbase.client.HTable;
|
||||
import org.apache.hadoop.hbase.client.Put;
|
||||
import org.apache.hadoop.hbase.util.Bytes;
|
||||
|
||||
public class HBaseConnectTest extends TestCase {
|
||||
|
||||
public void test_connection() throws Exception {
|
||||
Configuration config = new Configuration();//HBaseConfiguration.create();
|
||||
// config.set("dfs.support.append", "true");
|
||||
// config.set("hbase.rootdir", "hdfs://10.20.153.63:9000/hbase");
|
||||
// config.set("hbase.cluster.distributed", "true");
|
||||
// config.set("hbase.master", "10.20.153.63:60000");
|
||||
config.set("hbase.zookeeper.quorum", "10.20.153.63");
|
||||
// config.set("zookeeper.session.timeout", "30000");
|
||||
// config.set("hbase.regionserver.handler.count", "100");
|
||||
// config.set("hbase.client.keyvalue.maxsize", "67108864");
|
||||
|
||||
// config = HBaseConfiguration.create();
|
||||
|
||||
HTable table = new HTable(config, "test");
|
||||
|
||||
Put put = new Put(Bytes.toBytes("1001"));
|
||||
put.add(Bytes.toBytes("d"), Bytes.toBytes("id"), Bytes.toBytes("x1001"));
|
||||
|
||||
table.put(put);
|
||||
|
||||
table.close();
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package com.alibaba.druid.hbase;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.util.Properties;
|
||||
|
||||
import com.alibaba.druid.hdriver.HDriver;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class HBaseDriverInsertTest extends TestCase {
|
||||
|
||||
public void test_select_0() throws Exception {
|
||||
HDriver driver = new HDriver();
|
||||
Connection conn = driver.connect("jdbc:druid-hbase:10.20.153.63", new Properties());
|
||||
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
PreparedStatement stmt = conn.prepareStatement("INSERT INTO test_user (id, name, gender, salary) VALUES (?, ?, ?, ?)");
|
||||
stmt.setInt(1, i);
|
||||
stmt.setString(2, "user-" + i);
|
||||
stmt.setString(3, "M");
|
||||
stmt.setBigDecimal(4, new BigDecimal((i + 1) * 1000));
|
||||
|
||||
stmt.execute();
|
||||
|
||||
stmt.close();
|
||||
}
|
||||
|
||||
conn.close();
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package com.alibaba.druid.hbase;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.Properties;
|
||||
|
||||
import com.alibaba.druid.hdriver.HDriver;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
|
||||
public class HBaseDriverTest extends TestCase {
|
||||
public void test_select_0 () throws Exception {
|
||||
HDriver driver = new HDriver();
|
||||
Connection conn = driver.connect("jdbc:druid-hbase:10.20.153.63", new Properties());
|
||||
|
||||
PreparedStatement stmt = conn.prepareStatement("SELECT id, name, gender, salary FROM test_user where id >= 3 and id <= ?");
|
||||
stmt.setInt(1, 6);
|
||||
|
||||
ResultSet rs = stmt.executeQuery();
|
||||
while (rs.next()) {
|
||||
System.out.print(rs.getInt("id"));
|
||||
System.out.print(' ');
|
||||
System.out.print(rs.getString("name"));
|
||||
System.out.print(' ');
|
||||
System.out.print(rs.getString("gender"));
|
||||
System.out.print(' ');
|
||||
System.out.print(rs.getBigDecimal("salary"));
|
||||
System.out.println();
|
||||
}
|
||||
rs.close();
|
||||
stmt.close();
|
||||
|
||||
conn.close();
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package com.alibaba.druid.hbase;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.Properties;
|
||||
|
||||
import com.alibaba.druid.hdriver.HDriver;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
|
||||
public class HBaseDriverTest_getIndex extends TestCase {
|
||||
public void test_select_0 () throws Exception {
|
||||
HDriver driver = new HDriver();
|
||||
Connection conn = driver.connect("jdbc:druid-hbase:10.20.153.63", new Properties());
|
||||
|
||||
PreparedStatement stmt = conn.prepareStatement("SELECT id, name, gender, salary FROM test_user where id >= 3 and id <= ?");
|
||||
stmt.setInt(1, 6);
|
||||
|
||||
ResultSet rs = stmt.executeQuery();
|
||||
while (rs.next()) {
|
||||
System.out.print(rs.getInt(1));
|
||||
System.out.print(' ');
|
||||
System.out.print(rs.getString(2));
|
||||
System.out.print(' ');
|
||||
System.out.print(rs.getString(3));
|
||||
System.out.print(' ');
|
||||
System.out.print(rs.getBigDecimal(4));
|
||||
System.out.println();
|
||||
}
|
||||
rs.close();
|
||||
stmt.close();
|
||||
|
||||
conn.close();
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package com.alibaba.druid.hbase;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.Properties;
|
||||
|
||||
import com.alibaba.druid.hdriver.HDriver;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
|
||||
public class HBaseDriverTest_getIndex_or extends TestCase {
|
||||
public void test_select_0 () throws Exception {
|
||||
HDriver driver = new HDriver();
|
||||
Connection conn = driver.connect("jdbc:druid-hbase:10.20.153.63", new Properties());
|
||||
|
||||
PreparedStatement stmt = conn.prepareStatement("SELECT id, name, gender, salary FROM test_user where id = 3 or id = ? or name = 'user-4'");
|
||||
stmt.setInt(1, 6);
|
||||
|
||||
ResultSet rs = stmt.executeQuery();
|
||||
while (rs.next()) {
|
||||
System.out.print(rs.getInt(1));
|
||||
System.out.print(' ');
|
||||
System.out.print(rs.getString(2));
|
||||
System.out.print(' ');
|
||||
System.out.print(rs.getString(3));
|
||||
System.out.print(' ');
|
||||
System.out.print(rs.getBigDecimal(4));
|
||||
System.out.println();
|
||||
}
|
||||
rs.close();
|
||||
stmt.close();
|
||||
|
||||
conn.close();
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package com.alibaba.druid.hbase;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.Properties;
|
||||
|
||||
import com.alibaba.druid.hdriver.HDriver;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
|
||||
public class HBaseDriverTest_notRowFilter extends TestCase {
|
||||
public void test_select_0 () throws Exception {
|
||||
HDriver driver = new HDriver();
|
||||
Connection conn = driver.connect("jdbc:druid-hbase:10.20.153.63", new Properties());
|
||||
|
||||
PreparedStatement stmt = conn.prepareStatement("SELECT id, name, gender, salary FROM test_user where name <= ?");
|
||||
stmt.setString(1, "user-5");
|
||||
|
||||
ResultSet rs = stmt.executeQuery();
|
||||
while (rs.next()) {
|
||||
System.out.print(rs.getInt("id"));
|
||||
System.out.print(' ');
|
||||
System.out.print(rs.getString("name"));
|
||||
System.out.print(' ');
|
||||
System.out.print(rs.getString("gender"));
|
||||
System.out.print(' ');
|
||||
System.out.print(rs.getBigDecimal("salary"));
|
||||
System.out.println();
|
||||
}
|
||||
rs.close();
|
||||
stmt.close();
|
||||
|
||||
conn.close();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user