• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

CRUD and WAR Package with Database

 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

Just a quick quest, when I do WAR package and CRUD, how will I package the Database with it? I am using MYSQL. Can some one give some light on this one?

Thanks,
 
Marshal
Posts: 4491
572
VSCode Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tell us about your CRUD.
 
Vani Jay
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ron McLeod wrote:Tell us about your CRUD.



I am creating the CRUD application in Eclipse and backend is MYSQL. I have created  CRUD application to Add Records, View Records, Edit, Delete , Addrecord - Success and Error pages. So anyone can add edit, delete and view the records.  I am still in the debugging process. Meanwhile, I want to know how I can manage to send all this to someone.

Thanks Ron, hope this explains.
 
Ron McLeod
Marshal
Posts: 4491
572
VSCode Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Vani Jay wrote:I am creating the CRUD application in Eclipse and backend is MYSQL.


I don't know how you can expect anyone to help when the information you provide is so cryptic and vague - not only with this post, but several others.

Please show some effort - explain what you are trying to do, what you did, what you expected, and what your saw.
 
Vani Jay
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ron McLeod wrote:

Vani Jay wrote:I am creating the CRUD application in Eclipse and backend is MYSQL.


I don't know how you can expect anyone to help when the information you provide is so cryptic and vague - not only with this post, but several others.

Please show some effort - explain what you are trying to do, what you did, what you expected, and what your saw.



I am not a Java person and I am trying hard to complete a project given to me for the last one week. I am learning as I am doing the project. I did this application in CRUD which we can enter or add data to the database(MYSQL), delete, edit. I have jsp pages like index, addform, editform, success, error pages, etc. I have made it to work partially but still I am debugging the application. My previous question was when done with the creating an form application and CRUD, how will I package as WAR files including the database or scheme and send it across to the person who requested.
 
Sheriff
Posts: 7125
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you tried Googling how to create war file?  What did you find?  Did it work?  What specific problems are you having?
 
Vani Jay
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Knute Snortum wrote:Have you tried Googling how to create war file?  What did you find?  Did it work?  What specific problems are you having?



Yes I tried creating WAR files from Eclipse- File-Export - WAR and included the source and APache Tomcat. Now I have asked to include the Database Schema and design of database. I would like to know how I will show or package the database.
 
Knute Snortum
Sheriff
Posts: 7125
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would assume just including the database in the project directory would work.  Have you tried that?  Part of your deployment would have to include clearing out test data.  Or what about having the program sense when there's no DB setup and create it from DDL?
 
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You don't "package a database". MySQL/MariaDB is a fully stand-alone product in its own right. The only "package" there is the OS application installation package(s) for the MySQL server, client, and tools.

You do, however, provision a database. That is, you use DDL to define the schema and SQL to pre-load any initial data such as constant lookup tables.

That's outside of Java, however. In fact, when I worked in a more bureaucratic environment, I kept a separate "SQL" directory in my project that the database administrator would pull all the DDL and SQL from and run it, since developers weren't supposed to directly touch production databases. In a shop provisioned via something like Jenkins, I'd expect that the SQL operations could be made part of the Jenkins profile for that project.

Another alternative would be to put "one-shot" code into the web application that would pull the DDL/SQL from a WAR resource file and execute it via brute-force JDBC statements. That's assuming that the required database directives are allowed via JDBC - which isn't true in all DBMS systems.

Still another alternative if you're using an ORM like Hibernate is to set the Hibernate configuration option that will cause Hibernate to build the tables you need. You'll probably have to have the DBA create the database manually first, though. And any data loading code would be manually written.

I don't really like either of the last 2 options, since they make the WAR consume more resources, may require it to have additional database privileges (which could be used as exploits), and provide the potential to damage the database schema, but to each their own.
 
reply
    Bookmark Topic Watch Topic
  • New Topic