peter brews

Greenhorn
+ Follow
since Feb 11, 2002
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by peter brews

Hi
Can anyone of you help me with the source code for this recursion problem, I will truely appreciate this has been haunting me for some days now.
The problem is, I have 2 fields
Node_id ParentNode
B A
C A
D B
E B
F B
G C
H E
I E
And the list could go on indefinitely. What I want is the output which accepts a Parent_nod (Example A) and lists all the children
{B,C,D,E,F,G,H,I) preferable output will be (B,D,E,H,I,F,C,G List a parent and the childs of that parents)
I know I can solve this with a recursive function but an stuck now
Please help
21 years ago
I have developed CMPS and need to update the row in the database. I know the ejbStore method can be used for it but do not know how to code it.
does anyone have an example code of just the client, remote interface and the Bean implementing the row updation that would greatly help. I have searched on the internet and could not find anything. Please help
We have a application running on Weblogic. We have developed a Java class which gets a connection from the connection pool and have methods to get Statemet Objects on the connection. from the client code example: JSP we instansiate this class to get the Connection object and the Statement object and execute queries.
There seems to be a potential problem in the sense that there is Statment Contention. Exampele : 2 Statement Objects A & B are getting executed Statment B completes its operations but A is still open when we call the closeStatement method on Statement object B it seems to be closing Statemnt A which causes a lot of problems.

Could you please advice
We have a application running on Weblogic. We have developed a Java class which gets a connection from the connection pool and have methods to get Statemet Objects on the connection. from the client code example: JSP we instansiate this class to get the Connection object and the Statement object and execute queries.
There seems to be a potential problem in the sense that there is Statment Contention. Exampele : 2 Statement Objects A & B are getting executed Statment B completes its operations but A is still open when we call the closeStatement method on Statement object B it seems to be closing Statemnt A which causes a lot of problems.

Could you please advice
22 years ago
I am developing a Jsp application where in I have links to open Word .doc files. The problem is the entire URL of the doc file with the directory structure on the server (physical location of the file on the unix server) is displyed on the browser when the users click the hyperlink.
I do not want to display the file location on the browser. Is there a way to do this.
example: filename /home/Directory/Dir1/test.doc
/home/Directory is mapped as the root directory on the web server.
When the user clicks this link he sees
http://localhost:<port>/Dir1/test.doc
I want to hide the /Dir1/test.doc portion of the URL.
Thanks, Pete
22 years ago
JSP
Hi
i have a servlet which reads an excel file and converts it to a vector. after thar i insert the elements of vector into a Oracle table one at a time. If the file is small no problem. But when the file grows i get errors "ORA-01000 maximum open cursor limit exceeded".
1. In the loop of the Vector I have closed all the Statement, PreparedStatement objects so that Oracle cursors associated with it closes.
2. After the Loop I am closing the Connection (using weblogic Connection pool). I cannot close the connection in the loop because I will have to get the connection back in the loop which is very heavy.
My question is even though I am closing all the statemets, preparedstatmets objects inside the loop (which is associated with one insert) why do the cursors associated with them do not get released. In monitoring Oracle i could clearly see that the number of cursors are rising up and they never get released even if the statement objct is closed. i do not want to increase the Parameter in ora.int to bump up the number of cursors. i could use batchUpdate but I have to do some database validations before every insert which cannot be done in the batchUpdate
Any suggestions
22 years ago
Hi
I have a way of saving the output generated from a JSp file into to a excel file by modifiying the Headers. The code looks like this
String fname=abc.xls
response.setContentType("file_content_type);
response.setHeader("Content-disposition","attachment;filename="+fname)
The output is saved to a Excel file abc.xls
IT THERE A WAY TO SAVE THE OUTPUT IN DIFFERENT TABS IN THE EXCEL FILE.
For example : Output1 - to be saved in abx.xls on excel tab TAB1
Output2 - to be saved in abc.xls on excel tab TAB2
and so on
Please help me
22 years ago
JSP
We have a situation where we have to make recursive calls on a function. Here is the scenario
getMgrLvl( parameteres..........)
Resultset myResultset=null;
Open DB connection
get Resultset
while resultset.next() {
getMgrLvl
}
This code works fine but the problem as you see is it opens up lot of connections to the database beucase the same function is called and it opens up a connection. The code is modified to

Open up DB connectio
getMgrLvl( parameteres..........)
Resultset myResultset=null;
get Resultset
while resultset.next() {
getMgrLvl
}
this opens up the connection only once. But we get an errors Resultset already closed JZ0R0, beucase I think that the first result set is still open while the next result is initialised which in turn closes the first resultset. If there is only one row in the first result set this is fine but for multiple rows this seems to be a problem.
can u suggest any other way
has any body tried to set connection pool using Oracle thin driver.What should be the setting for classpath,path etc.. to do so.

Thanks a lot
pete
22 years ago
Sorry i had not visited this site since a couple of weeks.
Definea method in the bean
and try using following code.this works for me.
PrintWriter pw=new PrintWriter(new BufferedWriter(new FileWriter(new File("mytext.txt"))));

pete
Hi
I have tp save the JSP output to a file. I have set the header to response.setContentType(application/ms-excel). I get a dialog box for the output. Save/Open when I hit Open it opens up the output in Excel. But when I click Save it asks me for a file name and the name it displays in a .jsp file and the user manually have to change the name to .xls file while saving.
IS there a way where If I click save instead of the .jsp as the filename it is displayed as a .xls file in the file dialogue box.
Thanks
22 years ago
JSP
Hi Jessica,
I would also like to know if there is any similar solution possible for EJB's. I have methods defined in EJB and after caching the exception i just need to show the users a generic error message instead of the actual one.
Thanks,
pete
22 years ago
Thank you all for your helpful replies.I code that i had mentioned i in my EJB actually works on my local machine ,but not sure if it will work when multiple users from diffrent systems will call that method.
1. I also wanted to know if the restriction is for security reasons only.
2. Will it be better if i put all this code in seperate java class and call that class in EJB.Does method should be static .If not ,how do i instantiate a class in EJB.
for eg.
I would write a class UtilityMethods.java an will define methods in that say writeData.
Then i will call this method as UtilityMethods.writeData and i will pass the data as string parameter to this method.
3.In most of other mymethods that were defined in EJB i am using url connection to pass and get information .Will there be any problem with that too?
4.Where can i get more details about EJB's.

Thanks,
pete
I am new to ejb and I came to know that usage of the java.io package is forbidden in the spec but in my method implemented in ejb bean i need to write to a external file.And a shell script is then executed which reads this file and does furhter processing.Is there some other way to achive this result ans will there be problems if I use the following code.Any suggestion in this matter is highly apprecaited. Following is the piece of code.. from my method <html> <body>


try
{
PrintWriter pw=new PrintWriter(new BufferedWriter(new FileWriter(new File("c:\\testdata.txt"))));
pw.print("aaaaaa");
pw.print("bbbbbbbbbbbbbbbb");
pw.prnt(name);
pw.print(seqid);
pw.close();
}
catch(IOException e)
{
e.getMessage();
}
and then i am using following piece of code to run shell script from that method in ejb
try
{
String command = "sh /export/home//submitData.sh " + currentfile ;
Process p = Runtime.getRuntime().exec(command);
}
catch(Exception e)
{}

</body> </html> Thanks, peter
thanks for your reply.
on my system it is taking 250-350 milliseconds. I am thinking of using string manipulation t convert the date in desired format.But having difficulty with having easy of converting char to int.
22 years ago