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
I am trying to connect to an apple tv on our office network. It seems to pick up the network configuration but doesnt connect when I turn on home sharing. We have a proxy server for connections to the internet so I dont know whether this is the show [More]
Dear All, I request you to give me some Clarifications on Summarization Levels namely; 1) Are the summarization levels build form Line Items tables(CE1XXXX and CE2XXXX). 2) If so how does it get the field "PLIKZ"(Plan/Actual Indicator) for Plan [More]
Before ios 7, we have a choice to FaceTime the number or email. Now, we don't have the choice, it's up to FaceTime to decide which to call. So in order to call a particular person on their email or phone, I have to create a new contact that only has [More]
I am trying to build two 2-D arrays to then save as a spreadsheet file. This process happens in while loop and I need to enable indexing when I feed the wire out. When I do this I use the build array fucntion but then it creates a 3-D array which I c [More]
hi all, In RG23D register BED, AED, ECS values are showing correctly, but in order (VA02) or in billing (VF01) excise values are not showing. So, what could be the reason and what need to be checked? thanks.mohan prabu, Its Surprising, how come it is [More]
I used to be able to hold down the trackpad button to eject a cd at startup, but I don't see how to do that with this model.OK. You have a MacBook Pro, right? On the new model, on the keyboard, at the very top row, even after the letters AND numbers, [More]
I want to test print the book so I can proof the text and ask for input from non mac users. I have ordered books before from apple and mypulisher and love them. I'm working on a book about grandma and want to get input from relatives. most of them ha [More]
my computer was workign fine. everything rolling ok until I ran an update for OSX and Outlook 11. If I type something it takes a good 10 seconds to realize what i did. all these errors you see now (typos) is bc of this lag I am talking about. If i op [More]
How to view usb port share on a netgear router [email protected] , Hello and welcome to the HP support forums.  Unfortunately to change your USB ports requires a change in motherboard.  To have that done would require a repair.   Please call our te [More]
I have a string by as follows: String name = "aaaaaaaaaahgcnjcdcd";I am trying to validate the above string. When the number of "a" in the string excceds 5 and above, I need to throw an error. I tried as follos: if (name.matches(" [More]