Vaibhav Gargs

Ranch Hand
+ Follow
since Sep 08, 2016
Vaibhav likes ...
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Vaibhav Gargs

I have some queries for JDBC:

1. We create JDBC connections in java applications. What is basically JDBC connection? Is it a dedicated link between app and db servers or what else?

2. How does it differ from database connections provided by Oracle?

3. What all information does it have in jdbc connection?

4. We perfer to have connection pooling, how does it improve the performance?
2 months ago
Thank you Campbell. Just to add, by dependencies i mean the jar files.
5 months ago
I have certain queries regarding compile time and runtime dependencies. I understand that compile time dependencies are required to compile the code and runtime while executing the code.

1. Would we need all compile time dependencies at run time?

2. In what cases, Runtime dependencies are required? How it would be possible to have additional dependencies at runtime which were not required at compile time?

3.  If the code is compiled successfully, then, why do we need those dependencies at run time?
5 months ago
Hi Ron, We need to build jar as well as war from same source code. Jar file is used to run on Unix as a java process - some schedularsetc. without any UI. and war is used to run as a web application having UI and backend.

Source code is in folder structure as:


So, jar should contain only proj/web/java class files and war shouldcontain all the files. And, i have given only one example folder we have around 30 such folders. SO, how to create 30 jars for classes and one war containing all java classes and jsp, css etc.
8 months ago
We have to build a war and a jar from the same source codebase. The structure of the codebase is :

web/src/com/.... - contains java files
web/jsp - contains jsp files
web/css - contains css files
web/js - contains js files

we have to use maven for building the code. I understand the jar file can be created using exclude files. But, how to create the war file containing all the files. Using POM, we can create only single artifact.

Also, we have multiple projects say 10 projects which will generate 10 jars and a single war containing all jars with all jsps, css, js files.

How to achieve this using maven build?
8 months ago
Suppose we have maven as build tool. And, there are around 50 projects which generates their jars and then embedded in a single jar/war file to be deployed. Now, if I need to do the build everytime locally will it build all jars from scratch even if there are no changes? What is the process? And, do we need to version these jars as well though they are not final artifact?
8 months ago
Thank you all for your responses. So, if we declare -Xmx 512m then actual java runtime can have more memory than this limit due to other memory areas, correct?

But heap memory max size would be 512m which is defined by -Xmx, right?

In case we have RAM only 256MB, and if we declare -Xmx 512m, then what would happen?
9 months ago
Suppose we have a main class with main method. Then, which class loader will be used to load this class? Will it be bootstrap or application class loader?

And, how can we check the order of class loaded in memory along with class loader details?
9 months ago
Suppose we provide -Xms 512m -Xmx 1024m, then, I understand that this allocates memory to heap area.

How much total memory will be allocated to java process? Will it be in this range or it will be higher since we have other memory areas such as stack, pcr, and needs memory for execution engine, class loaders etc.
9 months ago
IN our project, currently we are having some properties which are placed on classpath and loaded in static blocks. All the properties are loaded in static block. Now, we have to move some of the properties to the Database so that they can be easily controlled and managed through DB. Now I have following queries:

1. Can we create a properties file again reading the data from DB?

2. Data we read from DB should be available in all classes as the case with props files. How can we implement this requirement?
11 months ago
Thank you Campbell and Paul. I have modified the code to create object but still it doesn't show any difference in memory before and after creating objects:

1 year ago
I have written below piece of code to check the memory usage but there is no difference in the memory after creating the objects. Why this is so?

Output is :


I am creating multiple objects, so, should it decrease the free memory available? What is the reason for this behaviour?
1 year ago
Thank you Stephan. In case, one user sorts based on name, other sorts based on age, and one sorts based on id; then will we sort based on all these different criteria on DB side every time?
1 year ago
Suppose we have an employee database consisting of 10000 records. And, there are REST APIs exposed which return the records in a batch of 500 to the front end and front end will provide the pagination to scroll across those records. Now, if there is a need to implement sorting based on fields individually such as name, id, age etc., then where that sorting will happen - front end or back end? What will be the best design to address this.
1 year ago
Is it safe to say that for same operations, streams will always have better performance compared to collections? Can you please share your experiences regarding this.
1 year ago