Embedded or Network Framework?
I am new to Derby and unable to figure out which framework suits my situation: Embedded or NetworkServer framework. I have a java application (which is a media server, sort of like flash media server, but written all in java), for which I wish to use derby as its database. The app will have say stuff like channels and channel schedules etc... very small database, just one database. Now, on the same machine in the java application I also embed (load) a servlet container (winstone: http://winstone.sourceforge.net/). Later on, I develop web applications where say users can look at the available channels and schedules.. (so the web app needs database interaction). So my question is, what framework needs to be used? will embedded framework suffice because I see only one JVM here? Please advise..
Re: Embedded or Network Framework?
Hi Teja, Based on your description , I think Network Server will be the best solution. I have a java/jsp application which uses Derby and then I'm using a webserver to get the tables/ and rows and I use the networkserver for that application and it works like a charm. Hope this helps you Regards, Manjula On 8/9/07, Teja Palla [EMAIL PROTECTED] wrote: I am new to Derby and unable to figure out which framework suits my situation: Embedded or NetworkServer framework. I have a java application (which is a media server, sort of like flash media server, but written all in java), for which I wish to use derby as its database. The app will have say stuff like channels and channel schedules etc... very small database, just one database. Now, on the same machine in the java application I also embed (load) a servlet container (winstone: http://winstone.sourceforge.net/). Later on, I develop web applications where say users can look at the available channels and schedules.. (so the web app needs database interaction). So my question is, what framework needs to be used? will embedded framework suffice because I see only one JVM here? Please advise.. -- Thanks, Manjula.
Re: Embedded or Network Framework?
Thanks for your reply... In your case, I see only a web server connecting to the database, even if there are multiple web applications, they still go through the web server right, so there is only one JVM and embedded database will suffice??? But in my case, I have a web server and another application both accessing the database. I was leaning towards the network server framework, but I wanted to eliminate the embedded solution. Because eventually, the java app and the web server and derby db are going to be packaged as one. So I don't want to bring network framework in to picture unless it is absolutely necessary. Can someone confirm this: In my java app, on startup or so, I 'load' the embedded derby driver, so the database is ready to be used by the java app. But I also launch the web server (separate thread) through the same app, so the web server is still running in the same JVM(?). And then there is a web app which accesses teh database (through the web server ofcourse (?)). So in my web app database classes, can I just ignore the 'load' driver line.. Class.forName(..); and proceed directly with the embedded connection urls to access the db tables? Note that at any given time, both the web app and java app will be accessing the same database. In such scenario, can someone confirm that there will be no data corruption and Embedded framework will take care of transactional safety and such? Manjula Kutty wrote: Hi Teja, Based on your description , I think Network Server will be the best solution. I have a java/jsp application which uses Derby and then I'm using a webserver to get the tables/ and rows and I use the networkserver for that application and it works like a charm. Hope this helps you Regards, Manjula On 8/9/07, Teja Palla [EMAIL PROTECTED] wrote: I am new to Derby and unable to figure out which framework suits my situation: Embedded or NetworkServer framework. I have a java application (which is a media server, sort of like flash media server, but written all in java), for which I wish to use derby as its database. The app will have say stuff like channels and channel schedules etc... very small database, just one database. Now, on the same machine in the java application I also embed (load) a servlet container (winstone: http://winstone.sourceforge.net/). Later on, I develop web applications where say users can look at the available channels and schedules.. (so the web app needs database interaction). So my question is, what framework needs to be used? will embedded framework suffice because I see only one JVM here? Please advise.. -- Thanks, Manjula. -- View this message in context: http://www.nabble.com/Embedded-or-Network-Framework--tf4242840.html#a12073857 Sent from the Apache Derby Users mailing list archive at Nabble.com.
Re: Embedded or Network Framework?
Teja wrote: Can someone confirm this: In my java app, on startup or so, I 'load' the embedded derby driver, so the database is ready to be used by the java app. But I also launch the web server (separate thread) through the same app, so the web server is still running in the same JVM(?). Yes. And then there is a web app which accesses teh database (through the web server ofcourse (?)). So in my web app database classes, can I just ignore the 'load' driver line.. Class.forName(..); and proceed directly with the embedded connection urls to access the db tables? I would think so, unless there is some complex classloading trickery going on here... Why not just try and see ;) Note that at any given time, both the web app and java app will be accessing the same database. In such scenario, can someone confirm that there will be no data corruption and Embedded framework will take care of transactional safety and such? As long as the DB is accessed from the same JVM, you should be safe from this particular issue. If you are using a relatively new JVM and a relatively new Derby version, I think there are mechanisms in place to prevent you from booting the same DB in more than one JVM at once. On 8/9/07, Teja Palla [EMAIL PROTECTED] wrote: So my question is, what framework needs to be used? will embedded framework suffice because I see only one JVM here? Please advise.. I think embedded will suffice. Also, with embedded you avoid the overhead of sending network traffic back and forth to the database server. If, at a later stage, you find out that you need to connect to the database from multiple JVMs, you can always extend using an embedded server (see [1] for an explanation) instead, or a standalone server for that matter. -- John [1]: http://db.apache.org/derby/papers/DerbyTut/ns_intro.html#Embedded+Server
Re: Embedded or Network Framework?
Ah, you nailed it for me.. so the documentation changed the definition of JVM a bit Thanks a lot. John H. Embretsen-3 wrote: Teja wrote: Thanks Manjula, John and Bryan; Not very clear yet, but in my situation of a web server( strictly, application server) and a java app (actually a media server app.. serves flash video files basically and lots of other functionality) both on the same machine (and hence only one JVM in its normal definition) where java app loads the web server (web server is shutdown when java app shuts down) , so in this situation, I think embedded framework will suffice (as long as the java app 'load's the embedded driver before web server is loaded and none of the web apps try to 'load' the derby embedded driver again.). I think I should be able to simultaneously (from the java app and also from any http requests to the web apps) be able to access/modify same database (will be booted by java app once after the driver is loaded) without any fears of data corruption.. I think one important thing to be aware of here is what the documentation means when it speaks of a JVM. For example, even though you may have only one JDK or JRE installed on your system, you will create a new JVM instance every time you use the java command (the command could be something else, depending on JVM vendor etc.). That is, you start a new Java Virtual Machine (JVM) every time you invoke the Java launcher (e.g. java). The last part of the documentation paragraph you quoted in a previous post describes a scenario where the user's Java application accesses the database from one JVM instance (e.g. java MyApp). Then, if you try to access the database from another JVM (instance), say the ij tool, you may corrupt the database (but you will most likely be stopped (getting an exception with a warning) before it goes that far). In some environments with complex classloading this gets a bit more fuzzy, as Bryan mentioned, since the built-in multi-boot prevention mechanisms may be fooled. However, having multiple concurrent connections to the same database from the same JVM in a pure embedded framework, is safe. In any case you should back up your database regularly, in case something happens. Feel free to ask if you have more questions after your try-outs... -- John -- View this message in context: http://www.nabble.com/Embedded-or-Network-Framework--tf4242840.html#a12077471 Sent from the Apache Derby Users mailing list archive at Nabble.com.
Re: Embedded or Network Framework?
Teja wrote: Ah, you nailed it for me.. so the documentation changed the definition of JVM a bit Thanks a lot. Well, I wouldn't go as far as to say that, but as long as you get the picture, that's great! Keep on coding :) -- John