2

My definition of portable is:

When I export my JAVA program to a jar file, others(who use my jar) don't need to install anything except JRE; that is, a portable JAVA SQL package is a jar file and users can use it like a normal package and don't need to install anything else.

Is SQLite for JAVA "portable"? If not, any SQL package is "portable"? Or there is no such SQL package and users must install some SQL environment?

===========

I think I need a jar file(just a jar package!don't need anything installment!) that accepts SQL statements like creating tables. My java program is so small so I don't want to install a big big big SQL environment like MySQL. Just need some basic functions of SQL, like creating tables and querying.

Jean Y.C. Yang
  • 4,382
  • 4
  • 18
  • 27
  • If I understand you, you want/need a java library which interacts with SQL database engine without having to install the database engine? – Luiggi Mendoza Sep 06 '14 at 15:16
  • 3
    Yes, SQLite is portable (for all systems in which an appropriate DLL/library has been built) in that it *does not require any installation*. There are also *pure Java* embedded databases like H2 SQL and Derby. – user2864740 Sep 06 '14 at 15:16
  • 4
    So you are looking for an embedded DB for Java? http://stackoverflow.com/q/462923/507519 – thkala Sep 06 '14 at 15:17
  • @LuiggiMendoza maybe "it has its own database inside" will be a better description – Jean Y.C. Yang Sep 06 '14 at 15:18
  • @user2864740 thank you, i thought you get my point... my English is not so good – Jean Y.C. Yang Sep 06 '14 at 15:20
  • AFAIK those are different stuff. I don't know such jar which also contains its database engine installed as well. And it shouldn't be that way either because the jar must have a single responsibility: implement JDBC interfaces to allow communication with the desired database engine. – Luiggi Mendoza Sep 06 '14 at 15:20
  • @thkala thanks, i'm browsing it! – Jean Y.C. Yang Sep 06 '14 at 15:20
  • I think I need a jar file(just a jar package!don't need anything installment!) that accepts SQL statements like creating tables. That is what I mean. – Jean Y.C. Yang Sep 06 '14 at 15:23
  • I think you just need an embedded DB; there will still be required jars, obviously, but users won't have to install "the database" themselves. – Dave Newton Sep 06 '14 at 15:30

1 Answers1

0

There are some embeded database that can be implemented in the memory.The popular there are : HSQL,H2 and Derby. (all are similar with mysql)

You can write the "create table.." to build the schema in a sql file, and the app load it and create the database. Of course, you also have to add the sql driver in advance.

But after the app finishes, the data cannot be maintained.

chenzhongpu
  • 6,193
  • 8
  • 41
  • 79