Search code examples
javadatabasejdeveloper

Connect to sql file from jdev


How can I connect to a database through JDeveloper via an SQL file? I mean not by writting String url = "jdbc:oracle:thin:@localhost:1521:ORCL"; for example but putting the database file inside my project and connect to the file.


Solution

  • Oracle is not that portable to be embeddable into a JAR file... Zou could have Oracle XE distributed with your application, but that needs installation too... And it is HUGE.

    I'd suggest using H2DB.

    • it is fully Java
    • it creates the DB files quick and easy, thez can be included with the app files if zou want
    • performance is OK - not an Oracle RAC cluster, but it is not meant to be
    • can also work as in memory DB too

    Using H2DB is as easy as including in Maven dependencz, and setting up the connection string properly... Downside is that as far as I know, SQL developer does not support H2DB.

    I had success with using Apache Derby similarly, to the extent of some tutorial-level experiment in the past.