mahavir swami

Greenhorn
+ Follow
since Sep 18, 2009
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by mahavir swami

i was using jdk1.5 for development and was trying to read a zip file with size more than 2GB
and while searching on google i got this bug in jdk1.5 here
this bug is fixed in jdk 1.6 i guess, though i have not tried reading zip files more than 2GB in jdk 1.6
14 years ago
i get this exception

every time i do new ZipFile("filename"); for file with size = 3GB+
i tried with file with size of 100MB it worked properly

how do solve this , please help
14 years ago


so this will convert your zip entry into byte array

now you want this byte array gain to be written in zip so

14 years ago
I have zip file with size above 3GB

and i have an method that will accept file name as argument and return the file from the zip as byte array



for some file i get this exception


i searched on google but could not find proper solution
can you please help
14 years ago
when we try to read blob data from an oracle db using jdbc connection
like




now suppose the blob data is having size more than 80MB , i mean its large data, then how does
jdbc code in oracle driver class interacts with data base to read such large data from db?
I moved my properties file at the level where META-INF folder is there in jar file and
my code worked, i mean ClassLoader could find the file there
but if i want the file to be any where on the machine and the path will be set in classpath
then how do we achive that?
14 years ago
I am using eclipse ide for my java projects
and in eclipse there is an option to export the project as a runnable jar file
and it creates MINIFEST.MF file which has all the information about the main method and other jar's used by the code

and in my code i am using


now when i run my code using eclipse , it finds abc.properties file
but when i am running through command prompt
java -jar <jar-file-name> args




returns null

now i believe there is some class path problem
i have set the classpath in my environmental variables but still cannot find above file from class path

please help

14 years ago


here i have just created a ZipOutputStream and then closed it without writing any file , and then while closing it
i get an exception saying zipfile must have atleast one entry.
now why is it like this?
and if file does not get closed then what happens to the outputstream reference ?
14 years ago
Is there a time limit between consecutive connection,
i mean if you connect to a db , using DriverManager.getConnection
and then you close the connection and then reconnect again ,
and this process you repeat many times, is there some minimum time you have
to wait before you can reconnect
actually i am reading from istream

and then from stream i am reading into buffer
and then writing the buffer in to outputStream

but you are rite, i should have used getBytes from blob and then write the
binary array on ouputStream


thanks a lot James!


14 years ago
exactly

there was one file , size was really big
it was 74673925 when i debug on blob.length()

so it breaking on new byte[74673925]

so you cannot create a new byte array with size 74673925??

14 years ago
i have made one swing application where i make a connection to Oracle database and then read
some 2000+ blob values and write it on different files on my hard-disk

now while the code is reading the blob data and then writing the blob data on the the file
, after some transaction i get this exception



the algorithm goes this way
(1)Take the db details and database table from where the blob has to be read from user(user enters the data in JTextFeild)
(2)Validate above information for blank or null values
(3)If validation is successful then move ahead.
(4)pass the validated information to a class ConnectionHelper , this class basically has api's to connect to database and then read
blob from db and write it in file.
(5) code to obtain connection is :

here oracle_connection is a static object of type Connection in ConnectionHelper class and dbDetails is a DTO which contains all database information.
(6)Code that reads Blob and writes in to file :

(7)Above method reads Blob data from db against an id which is passed as an argument,
then it will take the connection , now if connection is null or it is closed new connection will be passed
otherwise the existing connectin is returned (i believe i have messed up here!)
(8)and this method is called for more than 2000 times, and after a while when many files are written successfully i get the above
OutOfMemoryException.

please help

14 years ago
suppose we have a connection class ConnectionHelper, it contains methods for obtaining a connection and closing a connection


now we have method where connection from above class is used


now my question is when we say
getConnection of ConnectionHelper will be called,
now the drivermanager in connectionHelper will create a connection with db and the object that represents the
connection is stored at memory location say 0x1234
and the object "con1" of connectionHelper points to that location 0x1234
now in method userConnection()

hence con has a reference to con1 which actully refers to 0x1234 where actual connection information is stored.


now after closing the connection by calling


if we call userConnection() again
then since con1 is closed, it will create a new connection.
now this connection object must be somewhere in JVM heap memory , but this time when new object is created
will it again be created at same memory location or different???
if its stored at different location then what about the connection information at 0x1234?
and if every time new memory is used to store objects , won't the Heap memory get overflow?