I have a hive sever running on default port 10000 started via: hive --service hiveserver
I then have java program (the tutorial!) using the Hive JDBC Client connect to it using:
Connection con = DriverManager.getConnection("jdbc:hive://localhost:10000/default", "", "");
The tutorial runs and it creates a table testhivedrivertable on the default database and describes it. This works fine and my hive service logs a bunch of stuff.
I then try to bring up a shell to the same DB via hive -p 10000 which gets me a shell however I cannot see the table created by the java program (and nor can the java program see tables created when I am in the shell). Also, nothing shows in the console when I run commands in the hive shell so I am pretty sure I am talking to a different hive instance.
How can I have the hive shell interact with the same database the java JDBC driver is?!
You are talking to the same Hive instance; not the same metastore, unfortunately.
Hive metastore is a database that stores metadata about your Hive tables (eg. table name, column names and types, table location, storage handler being used, number of buckets in the table, sorting columns if any, partition columns if any, etc.). When you create a table, this metastore gets updated with the information related to the new table which gets queried when you issue queries on that table.
However, one of the important considerations of the founders of Hive was to make it easy to run it out of the box. This drove them to the decision of using an embedded Derby database as the metastore by default. This requires no set up but the side effect is that the scope of the database is within a single CLI invocation or a single JDBC client context. Therefore, Hive metadata is not persisted across multiple invocations of a client or across clients. This is what you are witnessing.
You should migrate to using a standalone metastore which will persist the data across multiple Hive clients. MySQL and PostGres are popular options. Cloudera has a good article on configuring Hive and MySQL to use a MySQL metastore. It’s available here.