MemSQL 4.1.7 – ODBC & JDBC Connectivity
Below document describe you on how to Install MemSQL 4.1.7 version and Connectivity test with MySQL JDBC and ODBC Drivers.
Please refer to my previous posts for previous version setup documents for detailed information.
[ root @ dbversity : /memsql/memsql-ops-4.0.31/memsql-ops ] cp /tmp/memsql-ops-4.1.7.tar.gz ../../
[ root @ dbversity : /memsql/memsql-ops-4.0.31/memsql-ops ]
[ root @ dbversity : /memsql/memsql-ops-4.0.31/memsql-ops ]
[ root @ dbversity : /memsql/memsql-ops-4.0.31/memsql-ops ] cd ../..
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ] ll -ltrh
total 958M
drwxr-xr-x 3 attivioid 20 4.0K Jun 29 22:30 memsql-ops-4.0.31
-rw-r–r– 1 root root 149M Jul 30 09:46 memsqlbin_amd64.tar
-rw-r–r– 1 root root 15M Jul 30 09:46 memsql-ops-4.0.31.tar
-rw-r–r– 1 root root 303M Aug 3 02:30 MySQL-5.6.24-1.rhel5.x86_64.rpm-bundle.tar
-rw-r–r– 1 root root 115K Aug 3 03:25 mysql-connector-odbc-5.1.5r1144-7.el6.x86_64.rpm
-rw-r–r– 1 root root 301K Aug 3 03:34 lib64unixODBC2-2.3.2-4.mga5.x86_64.rpm
-rw-r–r– 1 root root 1.4M Aug 3 03:37 glibc-2.14.1-14.12.5.x86_64.rpm
-rw-r–r– 1 root root 4.4M Aug 3 03:42 glibc-2.12-1.149.el6_6.5.i686.rpm
-rw-r–r– 1 root root 457M Aug 3 05:20 memsql_install_packages.tar.gz
-rw-r–r– 1 root root 2.2K Sep 1 05:14 memory_alerts.sh
-rw-r–r– 1 root root 3.8M Sep 1 06:49 mysql-connector-java-5.1.36.tar.gz
drwxr-xr-x 5 root root 4.0K Sep 1 09:33 mysql-connector-java-5.1.36
-rw-r–r– 1 root root 2.4M Sep 1 10:58 mysql-connector-odbc-5.3.4-1.el6.x86_64.rpm
-rw-r–r– 1 root root 8.3M Sep 2 03:36 mysql-connector-java-5.0.8.tar.gz
drwxr-xr-x 5 root root 4.0K Sep 2 03:45 mysql-connector-java-5.0.8
-rw-r–r– 1 root root 16M Oct 1 02:01 memsql-ops-4.1.7.tar.gz
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ] tar -zxvf memsql-ops-4.1.7.tar.gz &
[1] 25273
[ root @ dbversity : /memsql ] memsql-ops-4.1.7/
memsql-ops-4.1.7/install.sh
memsql-ops-4.1.7/memsql-ops/
memsql-ops-4.1.7/README
memsql-ops-4.1.7/memsql-ops/lib/
memsql-ops-4.1.7/memsql-ops/lib/zlib.cpython-34m.so
[1]+ Done tar -zxvf memsql-ops-4.1.7.tar.gz
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ] cd memsql-ops-4.1.7
[ root @ dbversity : /memsql/memsql-ops-4.1.7 ]
[ root @ dbversity : /memsql/memsql-ops-4.1.7 ]
[ root @ dbversity : /memsql/memsql-ops-4.1.7 ]
[ root @ dbversity : /memsql/memsql-ops-4.1.7 ]
[ root @ dbversity : /memsql/memsql-ops-4.1.7 ] ll -lhrt
total 12K
-rw-r–r– 1 attivioid 20 517 Sep 27 16:31 README
-rwxr-xr-x 1 attivioid 20 1.6K Sep 27 16:31 install.sh
drwxr-xr-x 4 attivioid 20 4.0K Oct 1 02:02 memsql-ops
[ root @ dbversity : /memsql/memsql-ops-4.1.7 ]
[ root @ dbversity : /memsql/memsql-ops-4.1.7 ]
[ root @ dbversity : /memsql/memsql-ops-4.1.7 ]
[ root @ dbversity : /memsql/memsql-ops-4.1.7 ]
[ root @ dbversity : /memsql/memsql-ops-4.1.7 ]
[ root @ dbversity : /memsql/memsql-ops-4.1.7 ] ./install.sh
Port 9000 is already bound
[ root @ dbversity : /memsql/memsql-ops-4.1.7 ]
[ root @ dbversity : /memsql/memsql-ops-4.1.7 ] memsql-ops stop
Stopping MemSQL Ops
Waiting up to 60 seconds for a clean exit.
Done.
[ root @ dbversity : /memsql/memsql-ops-4.1.7 ]
[ root @ dbversity : /memsql/memsql-ops-4.1.7 ]
[ root @ dbversity : /memsql/memsql-ops-4.1.7 ] ./install.sh
Installing MemSQL Ops in /var/lib/memsql-ops
/var/lib/memsql-ops already exists and is nonempty
[ root @ dbversity : /memsql/memsql-ops-4.1.7 ]
[ root @ dbversity : /memsql/memsql-ops-4.1.7 ]
[ root @ dbversity : /memsql/memsql-ops-4.1.7 ] rm -rf /var/lib/memsql-ops/*
[ root @ dbversity : /memsql/memsql-ops-4.1.7 ]
[ root @ dbversity : /memsql/memsql-ops-4.1.7 ] ./install.sh
Installing MemSQL Ops in /var/lib/memsql-ops
Creating a memsql user
Setting up permissions
Creating an init script so that MemSQL Ops runs on startup
Creating a symlink to MemSQL Ops at /usr/bin/memsql-ops
Successfully installed MemSQL Ops!
——————————————————————————–
You can install MemSQL across multiple machines
using the MemSQL Ops Web UI.
You can setup, manage and monitor MemSQL with the MemSQL Ops
web UI on port 9000. Make sure that port 9000 is open in your
firewall or security group.
[ root @ dbversity : /memsql/memsql-ops-4.1.7 ]
[ root @ dbversity : /memsql/memsql-ops-4.1.7 ] ps -ef | grep memsql
memsql 8399 1 7 04:34 ? 00:00:01 /var/lib/memsql-ops/lib/memsql-ops start -u memsql –port 9000
root 8514 7356 0 04:34 pts/1 00:00:00 grep memsql
[ root @ dbversity : /memsql/memsql-ops-4.1.7 ]
[ root @ dbversity : /memsql/memsql-ops-4.1.7 ]
[ root @ dbversity : /memsql/memsql-ops-4.1.7 ] cd memsql-ops/
[ root @ dbversity : /memsql/memsql-ops-4.1.7/memsql-ops ]
[ root @ dbversity : /memsql/memsql-ops-4.1.7/memsql-ops ]
[ root @ dbversity : /memsql/memsql-ops-4.1.7/memsql-ops ]
[ root @ dbversity : /memsql/memsql-ops-4.1.7/memsql-ops ] ll -lhtr
total 12K
drwxr-xr-x 6 attivioid 20 4.0K Sep 27 16:31 static
-rwxr-xr-x 1 attivioid 20 245 Sep 27 16:31 memsql-ops
drwxr-xr-x 2 attivioid 20 4.0K Oct 1 02:02 lib
[ root @ dbversity : /memsql/memsql-ops-4.1.7/memsql-ops ]
[ root @ dbversity : /memsql/memsql-ops-4.1.7/memsql-ops ]
[ root @ dbversity : /memsql/memsql-ops-4.1.7/memsql-ops ] memsql-ops status
MemSQL Ops is running with pid 8399 on port 9000.
[ root @ dbversity : /memsql/memsql-ops-4.1.7/memsql-ops ]
[ root @ dbversity : /memsql/memsql-ops-4.1.7/memsql-ops ]
[ root @ dbversity : /memsql/memsql-ops-4.1.7/memsql-ops ] cd ../../
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ] memsql-ops file-add -t memsql memsqlbin_amd64.tar.gz
Adding a MemSQL file
Unpacking archive to determine its version
Copying file into MemSQL Ops data directory
Registering file with MemSQL Ops
Successfully added a MemSQL file with version 4.1.0
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ] ps -ef | grep mysql
root 8831 7356 0 04:35 pts/1 00:00:00 grep mysql
[ root @ dbversity : /memsql ] service mysql stop
ERROR! MySQL server PID file could not be found!
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ] netstat -nlp | grep 3306
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ] memsql-ops status
MemSQL Ops is running with pid 8399 on port 9000.
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ] netstat -nlp | grep memsql
tcp 0 0 0.0.0.0:9000 0.0.0.0:* LISTEN 8399/memsql-ops
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ] netstat -nlp | grep memsql
tcp 0 0 0.0.0.0:9000 0.0.0.0:* LISTEN 8399/memsql-ops
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ] ps -ef | grep memsql
memsql 8399 1 3 04:34 ? 00:00:04 /var/lib/memsql-ops/lib/memsql-ops start -u memsql –port 9000
memsql 9249 1 2 04:36 ? 00:00:00 /var/lib/memsql/master-3306/memsqld –defaults-file=/var/lib/memsql/master-3306/memsql.cnf –pid-file=/var/lib/memsql/master-3306/data/memsqld.pid –user=memsql
memsql 9254 1 2 04:36 ? 00:00:00 /var/lib/memsql/leaf-3307/memsqld –defaults-file=/var/lib/memsql/leaf-3307/memsql.cnf –pid-file=/var/lib/memsql/leaf-3307/data/memsqld.pid –user=memsql
memsql 9256 9254 0 04:36 ? 00:00:00 /var/lib/memsql/leaf-3307/memsqld –defaults-file=/var/lib/memsql/leaf-3307/memsql.cnf –pid-file=/var/lib/memsql/leaf-3307/data/memsqld.pid –user=memsql
memsql 9257 9249 0 04:36 ? 00:00:00 /var/lib/memsql/master-3306/memsqld –defaults-file=/var/lib/memsql/master-3306/memsql.cnf –pid-file=/var/lib/memsql/master-3306/data/memsqld.pid –user=memsql
memsql 9260 9256 0 04:36 ? 00:00:00 bash ./check_system -b -p /var/lib/memsql/leaf-3307/plancache
memsql 9261 9257 0 04:36 ? 00:00:00 bash ./check_system -b -p /var/lib/memsql/master-3306/plancache
memsql 9502 9261 0 04:36 ? 00:00:00 ldconfig -C /var/lib/memsql/master-3306/plancache/ld.so.cache
memsql 9504 9260 0 04:36 ? 00:00:00 ldconfig -C /var/lib/memsql/leaf-3307/plancache/ld.so.cache
root 9557 7356 0 04:36 pts/1 00:00:00 grep memsql
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ] memsql-ops version
Version: 4.1.7
Git SHA: 11a94335ec339333f1b378b360bd81a3ddaa5dd3
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ] mysql -u root -h dbversity -P 3306 –prompt=”memsql> “
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.5.8 MemSQL source distribution (compatible; MySQL Enterprise & MySQL Commercial)
Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
memsql>
memsql> show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| memsql |
| sharding |
+——————–+
3 rows in set (0.00 sec)
memsql>
memsql> select * from information_schema.processlist where info is not null;
+—-+————-+——–+———-+———+——+———–+———————————————————————+———+——————-+—————-+———————-+——-+
| ID | USER | HOST | DB | COMMAND | TIME | STATE | INFO | PLAN_ID | TRANSACTION_STATE | ROW_LOCKS_HELD | PARTITION_LOCKS_HELD | EPOCH |
+—-+————-+——–+———-+———+——+———–+———————————————————————+———+——————-+—————-+———————-+——-+
| 5 | root | :25035 | NULL | Query | 2 | executing | select * from information_schema.processlist where info is not null | 0 | NULL | 0 | 0 | 4093 |
| 3 | distributed | :24267 | sharding | Query | 60 | | MEMSQL REPLICATION START | NULL | NULL | 0 | 0 | NULL |
+—-+————-+——–+———-+———+——+———–+———————————————————————+———+——————-+—————-+———————-+——-+
2 rows in set (2.39 sec)
memsql>
memsql>
memsql> show aggregators;
+———–+——+——–+——————–+——————————+——————-+
| Host | Port | State | Opened_Connections | Average_Roundtrip_Latency_ms | Master_Aggregator |
+———–+——+——–+——————–+——————————+——————-+
| 127.0.0.1 | 3306 | online | 0 | NULL | 1 |
+———–+——+——–+——————–+——————————+——————-+
1 row in set (0.00 sec)
memsql>
memsql> SHOW REPLICATION STATUS;
+——–+———-+———–+—————-+——————————+———–+—————–+————-+—————-+—————+————–+
| Role | Database | MasterURI | MasterPosition | SlaveURI | Connected | NetworkPosition | SlaveState | ReplayPosition | MasterCommits | SlaveCommits |
+——–+———-+———–+—————-+——————————+———–+—————–+————-+—————-+—————+————–+
| master | sharding | NULL | 0:208 | 10.116.161.138:3307/sharding | yes | 0:208 | replicating | 0:208 | 3 | 3 |
+——–+———-+———–+—————-+——————————+———–+—————–+————-+—————-+—————+————–+
1 row in set (0.00 sec)
memsql>
memsql>
memsql>
memsql>
memsql>
memsql> Bye
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ] yum list installed | grep -i mysql
mysql-connector-odbc.x86_64 5.3.4-1.el6 installed
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ] cat /etc/odbcinst.ini
[PostgreSQL]
Description = ODBC for PostgreSQL
Driver = /usr/lib/psqlodbc.so
Setup = /usr/lib/libodbcpsqlS.so
Driver64 = /usr/lib64/psqlodbc.so
Setup64 = /usr/lib64/libodbcpsqlS.so
FileUsage = 1
UsageCount = 5
[MySQL]
Description = MySQL driver for Plesk
Driver = /usr/lib64/libmyodbc5.so
Setup =
FileUsage = 1
Driver64 = /usr/lib64/libmyodbc5.so
Setup64 =
UsageCount = 5
[MySQL ODBC 5.3 Unicode Driver]
Driver = /usr/lib64/libmyodbc5w.so
UsageCount = 5
[MySQL ODBC 5.3 ANSI Driver]
Driver = /usr/lib64/libmyodbc5a.so
UsageCount = 5
[ root @ dbversity : /memsql ] odbcinst -i -s -l -f /etc/odbc.ini
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ] cat cat /etc/odbc.ini
cat: cat: No such file or directory
[mysqldsn]
Driver = /usr/lib64/libmyodbc5w.so
SERVER = dbversity
PORT = 3306
DATABASE = jdbc_db
OPTION = 3
USER = myusr
PASSWORD = mypwd
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ] odbcinst -s q
odbcinst: Invalid Action for Object
**********************************************
* unixODBC – odbcinst *
**********************************************
* *
* Purpose: *
* *
* An ODBC Installer and Uninstaller. *
* Updates system files, and *
* increases/decreases usage counts but *
* does not actually copy or remove any *
* files. *
* *
* Syntax: *
* *
* odbcinst Action Object Options *
* *
* Action: *
* *
* -i install *
* -u uninstall *
* -q query *
* -j print config info *
* -c call SQLCreateDataSource *
* -m call SQLManageDataSources *
* –version version *
* *
* Object: *
* *
* -d driver *
* -s data source *
* *
* Options: *
* *
* -f file name of template.ini follows *
* this (valid for -i) *
* -r get template.ini from stdin, not *
* a template file *
* -n Driver or Data Source Name follows *
* -v turn verbose off (no info, warning *
* or error msgs) *
* -l system dsn *
* -h user dsn *
* *
* Returns: *
* *
* 0 Success *
* !0 Failed *
* *
* Please visit; *
* *
* http://www.unixodbc.org *
* pharvey@codebydesign.com *
**********************************************
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ] odbcinst -i -d -f /etc/odbcinst.ini
odbcinst: Driver installed. Usage count increased to 6.
Target directory is /etc
odbcinst: Driver installed. Usage count increased to 6.
Target directory is /etc
odbcinst: Driver installed. Usage count increased to 6.
Target directory is /etc
odbcinst: Driver installed. Usage count increased to 6.
Target directory is /etc
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ] ln -s /usr/lib64/libmyodbc5w.so /usr/lib64/libmyodbc5.so
ln: creating symbolic link `/usr/lib64/libmyodbc5.so’: File exists
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ] mysql -u root -h dbversity -P 3306 –prompt=”memsql> “
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MySQL connection id is 28
Server version: 5.5.8 MemSQL source distribution (compatible; MySQL Enterprise & MySQL Commercial)
Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
memsql>
memsql> create database jdbc_db;
Query OK, 1 row affected (0.98 sec)
memsql>
memsql>
memsql> grant all privileges on jdbc_db.* to myusr@’%’ identified by ‘mypwd’ ;
ERROR 1727 (HY000): Feature ‘Adding database-level or table-level grants’ is only available in MemSQL Enterprise Edition. Only grants of the form “GRANT ALL ON *.* TO ‘<user>’@'<hostname>’ IDENTIFIED BY ‘<password>'” are supported. Please see http://docs.memsql.com/4.1/editions or email support@memsql.com.
memsql>
memsql>
memsql> grant all privileges on *.* to myusr@’%’ identified by ‘mypwd’ ;
Query OK, 0 rows affected (0.11 sec)
memsql>
memsql>
memsql> show grants for ‘myusr’@’%’;
+—————————————————————————————————————+
| Grants for myusr@% |
+—————————————————————————————————————+
| GRANT ALL PRIVILEGES ON *.* TO ‘myusr’@’%’ IDENTIFIED BY PASSWORD ‘*6F1F0C7FA57187E0D959C29F4BC7F826ED5A9169’ |
+—————————————————————————————————————+
1 row in set (0.00 sec)
memsql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
memsql>
memsql>
memsql> use jdbc_db
Database changed
memsql> create table mytbl (id int, name varchar(20), primary key(id));
Query OK, 0 rows affected (9.08 sec)
memsql>
memsql>
memsql> insert into mytbl (id,name) values (1,’jdbc driver test’);
Query OK, 1 row affected (1.34 sec)
memsql> insert into mytbl (id,name) values (2,’jdbc driver success’);
Query OK, 1 row affected (0.00 sec)
memsql> insert into mytbl (id,name) values (3,’jdbc connectivity’);
Query OK, 1 row affected (0.00 sec)
memsql>
memsql>
memsql> select * from mytbl;
+—-+———————+
| id | name |
+—-+———————+
| 1 | jdbc driver test |
| 3 | jdbc connectivity |
| 2 | jdbc driver success |
+—-+———————+
3 rows in set (2.85 sec)
memsql> Bye
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ] which java
/memsql/mysql-connector-java-5.1.36/jdk1.8.0_05/bin/java
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ] ll -lhrt mysql-connector-java-5.1.36/mysql-connector-java-5.1.36-bin.jar
-rw-r–r– 1 root root 950K Jun 19 15:26 mysql-connector-java-5.1.36/mysql-connector-java-5.1.36-bin.jar
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ] env | grep CLASSPATH
CLASSPATH=/memsql/mysql-connector-java-5.1.36/mysql-connector-java-5.1.35-bin.jar
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ]
ODBC Connectivity Test
[ root @ dbversity : /memsql ] isql -v mysqldsn
+—————————————+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+—————————————+
SQL> show tables;
+———————-+
| Tables_in_jdbc_db |
+———————-+
| mytbl |
+———————-+
SQLRowCount returns 1
SQL> select * from mytbl;
+———–+———————+
| id | name |
+———–+———————+
| 1 | jdbc driver test |
| 3 | jdbc connectivity |
| 2 | jdbc driver success |
+———–+———————+
SQLRowCount returns 3
3 rows fetched
SQL>
[ root @ dbversity : /memsql ]
[ root @ dbversity : /memsql ]
JDBC Connectivity Test
[ root @ dbversity : /memsql/mysql-connector-java-5.1.36 ] cat DBDemo.java
import java.sql.*;
import java.util.Properties;
public class DBDemo
{
private static final String dbClassName = “com.mysql.jdbc.Driver”;
private static final String CONNECTION = “jdbc:mysql://dbversity/memsql”;
public static void main(String[] args) throws
ClassNotFoundException,SQLException
{
System.out.println(dbClassName);
Class.forName(dbClassName);
Properties p = new Properties();
p.put(“user”,”myusr”);
p.put(“password”,”mypwd”);
Connection c = DriverManager.getConnection(CONNECTION,p);
System.out.println(“It works !”);
String url = “jdbc:mysql://dbversity:3306/memsql”;
String username = “myusr”;
String password = “mypwd”;
System.out.println(“Connecting to database …”);
try (Connection connection = DriverManager.getConnection(url, username, password)) {
System.out.println(“Database connected!”);
} catch (SQLException e) {
throw new IllegalStateException(“Cannot connect the database!”, e);
}
Connection connection = null;
try {
connection = DriverManager.getConnection(“jdbc:mysql://dbversity:3306”, “myusr”, “mypwd”);
Statement stmt = connection.createStatement();
stmt.execute(“DROP DATABASE IF EXISTS jdbc_db”);
stmt.execute(“CREATE DATABASE jdbc_db”);
stmt.execute(“use jdbc_db”);
stmt.execute(“CREATE TABLE tbl(id INT PRIMARY KEY AUTO_INCREMENT, name VARCHAR(50) NOT NULL)”);
stmt.execute(“INSERT INTO tbl (name) VALUES (‘My First Insert with JDBC Connector’), (‘You are successful with connection’)”);
ResultSet rs1 = stmt.executeQuery(“SELECT * FROM tbl”);
while (rs1.next())
{
System.out.println(“((‘” + rs1.getInt(“id”) + “‘, ‘” + rs1.getString(“name”) + “‘),)”);
}
} catch (SQLException e) {
System.out.println(“Failed to make JDBC Connection with your MemSQL!”);
e.printStackTrace();
return;
}
connection.close();
c.close();
}
}
[ root @ dbversity : /memsql/mysql-connector-java-5.1.36 ]
[ root @ dbversity : /memsql/mysql-connector-java-5.1.36 ]
[ root @ dbversity : /memsql/mysql-connector-java-5.1.36 ] javac DBDemo.java
root @ dbversity : /memsql/mysql-connector-java-5.1.36 ] javac DBDemo.java
[ root @ dbversity : /memsql/mysql-connector-java-5.1.36 ] java -cp .:/memsql/mysql-connector-java-5.0.8/mysql-connector-java-5.0.8-bin.jar DBDemo
com.mysql.jdbc.Driver
It works !
Connecting to database …
Database connected!
((‘1’, ‘My First Insert with JDBC Connector’),)
((‘2’, ‘You are successful with connection’),)
[ root @ dbversity : /memsql/mysql-connector-java-5.1.36 ]
[ root @ dbversity : /memsql/mysql-connector-java-5.1.36 ]
[ root @ dbversity : /memsql/mysql-connector-java-5.1.36 ]
[ root @ dbversity : /memsql/mysql-connector-java-5.1.36 ]
[ root @ dbversity : /memsql/mysql-connector-java-5.1.36 ]
[ root @ dbversity : /memsql/mysql-connector-java-5.1.36 ]
[ root @ dbversity : /memsql/mysql-connector-java-5.1.36 ] java -cp .:/memsql/mysql-connector-java-5.1.36/mysql-connector-java-5.1.36-bin.jar DBDemo
com.mysql.jdbc.Driver
It works !
Connecting to database …
Database connected!
((‘2’, ‘You are successful with connection’),)
((‘1’, ‘My First Insert with JDBC Connector’),)
[ root @ dbversity : /memsql/mysql-connector-java-5.1.36 ]
JDBC 5.08 works fine with both MemSQL 4.0 & 4.1
JDBC 5.1.36 works only with 4.1.x
ODBC 5.3.4 works fine with MemSQL 4.0 & 4.1
MemSQL requires :
memsql-ops-4.1.7.tar.gz (From http://www.memsql.com/download/ )
memsqlbin_amd64.tar.gz (Latest from http://download.memsql.com/releases/latest/memsqlbin_amd64.tar.gz )
Any latest MySQL Client (MySQL-5.6.24-1.rhel5.x86_64.rpm-bundle.tar)
JDBC Driver requires :
mysql-connector-java-5.1.36.tar.gz ( From http://dev.mysql.com/downloads/connector/j/)
jdk-8u5-linux-x64.gz
ODBC Driver requires :
mysql-connector-odbc-5.3.4-1.el6.x86_64.rpm
unixODBC-2.2.14-14.el6.x86_64.rpm