Sitemap

Amicuk Programming Answers

[Bug] Or feature? Database connection closed if given a name after first op

-0001-11-30   Views:0

Advertisement

I am not sure if this is a bug or a feature. oracle.javatools.db.Database db = oracle.javatools.db.DatabaseFactory.findOrCreateDatabase("sample", conn); If I supply a name for the database as the above line using "sample", the database

I am not sure if this is a bug or a feature.
oracle.javatools.db.Database db = oracle.javatools.db.DatabaseFactory.findOrCreateDatabase("sample", conn);
If I supply a name for the database as the above line using "sample", the database connection is closed after the first op, i.e., you can call
db.listObjects once, but the second time, it will fail with StackOverFlowException. But the culprit is the database connection is closed after the first op.
However, if I don't give it a name, using null,
oracle.javatools.db.Database db = oracle.javatools.db.DatabaseFactory.findOrCreateDatabase(null, conn);
There's no problem at all.
Is this a bug or a feature?
If a feature, the JavaDoc made it worse, by using the following example:
http://www.oracle.com/technology/products/jdev/esdk/api1013/oracle/javatools/db/DatabaseFactory.html
The DatabaseFactory should be used over the DBObjectProviderFactory when a Database specifically is required, and the name and Connection of that Database are available.
e.g.
java.sql.Connection conn = // the Connection to the db
DatabaseFactory.findOrCreateDatabase( "ora10g", conn );
The example sure sounds like a name is mandatory. Or perhaps the name is not some random name, but TNSName? If so, the Doc should certainly mention that.

The replay answer
Advertisement
I am not sure if this is a bug or a feature.
oracle.javatools.db.Database db = oracle.javatools.db.DatabaseFactory.findOrCreateDatabase("sample", conn);
If I supply a name for the database as the above line using "sample", the database connection is closed after the first op, i.e., you can call
db.listObjects once, but the second time, it will fail with StackOverFlowException. But the culprit is the database connection is closed after the first op.
However, if I don't give it a name, using null,
oracle.javatools.db.Database db = oracle.javatools.db.DatabaseFactory.findOrCreateDatabase(null, conn);
There's no problem at all.
Is this a bug or a feature?
If a feature, the JavaDoc made it worse, by using the following example:
http://www.oracle.com/technology/products/jdev/esdk/api1013/oracle/javatools/db/DatabaseFactory.html
The DatabaseFactory should be used over the DBObjectProviderFactory when a Database specifically is required, and the name and Connection of that Database are available.
e.g.
java.sql.Connection conn = // the Connection to the db
DatabaseFactory.findOrCreateDatabase( "ora10g", conn );
The example sure sounds like a name is mandatory. Or perhaps the name is not some random name, but TNSName? If so, the Doc should certainly mention that.

Go to See the other 7 answers

Database connection closing in JSF

Category:DefaultRelease time:-0001-11-30Views:130

This is regarding Database connection closing in JSF. in servlets we have destroy method where we will be closing the database connections, similarly in JSF where should we close the database connections? is it taken care by the framework? is there a[More]

[Bug] Or feature? Database connection closed if given a name after first op

Category:DefaultRelease time:-0001-11-30Views:130

I am not sure if this is a bug or a feature. oracle.javatools.db.Database db = oracle.javatools.db.DatabaseFactory.findOrCreateDatabase("sample", conn); If I supply a name for the database as the above line using "sample", the database[More]

When are database connections closed?

Category:DefaultRelease time:-0001-11-30Views:130

Hello. This post is related to the post that I made the earlier today. If I am using an external connection pool with TopLink at what point is a connection returned to the pool? If I have a ClientSession does it happen when I call release? Similarly,[More]

JDeveloper: not retaining database connections when starting

Category:DefaultRelease time:-0001-11-30Views:130

Hello, I've just had a machine rebuild, and after installing JDeveloper, importing my previous JDeveloper database connections, closing JDeveloper, and then restarting it, the connections have all been lost. I then have to import again, which works u[More]

Database connection not closing on time out

Category:DefaultRelease time:2015-10-11Views:130

Hi All, Not sure if this is the right place for this question but.. I've moved my app (built using jdev10.1.2., adf bc's and jsp's) to an app server. For some reason, the database connection is not closing. I have 46 connections to the database and I[More]

Closed database connection in olap worksheet

