Usage Guide: Virtuoso JDBC Driver for operating on data using SQL or SPARQL

Posed the following question to myself:

How do you install and use the Virtuoso JDBC Driver, bearing in mind the sophisticated data access it offers to JDBC-compliant applications?

Here is the reply I constructed and have decided to share with the public via this post:

Note the JDBC Driver Name if your are familiar with the JDBC Driver Manager: virtuoso.jdbc4.Driver .

Explore the Virtuoso 8.2 Release description page and then follow-your-nose to information about the Virtuoso JDBC Drivers.

Alternatively, you can follow either of the paths provided below.

Installer Archives

  1. Download Virtuoso Server + Client Connectivity Bundle or Client Connectivity Only Installer for Windows, Linux, or macOS
  2. Obtain Free Evaluation License if you are connecting to an Virtuoso 8.2 Commercial Edition Server for Linux, macOS, or Windows
  3. Run the Installer
  4. Perform post-installation steps
  5. Download JDBC Demo Applications ZIP Archive
  6. Read guidelines outlined in this Sample JDBC Applications Document

JAR File

  1. Download this JAR file, courtesy of the Virtuoso JDBC 4.1 Driver JAR Archive Description Document
  2. Perform post-installation steps
  3. Download JDBC Demo Applications ZIP Archive
  4. Read guidelines outlined in this Sample JDBC Applications Document

Running Sample JDBC Application using the following command from your operating system’s command-line interface, once you situate yourself in the folder into which the contents JDBC demo application’s zip archive have been extracted:

Basic

java -cp .:./virtjdbc4.jar JDBCDemo

or simply

java  JDBCDemo

SSL/TLS

java -cp .:./virtjdbc4_2ssl.jar JDBCDemo

To ensure you have some sample data in place for SQL interactions please install at least one of the following VAD packages via Viruoso’s HTML-based Admin UI (a/k/a “The Conductor”) or its command-line ISQL interface :

  1. Demo Database VAD
  2. Schools Database VAD.

For SPARQL interactions, you can use Virtuoso’s SPASQL (SQL extended using SPARQL) Language to issue the following Federated SPARQL Query against the publicly accessible DBpedia SPARQL Query Service endpoint:

SPARQL
SELECT DISTINCT *
WHERE { 
          SERVICE <http://dbpedia.org/sparql>      
		       {
			    SELECT * 
				WHERE {
						?webid  a foaf:Person;
	                    foaf:name ?name .
	                    FILTER (isIRI(?webid))
	                    FILTER (?name != '')
	                    FILTER (! contains(str(?webid),"uriburner"))
	                    FILTER (! contains(str(?webid),"mates"))
	                    FILTER (! contains(str(?webid),"urn:"))
					 }
				 LIMIT  100
              }
			}

Related

  1. Medium hosted Blog Post about our LOD Connectivity Licenses that provide ODBC and/or JDBC access to the LOD Cloud
  2. ODBC C++ Demo Application
1 Like