vendredi 5 juillet 2019

Create a database model from SQLite DB

If you want to create a DBModel from an existing SQLite database here is how to proceed...

1) Download the ".jar" file containing the SQLite JDBC driver
from https://bitbucket.org/xerial/sqlite-jdbc/downloads/


2) Put the ".jar" file in "TelosysTools/lib"


3) Configure the JDBC connection in the "databases.dbcfg" file
  • With Telosys-CLI use the "edb" command or edit the file with any text editor
  • With Telosys Eclipse Plugin open it with the specialized editor
 Here's a configuration example :

 <db id = "1"
    name     = "SQLiteDB"
    driver   = "org.sqlite.JDBC"
    url      = "jdbc:sqlite:D:/mypath/database.sqlite"
    typeName = "SQLLITE"
    dialect  = "org.hibernate.dialect.SQLiteDialect"
    isolationLevel = ""
    poolSize       = "10" >
       <property name="user"      value="" />
       <property name="password"  value="" />
       <metadata catalog="" schema=""
            table-name-pattern="%" table-types="TABLE  VIEW  "
            table-name-exclude=""  table-name-include=""  />
  </db>


In "url" parameter replace "D:/mypath/database.sqlite" by your database file path

4) Test the connection
With Telosys-CLI you can use the following "Check DataBase" commands :
  > cdb     ( check the connection )
  > cdb -i  ( check the connection and get database information )
  > cdb -t  ( check the connection and get database tables )
  > cdb -c  ( check the connection and get database colomns )
 ( enter "? cdb" for all options )
With Telosys Eclipse Plugin use the GUI (tabs "Information", "Meta-data", buttons "Get tables", "Get columns", etc)

5) If the connection is OK you can create the database model
With Telosys-CLI  run the "New Db Model" command
  > ndbm
With Telosys Eclipse Plugin use the GUI

Info : with SQLite DB only the tables and columns are retrieved (the model created doesn't contain Primary Keys and Foreign Keys)

Aucun commentaire:

Enregistrer un commentaire