Category:DefaultRelease time:2015-10-11Views:130

i have installed analytic workspace manager after applying the pathches ,i tried to log in analytic workspace manager and connect to olap worksheet it gives me an error as "closed database connection" .My patch installation was successful and it[More]

Database Connections Not Closing

Category:DefaultRelease time:-0001-11-30Views:130

I'm using iBatis for PostgreSQL database access and frequently have problems with connections not being closed. Here is a copy of my sqlMapConfig file: ============================ <?xml version="1.0" encoding="UTF-8" ?> <!DOC[More]

ORCL Failed to connect to database instance: Closed Connection.

Category:DefaultRelease time:-0001-11-30Views:130

Hi all, i am getting ORCL Failed to connect to database instance: Closed Connection, on my work environment but when i look into the database it is ok more over this ticket is generated from GridControl , i checked in trace-file but i haven't got any[More]

Closing the database connection after report in a server application

Category:DefaultRelease time:2015-10-11Views:130

I searched these forums and the internet for a definitive answer on asking the Crystal SDK for java to close the jdbc connection after it has generated a report.  We have been using the Crystal Report SDK to generate reports within our JEE applicatio[More]

Database connection not closed in Destroy()  method of servlet

Category:DefaultRelease time:2015-10-11Views:130

Hi, I have a problem with my deployed web application. At first, I thought Glassfish was messing up on me, and after checking the log I could see plenty of null pointer exceptions being thrown at lines in my code where I generate prepared statements[More]

KIMYONG : Applications Database Connection Pool 관련 parameter 설명

Category:DefaultRelease time:-0001-11-30Views:130

Purpose JVM 이 과도한 CPU / Memory를 사용하게 되어 Application Performance에 영향을 미칠때가 있으며 이럴경우 Connection Pool 관련하여 Parameter Tunning을 해야 할때가 있습니다. 이때 사용되는 Parameter들의 의미를 설명하고자 합니다. The Applications Database Connection Pool is a pool of JDBC database connection[More]

Hot
Hi, I am trying to do an MR11 on a PO but it says that there is no PO found. But when I look at the PO history there is an entry in Total variances through IR. Then why does it say there is nothing to do MR11 for? The PO quantity is 440.030 The GR Qu [More]
I'm a volunteer at the Marjorie P Lee retirement community. We had two iMacs that were available for residents to use. We recently bought two more iMacs and a Mac Mini Server. The goal is to make it possible for residents to use any of the computers [More]
hi gurus, i am new in oim, i am trying to upgrade to 9.1.0.2 from 9.1.0.1 It is set up on Oracle database 10.0.2 and wls 10.3 when i am trying to Load Metadata into the Database when i am runing the script LoadXML_XACM making changes as mentioned in [More]
I set up WL Admin Server and Managed Server to run as Windows services. I have the code to retire/re-activate in an ANT script and right now, I execute it via the command line. Here's my question I want to retire a SOA composite BEFORE my Managed Ser [More]
I am trying to make a template for a new site that I am working on using DW CS3. I started with the home.html page then saved it as a template. Have since been edditing the template. Started with using tables to positions the elements. Have 4 editabl [More]
I just installed cc desktop app in order to install photoshop on my second computer. It is not showing me the version I purchased, CS6, it only shows the ability to "TRY" Photoshop CC2014.Previous via Cloud http://helpx.adobe.com/creative-cloud/ [More]
That seems to occur  today Those Mac OS 10.9 users like me, who purchased it earlier  these days can't open it. Are there good prospects for its owners and those who is planning to own?Andrei Belyakov Please refer to your prior thread on your issues [More]
I perform the majority of my editing work in Lightroom.  However, I also use some 3rd party applications (e.g. Nik, OnOne, etc.) in addition to Photoshop for special editing, etc.  I've noticed that the default color space for each of these applicati [More]
Hi,      Could someone tell me the difference between CO06 and V_V2. Both seem to be backorder rescheduling transactions. Thanks GSHi GS                    *Difference between CO06 and VV2.*_ V_V2  -> It is a Rescheduling process of backorders CO06 - [More]
I was using the perspective grid tool and all of a sudden the selector for my vanishing point dissappeared. How do I get this back? I have the perspective selection tool selected too BTW.     Thanks This is what I have: I'm missing this selector:Jeff [More]