Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!

Tony Docherty

+ Follow
since Aug 07, 2007
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 Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Tony Docherty

No it's not a valid solution.

available() returns the number of bytes that can be read without blocking. If it returns 0 it does not mean the end of the stream has been reached it just means there are currently no more bytes available to read. This could be due to i/o delays, network delays etc.

Using available() in this way may appear to work every time when the file is stored locally but there are no guarantees. In short it's extremely bad practice to do this.
2 weeks ago
All classes have an equals() method but the String class also has an equalsIgnoreCase() method which is useful when you want to compare strings for equality ignoring the case of the letters.
3 weeks ago
Is there a specific reason you need to know this?
One of the good things about Java is all memory allocations are handled for you and for 99.999% of cases you don't need to worry (or even know) where variables are stored. And no there are no special instructions relating to their storage.
3 weeks ago

Caiz Austin wrote:
At the moment I would create a Briefcase class and initialise 26 Briefcases as an array setting each individual briefcase a value e.g. briefcase[0] = 0.50; briefcase[1] = 1.

That's not implementing a Briefcase class, that's having a float (or double) array called briefcase.
If you do implement a Briefcase class it can have properties such as value, opened etc. You could then have an array of type Briefcase which you filled with Briefcase instances ie briefcase[0] = new Briefcase(0.5, false);
3 weeks ago
Ok so now you know the code works it's just the connection details to the university DB that you need to sort out.
1 month ago

Ray Bell wrote:I meant a different forum on coderanch..

OK, please can you provide a link to the other thread so we are not repeating ourselves.
1 month ago
The code in Oracle_select3 has different connection details to the code in Oracle_select4 so when you checked the details as per your earlier post were you checking the details in Oracle_select3 or in Oracle_select4?
1 month ago

Ray Bell wrote:I checked the connection in tnsnames.ora as suggested in a similar discussion. It seems to match.

What do you mean by in a similar discussion - have you posted this question on other site(s)? We don't mind if you cross post but as we all give up our time here for free we would rather not waste it answering a question that has already been answered elsewhere, so please let us know where else it is posted so we can check on what answers have already been given.

And what does "it seems to match" mean - You can either establish a connection or you can't. Have you physically established a connection or are you just looking at the logon data in the code and checking it looks the same as the data you have been given.
1 month ago
No that's still the stack trace for Oracle_select3
1 month ago
The stack trace posted is not from running the code you have posted. The stack trace is from running a class called Oracle_select3 but the code is Oracle_select4. Please can you provide the correct code or stack trace.

The error message is "The Network Adapter could not establish the connection" so I'd start by checking the values you have passed to the getConnection(..) method.

Have you tried to establish a connection to the database from your machine using another application such as Toad to check the DB is available and the credentials are correct.
1 month ago
The cellIndex variable is always 0 so it writes everything into column A.

For the same reason that Dave suggested you use createRow(currentRow.getRowNum()), when creating the cell, you should do something like createCell(currentRow.getColumnNum()) - I say something like because I'm away from my development environment so have guessed the name of the method for getting the column number.
1 month ago
I don't understand why you think it will copy all the tabs. If you create a new workbook (see the link I gave previously) it will be empty.

Sorry I don't have time at the moment to write code showing how to do it.
1 month ago
Sure, but if you want to copy the data and formatting into a new excel file you have to use POI to create a new excel workbook etc to copy the data and formatting into.
1 month ago
If you want to put the data into another excel workbook then you need to create a new workbook, a new sheet and populate the appropriate cells with the data. You may also need to copy over the formatting of each cell if you want that to be the same (it been a long time since I used POI and I can't remember if there is a way of copying the data and formatting at the same time).

For information on how to do all this read the help files found at
1 month ago
Because when bytes are used in arithmetic they are automatically converted to ints so the result of a + b is an int.
1 month ago