wood burning stoves 2.0*
The moose likes JDBC and the fly likes Create a database programmatically? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Create a database programmatically?" Watch "Create a database programmatically?" New topic
Author

Create a database programmatically?

Barry Burd
Author
Ranch Hand

Joined: Jun 18, 2003
Posts: 118
    
    5

Once you've created a database in your native operating system, you can add tables and make other changes with JDBC. But is there a way to create the database itself (other than an in-memory database)? Thanks.


Java For Dummies, 6th Edition, Java Programming for Android Developers For Dummies
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

With postgres, you have a command-line interface (on linux), and can call 'Runtime...' to create a new DB.
But perhaps using ...

will work too.
Did you try something like that?


http://home.arcor.de/hirnstrom/bewerbung
Avi Abrami
Ranch Hand

Joined: Oct 11, 2000
Posts: 1125

Barry,

with JDBC ... is there a way to create the database itself

That depends on the definition of database that your [O|R]DBMS is using. In my experience, working with Informix and Oracle, one does allow it (Informix) while the other does not. This is because Oracle equates a "database" with Informix's notion of an "instance", whereas Oracle's definition of a "schema" is parallel to Informix's idea of a database.
So, in conclusion, it depends on the DBMS you are using. Unfortunately I couldn't find that detail in your post, so I can't really answer your question, can I?
Good Luck,
Avi.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Create a database programmatically?