User`s guide
SQLite JDBC for Linux
2-167
SQLite JDBC for Linux
This tutorial shows how to set up a data source and connect to your SQLite database.
This tutorial uses the SQLite JDBC 3.7.2 Driver to connect to the SQLite Version 3.7.17
database.
In this section...
“Step 1. Verify the driver installation.” on page 2-167
“Step 2. Add the JDBC driver to the MATLAB static Java class path.” on page 2-167
“Step 3. Set up the data source using Database Explorer.” on page 2-168
“Step 4. Connect using Database Explorer or the command line.” on page 2-170
Step 1. Verify the driver installation.
If the JDBC driver for SQLite is not installed on your computer, find the link on the
Driver Installation page to install the driver. Follow the instructions to download and
install this driver on your computer.
Step 2. Add the JDBC driver to the MATLAB static Java class path.
1
Run the prefdir command in the Command Window. The output is a file path to a
folder on your computer.
2
Close MATLAB if it is running.
3
Navigate to the folder and create a file called javaclasspath.txt in the folder.
4
Open javaclasspath.txt. Add the full path to the database driver JAR file in
javaclasspath.txt. The full path includes the path to the folder where you
downloaded the JAR file from the database provider and the JAR file name. For
example, /home/user/DB_Drivers/sqlite-jdbc-3.7.2.jar. Save and close
javaclasspath.txt.
5
Restart MATLAB.
Alternatively, you can use javaaddpath to add your JDBC driver to the dynamic Java
class path. For details about static and dynamic class paths, see “Bringing Java Classes
into MATLAB Workspace”.