[JBoss-user] [Datasource Configuration] - Re: please help me out!!! connection error

2004-02-25 Thread triathlon98
Unfortunately, this code does not give me much clues about what is going wrong. 
However, the code can definately be improved a lot.

- The pstmt should be prepared outside the loop. The ide about prepared statements is 
to prepare them once, then reuse them. Your code is a prefect example, but doesn't use 
the trick. You should see a speed improvement because of this.

- you have a finally block which closes the pstmt and the connection. Good. But then 
you should not close them beforehand. You are goind to close them twice.

Next question is how you get your connection? You call a helper method, but that code 
is not shown.

Joachim

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3822978#3822978

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3822978


---
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [Datasource Configuration] - Re: please help me out!!! connection error

2004-02-25 Thread pbk97030
This is part of my source code.
Please check my code out and reply to me.

Especially, the error is occurred in the following code.
pstmt = conn.prepareStatement ( SQL_SELECT_STATUS_DESC );

Thank you in advance
-
try
{
conn = getConnection ( );
log.info("DB Connection:" + conn);
//log.info(conn.isClosed());

for(int i = 0; i< listOfLoanNumber.size();i++){
log.info("inside the loop");
pstmt = conn.prepareStatement ( SQL_SELECT_STATUS_DESC ); 
   
pstmt.setString ( 1, (String)listOfLoanNumber.elementAt(i) );
rs = pstmt.executeQuery();
if(rs.next()){
OrderBean orbean = new OrderBean();
orbean.setOrderNumber(rs.getString(1));
orbean.setLoanNumber((String)listOfLoanNumber.elementAt(i));
orbean.setOrderStatus(rs.getString(2));
orbean.setComment(rs.getString(3));
listOfStatus.add(orbean);
} else {
OrderBean orbean = new OrderBean();
orbean.setLoanNumber((String)listOfLoanNumber.elementAt(i));
orbean.setOrderStatus("");
orbean.setComment("");
listOfStatus.add(orbean);
}   
rs.close(); 
pstmt.close();
}
conn.close ( );
}
catch ( NamingException e )
{
throw new EJBException ( e.toString() );
}
catch ( SQLException e )
{
throw new SQLException ( e.toString() );
} 
   finally 
  {
 try{
if(pstmt!= null) pstmt.close();
if(rs   != null) rs.close();
if(conn != null) conn.close();
 }  catch(SQLException e){
log.error("SQL Exception in " + this.getClass().getName(), e);
 }
  
   }


View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3822918#3822918

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3822918


---
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [Datasource Configuration] - Re: please help me out!!! connection error

2004-02-25 Thread triathlon98
"pbk97030" wrote : This program is stateless sesstion bean.

Are you keeping your connection open? If that is the case, you cannot be using a SLSB, 
as the connection is "state"...

In the other case, better to post your code if you can. You might be doing something 
wrong in the JDBC stuff.

Joachim

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3822913#3822913

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3822913


---
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [Datasource Configuration] - Re: please help me out!!! connection error

2004-02-25 Thread pbk97030
Than you for your explanation.

This program is stateless sesstion bean.
Could you tell me what I shoud do?

Thank you in advance.

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3822899#3822899

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3822899


---
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [Datasource Configuration] - Re: please help me out!!! connection error

2004-02-25 Thread triathlon98
Is this a stateful session bean with the connection staying alive across invocations?

In that case, check your logs. The connecton was probably closed by JBoss already. 
This can be modified in transaction-service.xml

Joachim

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3822896#3822896

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3822896


---
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user