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
Bom dia pessoal! Vou ser direito hoje, pois está meio corrido aqui hoje, gostaria de saber qual a diferença entre TAXBRA e TAXBRJ, já verifiquei que no fórum de um post explanando tais diferenças, porém não sei qdo se aplica o TAXBRA e o TAXBRJ, essa [More]
I am unable to use Youtube or view Flash video on any sites. Firefox crashes/quits as soon as a video tries to load and Safari shows the error "Plug-in Failure". I have uninstalled Flash, downloaded a fresh version and installed, but no joy. I a [More]
My iPad 3 was bought new at Best Buy when the iPad 3 was new. Unfortunately, rather than going to the Apple store, my well-intentioned daughter bought it from Best Buy, paying for an extended two year warranty. After a year and a half my iPad was lag [More]
Hi Everybody, We pull GL Item data from R/3 to BW on a nightly basis using the 0FI_GL_4 extractor using delta updates with a process chain. The process normally starts around 01:00 CST. At around 01:37, there was a problem with the database for R/3 a [More]
In my previous topic at http://discussions.apple.com/thread.jspa?threadID=2623068&tstart=0 we found out the way to connect to the Ms-Word from Objective-C through ScriptingBridge. The connection works and the given text can be found and replaced usin [More]
I have Snow Leopard Server installed on a mac mini (dual hard drives). It is configured with two partitions, one for the Operating System and one for Time Machine backups for the 7 Macs in the office. I keep losing free space on the OS partition (Tim [More]
i need some help now with this and i really do not want to reset my ipod.Disabled Place the iOS device in Recovery Mode and then connect to your computer and restore via iTunes. The iPod will be erased. iOS: Wrong passcode results in red disabled scr [More]
Not a thing is happening when I press the start button, and the battery is full. Same thing when i plug it in. Is there some kind of override? ( I remember an old Apple that had a small hole where you put a pin if the regular start-up button didn't w [More]
So I am eligible and will be getting the $25 plan, I know that you can pre order on the 15th on the apple site. I have some questions though. 1.I can buy the Iphone 4 from the apple site and they will ship it to me? 2.All I have to do is pick the $25 [More]
I AM CREATING A 2-VOLUME BOOK SET.  ONE VOLUME HAS A "COVER" WHILE THE OTHER HAS A "COVER & FLAP."  HOW DO I EDIT COVERS TO MAKE THEM CONSISTENT?To attempt a new chat session... For the link below click the Still Need Help? option [More]