Re: [JBoss-user] SQLJ in EJB connecting to Oracle
On Thu, Oct 25, 2001 at 02:54:34PM +0200, Jose Ramon Diaz wrote: > Hi, > > I don´t know if now there is someone (Toby, are you?)using SQLJ I don't currently have such a combination running. The project I was woking on that was using SQLJ is on hold at the moment. > inside an EJB with JBoss. we had in production an EJB with SQLJ > (stateless, making INSERTS, DELETES and UPDATES). We are using > JBoss 2.2.1, and now we have moved it to JDBC. We had a memory > problem (there are another reasinos for the moving...). JBoss was > gettitng more and more memory, until the system gets collapsed. > > We don´t know why. Any idea? You need to describe the problem in more detail. You can get information about what is using up the heap from a profiler like JProbe or OptimizeIt or using the JVM's built-in profiling. > Another question is that it seems that the sentences are making > deadlocks in Oracle Database. If the database table is only > accessed from the EJB, why does it happen? Aren´t all the SQL > serialized? Again, you need to provide some more detail. What are you doing, exactly, and what is happening, exactly? Toby. ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
Re: [JBoss-user] SQLJ in EJB connecting to Oracle
Hi, I don´t know if now there is someone (Toby, are you?)using SQLJ inside an EJB with JBoss. we had in production an EJB with SQLJ (stateless, making INSERTS, DELETES and UPDATES). We are using JBoss 2.2.1, and now we have moved it to JDBC. We had a memory problem (there are another reasinos for the moving...). JBoss was gettitng more and more memory, until the system gets collapsed. We don´t know why. Any idea? Another question is that it seems that the sentences are making deadlocks in Oracle Database. If the database table is only accessed from the EJB, why does it happen? Aren´t all the SQL serialized? Thanks! Jose R. Toby Allsopp wrote: > On Wed, Apr 18, 2001 at 09:40:51AM +0200, Jose Ramon Diaz wrote: > > Hi Toby! > > > >Thanks a lot! You were right... > > Excellent. I'm responsible for adding some SQLJ to the product at work, so > I'm glad to see it working for other people. > > > If anybody is interested the code looks like: > > > > DataSource ds = (DataSource) ctx.lookup("java:/OraclePool"); > > c = ds.getConnection(); > > DefaultContext cc = new DefaultContext(c); > > > > #sql [cc] { begin... select... } > > > >In this way the connections are not shared beetweten calls to the EJB. > > I'm still concerned about this variable "c". It's not declared in that > bit of code, so it looks like it's a member field of the bean class. I'd > make it a local variable unless you have a really good reason. > > Toby. > > ___ > JBoss-user mailing list > [EMAIL PROTECTED] > http://lists.sourceforge.net/lists/listinfo/jboss-user ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
Re: [JBoss-user] SQLJ in EJB connecting to Oracle
Hi Toby, Toby Allsopp wrote: > I'm still concerned about this variable "c". It's not declared in that > bit of code, so it looks like it's a member field of the bean class. I'd > make it a local variable unless you have a really good reason. Yes, that variable is a local variable, but it is defined before the try-catch block where I make the connection. But it´s local to every method of the EJB. Now, we have succsefully deployed and working several EJBs with SQLJ. Jose R. ___ JBoss-user mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-user
Re: [JBoss-user] SQLJ in EJB connecting to Oracle
On Wed, Apr 18, 2001 at 09:40:51AM +0200, Jose Ramon Diaz wrote: > Hi Toby! > >Thanks a lot! You were right... Excellent. I'm responsible for adding some SQLJ to the product at work, so I'm glad to see it working for other people. > If anybody is interested the code looks like: > > DataSource ds = (DataSource) ctx.lookup("java:/OraclePool"); > c = ds.getConnection(); > DefaultContext cc = new DefaultContext(c); > > #sql [cc] { begin... select... } > >In this way the connections are not shared beetweten calls to the EJB. I'm still concerned about this variable "c". It's not declared in that bit of code, so it looks like it's a member field of the bean class. I'd make it a local variable unless you have a really good reason. Toby. ___ JBoss-user mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-user
Re: [JBoss-user] SQLJ in EJB connecting to Oracle
Hi Toby! Thanks a lot! You were right... If anybody is interested the code looks like: DataSource ds = (DataSource) ctx.lookup("java:/OraclePool"); c = ds.getConnection(); DefaultContext cc = new DefaultContext(c); #sql [cc] { begin... select... } In this way the connections are not shared beetweten calls to the EJB. Jose R. Díaz Toby Allsopp wrote: > On Tue, Apr 17, 2001 at 07:14:26PM +0200, Jose Ramon Diaz wrote: > > Hi, > > > >I have written a little EJB accesing to Oracle database 8.1.7 with > > SQLJ. > >Is there any known bug known? > >I have the next problem... > > > >I have a little EJB which has several methods that acces database. I > > have defined a Connection pool to the database, ands I obtain the > > connection like this: > > > > InitialContext ctx = new InitialContext(); > > DataSource ds = (DataSource) > > ctx.lookup("java:/OraclePool"); > > c = ds.getConnection(); > > DefaultContext.setDefaultContext(new > > DefaultContext(c)); > > > > After I use the connection I close it. > > My problem is that if two clients are at the > > same time accesing the EJB (everyone has made the home.create() ), they > > are sharing the connections, because suddenly one of the clients says > > the connection is closed! > > Are you closing the connection through the DefaultContext? When you set the > default context, you are setting it for the entire JVM. What you should do > is create new context for the connection and explictly use it in your SQLJ. > > I can't remember the exact syntax or class names, but it'll be something like: > > Connection c = ds.getConnection(); > ConnectionContext cc = new ConnectionContext(c); > #sql[cc] { > SELECT ... > }; > cc.close(); > > Also, it looks like the variable c is an instance variable. You need to be > aware that a single instance of your bean can be used to service method > calls from many clients (just only one at a time). > > Toby. > > ___ > JBoss-user mailing list > [EMAIL PROTECTED] > http://lists.sourceforge.net/lists/listinfo/jboss-user ___ JBoss-user mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-user
Re: [JBoss-user] SQLJ in EJB connecting to Oracle
On Tue, Apr 17, 2001 at 07:14:26PM +0200, Jose Ramon Diaz wrote: > Hi, > >I have written a little EJB accesing to Oracle database 8.1.7 with > SQLJ. >Is there any known bug known? >I have the next problem... > >I have a little EJB which has several methods that acces database. I > have defined a Connection pool to the database, ands I obtain the > connection like this: > > InitialContext ctx = new InitialContext(); > DataSource ds = (DataSource) > ctx.lookup("java:/OraclePool"); > c = ds.getConnection(); > DefaultContext.setDefaultContext(new > DefaultContext(c)); > > After I use the connection I close it. > My problem is that if two clients are at the > same time accesing the EJB (everyone has made the home.create() ), they > are sharing the connections, because suddenly one of the clients says > the connection is closed! Are you closing the connection through the DefaultContext? When you set the default context, you are setting it for the entire JVM. What you should do is create new context for the connection and explictly use it in your SQLJ. I can't remember the exact syntax or class names, but it'll be something like: Connection c = ds.getConnection(); ConnectionContext cc = new ConnectionContext(c); #sql[cc] { SELECT ... }; cc.close(); Also, it looks like the variable c is an instance variable. You need to be aware that a single instance of your bean can be used to service method calls from many clients (just only one at a time). Toby. ___ JBoss-user mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] SQLJ in EJB connecting to Oracle
Hi, I have written a little EJB accesing to Oracle database 8.1.7 with SQLJ. Is there any known bug known? I have the next problem... I have a little EJB which has several methods that acces database. I have defined a Connection pool to the database, ands I obtain the connection like this: InitialContext ctx = new InitialContext(); DataSource ds = (DataSource) ctx.lookup("java:/OraclePool"); c = ds.getConnection(); DefaultContext.setDefaultContext(new DefaultContext(c)); After I use the connection I close it. My problem is that if two clients are at the same time accesing the EJB (everyone has made the home.create() ), they are sharing the connections, because suddenly one of the clients says the connection is closed! I have tried the Minerva Pool and the OracleXADataSource for the pool. Any idea? Jose R. Díaz ___ JBoss-user mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-user