title: Creating a new local database with Java
body: <p>My aim is to create a local database that can be read and written to with Java. I have some experience with manipulating a local sqlite database with Python, and with interacting with existing networked databases on Microsoft Azure via VB.Net, but the Java formulation for creating a database is escaping me.</p>
  
  <p>Most sources (like the <a href="http://docs.oracle.com/javase/1.4.2/docs/guide/jdbc/getstart/connection.html#996856" rel="nofollow noreferrer">JDBC Docs</a>) seem to assume that you are accessing a database through a network protocol, or a database hosted on localhost. My desired implementation is to create and store the database in a file (or collection of files), so that it can be stored and accessed locally, without network connectivity (presumable through the "file:" protocol).</p>
  
  <p>The <a href="http://docs.oracle.com/javase/tutorial/jdbc/overview/index.html" rel="nofollow noreferrer">JDBC Tutorial</a> looks like it will be very useful once I am up and running, but is currently beyond my scope, since I don't even have an existing database yet.</p>
  
  <p><a href="https://stackoverflow.com/a/6922609/1040915">Many</a> <a href="https://stackoverflow.com/a/6524141/1040915">sources</a> have suggested solutions like H2, MySQL, Derby, or Hypersonic DB. However, I'm loath to install extensions (if that's the right term) for a number of reasons:</p>
  
  <ul>
  <li>This project is initially intended to help me learn my way around Java - widening the scope of the project will dilute my experience with the "base" language and, probably, increase the temptation to engage in "cargo cult programming"</li>
  <li>If this project does ever get distributed to other users (admittedly unlikely, but still!), I don't want to force them into installing more than the core of Java.</li>
  <li>I simply don't know how to install extensions (add-ons? modules?) in Java - one baby-step at a time!</li>
  </ul>
  
  <p>For similar reasons, installing Microsoft SQL Server would not be productive.</p>
  
  <p><a href="https://stackoverflow.com/a/717451/1040915">This</a> answer looks close to what I'm aiming for; however, it gives the error:</p>
  
  <pre><code>java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost/?user=root&amp;password=rootpassword
  </code></pre>
  
  <p>and trying "jdbc:file://targetFile.sql" gives a similar error.</p>
  
  <p>I've seen the term "embedded" database, which I think is a subset of "local database" (i.e. a local database is stored on the same system - an embedded database is a local database that is only used by a single application) - if I've got those definitions wrong, please feel free to correct me!</p>