jeudi 23 avril 2015

Cannot create sqlite database in Java

I am trying to create a sqlite database in Java, I have been given the following code:

    import java.sql.*;

    public class Database 
    {

        public static void main(String[] args) 
        {
            Connection dbConnection = null;

            try
            {
                dbConnection = DriverManager.getConnection("jdbc.sqlite:test.db");
            } catch (Exception ex)
            {
                System.err.println( ex.getClass().getName() + ": " + ex.getMessage() );

            } //End try catch block

        } //End main method

    } //End Database class

However, when I run the program it gives me the error "java.sql.SQLException: invalid database address: jdbc.sqlite:test.db"

I am using a MAC and have read/write permissions for the system. Why am I getting this error?

Aucun commentaire:

Enregistrer un commentaire