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 read through all the [million] other posts with Vista problems but mine is a bit different. Its a brand new Dell computer with 32bit Vista Home Premium which I have learned is a bad idea but now I'm stuck with it and without my music. I hear some p [More]
Hello: 2 part question... I am wanting to have a quicktime movie open in a separate window - that opens in addition to the homepage AND I want that window to display the movie only at 320 x 240. Is this possible and how do you do it? thanks!Hi James [More]
I just got my copy of iLife 06 and I am pretty pleased so far. There were a few problems during installation though. First, my dock went back to the original one. Not a big deal, but it made me think something bigger was going on. Next, Safari went b [More]
Page Turner element ? as a feature in iWeb ? they have this facility on this website http://www.panik.com/index.php?do=entersite click on red arrow that points left and then on an artists name. Not mine as I have not sent them my visuals yet. Any pla [More]
Has anyone seen this error before in Encore? Quick Time system error: number = -1 How do you fix it? I get it while burning a DVD. I have the latest version of Encore and the menu I am using was exported from After Effects. Thanks so much, HeatherWhe [More]
All the ipods came in all sorts if collors. Why does the iphone 5 not come in colors as well.this is a user helping user forum apple don't read or write here if you wish to give them advice in terms of colours then use the feedback channel http://www [More]
How do I disconnect one iphone from another iphone's iMessage?He needs to get his own Apple ID. Have him logout from your Apple ID at settings>>iCloud . He should then set up his own Apple ID.Read other 2 answers [More]
I am running an iMac OS 9 computer as a server. There are three computers (an iMac, an iBook both running OS 9, and a Powerbook G4, running OS 10.4) connected to the server via ethernet. Here is the problem: all three computers have been printing fro [More]
Anyone having trouble staying connected to the Internet using an Arris 5e12 router.?Are you in an area where it doesn't pick much wifi signal up. If yes try to move your device nearer to the wifi connection boxRead other 2 answers [More]
When I try to make an in-app purchase, this message appears: "This is not a Test User account. Please create a new account in the Sandbox environment"Common on jailbroken iPhones, not so on non-jailbroken iPhones. Thus, if your phone is not jail [More]