CrazyEngineers
  • Executing java file from DB

    ankur8819

    Member

    Updated: Oct 18, 2024
    Views: 1.0K
    Hi everyone,
    I am not sure how logical my question is but it struck me so here I am.
    For a application whose logic changes frequently, the problem with keeping the application up becomes a problem as there have to be a lot of deployments to keep the logic up to date.
    Is it possible to store a Java file into DB and then at create its class at runtime and have it run on the Application Server.
    I think we can store --> retrive---> and make an object of class at run time using normal sql queries and Reflections in Java but I am not sure how will it will behave when it runs on the App Server.
    Anyone implemented such case.??
    If yes ,is it advisable to go via this approach.What could be the pros and cons .
    Thanks ,
    Ankur
    0
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Replies
  • sookie

    MemberJan 23, 2012

    Hi ankur,

    I liked the idea..very useful where applications take lot of time to start. But I couldn't get one thing if you want to save .class file or .java file to save the time.

    I guess this is achievable, I haven't given a try but you can save the file as CLOB data type in database and change the deployment script/build script where you mention your .java/.class files path, you need to work hard bit on this thing. Retrieving the file from DB at run time or whatever is the requirement. Let us know if any issues.
    Are you sure? This action cannot be undone.
    Cancel
  • Anoop Kumar

    MemberJan 23, 2012

    when you are running a web/application server . server builds whole application that means server context is aware of every class file/file with compile timestamp before starting a application.you are asking for storing .class file in database retrieve it --> save in build path --> and use a reflections.
    I think it's not going to work.
    for try : configure a web project with tomcat and run it , As soon as you save the any java file context will be reloaded.
    On the other way you can store logic in database or properties files.
    If you elaborate you problem we can try some solution.😀
    Are you sure? This action cannot be undone.
    Cancel
  • PraveenKumar Purushothaman

    MemberJan 23, 2012

    I guess storing the scripts inside database and executing them is not a good idea. In that case, you go into a issue of executing a vulnerable script from the database and there might be loop holes and possiblities are that your script and databases might be misused or compromised.
    Are you sure? This action cannot be undone.
    Cancel
  • K!r@nS!ngu

    MemberJan 23, 2012

    ankur8819
    Is it possible to store a Java file into DB and then at create its class at runtime and have it run on the Application Server.
    I am not sure whether it is possible or not but i admire you for the creative idea. I guess we can store Java files but running it should be done after retrieving it to the separate folder from DB.

    Anyways let me give a try...
    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register