This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 84391 - JDBC connection pool configuration: wrong properties for SUN Oracle driver
Summary: JDBC connection pool configuration: wrong properties for SUN Oracle driver
Status: VERIFIED FIXED
Alias: None
Product: serverplugins
Classification: Unclassified
Component: Sun Appserver 9 (show other bugs)
Version: 5.x
Hardware: All All
: P2 blocker (vote)
Assignee: Nitya Doraisamy
URL:
Keywords:
Depends on:
Blocks: 84405
  Show dependency tree
 
Reported: 2006-09-07 00:25 UTC by Marco Walther
Modified: 2006-10-03 17:50 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
diff for fix (36.34 KB, text/plain)
2006-09-13 04:37 UTC, Nitya Doraisamy
Details
Updated patch (51.10 KB, text/plain)
2006-09-14 03:42 UTC, Nitya Doraisamy
Details
fix for mssql database (4.56 KB, text/plain)
2006-10-01 06:15 UTC, Nitya Doraisamy
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marco Walther 2006-09-07 00:25:18 UTC
NB 5.5 20060904:

Using a DB connection to Oracle with the SUN JDBC drivers in the IDE works. 
But once that information is translated into the setup/sun* files, it appreas 
the information is not translated correctly:-( 

For instance the serverName property is not specified but required by the 
DataSource implementation. So the GF throws exceptions:

RAR5038:Unexpected exception while creating resource
RAR5117 : Failed to obtain/create connection. Reason : Connection could not be 
allocated because: [sunm][Oracle JDBC Driver]Missing connection information: 
no serverName specified.
RAR5114 : Error allocating connection : [Error in allocating a connection. 
Cause: Connection could not be allocated because: [sunm][Oracle JDBC 
Driver]Missing connection information: no serverName specified.]
WebModule[/Test-Oracle-DD-9]java.sql.SQLException: Error in allocating a 
connection. Cause: Connection could not be allocated because: [sunm][Oracle 
JDBC Driver]Missing connection information: no serverName specified.
java.lang.RuntimeException: java.sql.SQLException: Error in allocating a 
connection. Cause: Connection could not be allocated because: [sunm][Oracle 
JDBC Driver]Missing connection information: no serverName specified.
        at 
com.sun.data.provider.impl.CachedRowSetDataProvider.setCursorRow(CachedRowSetDataProvider.java:344)
        at 
com.sun.data.provider.impl.CachedRowSetDataProvider.setCursorIndex(CachedRowSetDataProvider.java:300)
        at 
com.sun.data.provider.impl.CachedRowSetDataProvider.getRowCount(CachedRowSetDataProvider.java:626)

FYI, the error message seems to be different for each driver, so I'm guessing 
that it comes from the driver itself.  E.g., with the IBM DB2 driver, I 
get: "Required property 'serverName' not set", and with some other driver I 
get: "the serverName property has not been set"

[There is a Sun internal bug #6467923 on this]
Comment 1 Nitya Doraisamy 2006-09-07 22:22:03 UTC
Looks like the appserver requires the information in the url to be split up into 
serverName, portNumber, databaseName in addition to the url.

Workaround, in the connection pool property sheet, provide these additional
name/value pairs via the Properties field. Either register just this resource or
redeploy. You can do the same via the admin console. It should work now.

Downgrading to P2. WIll fix in the next day.
Comment 2 _ jimdavidson 2006-09-07 22:50:44 UTC
That worked.  After manually adding the three properties, I could deploy apps
that use the connection pool (using jTDS driver).

Will try on some of the other drivers.

This will be in the next Daily Build, right?

Thanks!
Comment 3 _ jimdavidson 2006-09-07 23:27:52 UTC
Update: After adding these three properties, plus driverType=4, the IBM DB2
drivers seem to work. 
Comment 4 _ ludo 2006-09-08 00:30:56 UTC
good news and progress. Thanks for the testing.
Comment 5 Nitya Doraisamy 2006-09-13 04:37:12 UTC
Created attachment 33864 [details]
diff for fix
Comment 6 Nitya Doraisamy 2006-09-13 18:00:52 UTC
Checked into release55_dev branch

Checking in
appsrv/src/org/netbeans/modules/j2ee/sun/sunresources/beans/CPWizard.xml;
/cvs/serverplugins/sun/appsrv/src/org/netbeans/modules/j2ee/sun/sunresources/beans/CPWizard.xml,v
 <--  CPWizard.xml
new revision: 1.1.16.3.2.4.2.1; previous revision: 1.1.16.3.2.4
done
Checking in
appsrv/src/org/netbeans/modules/j2ee/sun/sunresources/beans/DatabaseUtils.java;
/cvs/serverplugins/sun/appsrv/src/org/netbeans/modules/j2ee/sun/sunresources/beans/Attic/DatabaseUtils.java,v
 <--  DatabaseUtils.java
new revision: 1.1.2.4.2.1; previous revision: 1.1.2.4
done
Checking in
appsrv/src/org/netbeans/modules/j2ee/sun/sunresources/beans/WizardConstants.java;
/cvs/serverplugins/sun/appsrv/src/org/netbeans/modules/j2ee/sun/sunresources/beans/WizardConstants.java,v
 <--  WizardConstants.java
new revision: 1.1.16.4.2.9.10.1; previous revision: 1.1.16.4.2.9
done
Checking in
appsrv/src/org/netbeans/modules/j2ee/sun/ide/sunresources/beans/ResourceConfigurator.java;
/cvs/serverplugins/sun/appsrv/src/org/netbeans/modules/j2ee/sun/ide/sunresources/beans/ResourceConfigurator.java,v
 <--  ResourceConfigurator.java
new revision: 1.3.6.5.2.13.6.1; previous revision: 1.3.6.5.2.13
done
Checking in
appsrv/src/org/netbeans/modules/j2ee/sun/ide/sunresources/beans/ResourceUtils.java;
/cvs/serverplugins/sun/appsrv/src/org/netbeans/modules/j2ee/sun/ide/sunresources/beans/ResourceUtils.java,v
 <--  ResourceUtils.java
new revision: 1.2.4.3.2.16.6.1; previous revision: 1.2.4.3.2.16
done
Checking in appsrv81/src/org/netbeans/modules/j2ee/sun/ide/j2ee/DomainEditor.java;
/cvs/serverplugins/sun/appsrv81/src/org/netbeans/modules/j2ee/sun/ide/j2ee/Attic/DomainEditor.java,v
 <--  DomainEditor.java
new revision: 1.1.2.9.6.1; previous revision: 1.1.2.9
done
Checking in
appsrv/src/org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle.properties;
/cvs/serverplugins/sun/appsrv/src/org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle.properties,v
 <--  Bundle.properties
new revision: 1.1.16.2.2.8.6.1; previous revision: 1.1.16.2.2.8
done
Comment 7 Nitya Doraisamy 2006-09-14 03:42:22 UTC
Created attachment 33923 [details]
Updated patch
Comment 8 Nitya Doraisamy 2006-09-14 20:25:46 UTC
Fixed in release55_dev
Comment 9 Vince Kraemer 2006-09-14 22:51:37 UTC
diff approved
Comment 10 _ jimdavidson 2006-09-15 23:38:18 UTC
Update: I tested 5 different drivers, with the release55_dev build.  *All passed*

Details:

Two drivers used to work, and still do.  Tested for regression:
- Derby/Derby
- Oracle/Oracle	

Two drivers used to fail because of IZ# 84391, and now work:
- Oracle/DataDirect
- SQLServer/jTDS

One driver used to fail because of IZ# 84405, and now works:
- SQLServer/MS

Looks good.
Comment 11 _ jimdavidson 2006-09-16 00:18:08 UTC
Addendum:

Tested the IBM drivers for DB2.

These used to fail because of IZ #84641 and IZ #84391.

Now that #84391 is fixed, the method is to deploy once, fix up connection pool
to add driverType, and redeploy.  This works.
Comment 12 Nitya Doraisamy 2006-09-16 01:09:30 UTC
Checked in fix into release55 branch.
Checking in appsrv81/src/org/netbeans/modules/j2ee/sun/ide/j2ee/DomainEditor.java;
/cvs/serverplugins/sun/appsrv81/src/org/netbeans/modules/j2ee/sun/ide/j2ee/Attic/DomainEditor.java,v
 <--  DomainEditor.java
new revision: 1.1.2.10; previous revision: 1.1.2.9
done
Checking in
appsrv/src/org/netbeans/modules/j2ee/sun/sunresources/beans/CPWizard.xml;
/cvs/serverplugins/sun/appsrv/src/org/netbeans/modules/j2ee/sun/sunresources/beans/CPWizard.xml,v
 <--  CPWizard.xml
new revision: 1.1.16.3.2.5; previous revision: 1.1.16.3.2.4
done
Checking in
appsrv/src/org/netbeans/modules/j2ee/sun/sunresources/beans/DatabaseUtils.java;
/cvs/serverplugins/sun/appsrv/src/org/netbeans/modules/j2ee/sun/sunresources/beans/Attic/DatabaseUtils.java,v
 <--  DatabaseUtils.java
new revision: 1.1.2.5; previous revision: 1.1.2.4
done
Checking in
appsrv/src/org/netbeans/modules/j2ee/sun/sunresources/beans/WizardConstants.java;
/cvs/serverplugins/sun/appsrv/src/org/netbeans/modules/j2ee/sun/sunresources/beans/WizardConstants.java,v
 <--  WizardConstants.java
new revision: 1.1.16.4.2.10; previous revision: 1.1.16.4.2.9
done
Checking in
appsrv/src/org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle.properties;
/cvs/serverplugins/sun/appsrv/src/org/netbeans/modules/j2ee/sun/ide/sunresources/wizards/Bundle.properties,v
 <--  Bundle.properties
new revision: 1.1.16.2.2.9; previous revision: 1.1.16.2.2.8
done
Checking in
appsrv/src/org/netbeans/modules/j2ee/sun/ide/sunresources/beans/ResourceConfigurator.java;
/cvs/serverplugins/sun/appsrv/src/org/netbeans/modules/j2ee/sun/ide/sunresources/beans/ResourceConfigurator.java,v
 <--  ResourceConfigurator.java
new revision: 1.3.6.5.2.14; previous revision: 1.3.6.5.2.13
done
Checking in
appsrv/src/org/netbeans/modules/j2ee/sun/ide/sunresources/beans/ResourceUtils.java;
/cvs/serverplugins/sun/appsrv/src/org/netbeans/modules/j2ee/sun/ide/sunresources/beans/ResourceUtils.java,v
 <--  ResourceUtils.java
new revision: 1.2.4.3.2.17; previous revision: 1.2.4.3.2.16
done
Comment 13 Martin Schovanek 2006-09-26 16:33:48 UTC
Please, can a QE member verify the fix in latest relase55 build and mark this
issue as verified?
Comment 14 liwang 2006-09-30 00:09:17 UTC
Tested on release55 branch latest build 20060929-1949. I did the following two
scenarios testing:

(1) Use Oracle JDBC driver ojdbc14.jar. In IDE Create a web application project.
Create a JDBC datasource and a JDBC connection pool pointing to Oracle 9i DB. 
Deploy the web application that using the pool to create table and insert row.
The application works fine.

(2) Use JDBC driver( smbase.jar, smsqlserver.jar and smutil.jar) to connect
MSSQL server. Create a Connect to DB works fine from IDE runtime. Use the same
application mention above. Create JDBC datasource and a JDBC connection pool
pointing to the MSSQL DB. This time the connection pool cannot connect to DB.  
 From admin GUI, if you click ping button of the connection pool. The  error
will thrown:
Operation 'pingConnectionPool' failed in 'resources' Config Mbean. Target
exception message: Connection could not be allocated because: [sunm][SQLServer
JDBC Driver]A value was not specified for a required property: serverName

Add serverName property either from IDE or admin GUI. Then the application works.

Do not know if my finding is the same issue.

Could please the issue submitter verify the fix in release55 branch?
Comment 15 _ jimdavidson 2006-09-30 01:31:21 UTC
Good catch.  That seems to be an instance of the same problem.

I tested the DataDirect drivers (which are the ones mentioned above) on Oracle
and DB2, and they worked fine.  An additional serverName property is added to
the connection pool in each case.

However, on SQL Server, they produce the error shown above.  It looks like the
additional serverName property is not being set on the sun_msftsqlpool.

On this basis, I have reopened the issue.


Comment 16 Nitya Doraisamy 2006-09-30 17:27:28 UTC
Could Li or Jim attach the url associated with the MSSQL server

Comment 17 Nitya Doraisamy 2006-10-01 06:15:56 UTC
Created attachment 34748 [details]
fix for mssql database
Comment 18 _ jimdavidson 2006-10-01 16:36:39 UTC
Sorry, just saw the request now.  

I think you got the information elsewhere, but the URL for connecting to SQL
Server with the Sun DataDirect drivers is:

jdbc:sun:sqlserver://<server_name>[:<portNumber>];databaseName=<database>;selectMethod=cursor

It would probably be good to test with Sybase as well; I don't have access to a
Sybase database right now, although I will try to find one.
Comment 19 _ jimdavidson 2006-10-01 21:07:38 UTC
I also tested the DataDirect drivers as obtained from DataDirect (i.e.,
non-Sun-branded):

Driver Class:
    com.ddtek.jdbc.oracle.OracleDriver
    com.ddtek.jdbc.sqlserver.SQLServerDriver
    com.ddtek.jdbc.db2.DB2Driver

URL:
    jdbc:datadirect:oracle://<server_name>[:<portNumber>];SID=<database>
    jdbc:datadirect:sqlserver://<server_name>[:<portNumber>];databaseName=<database>
    jdbc:datadirect:db2://<server_name>:<portNumber>DatabaseName=<database>

This time, SQL Server and DB2 worked, but the Oracle version failed with a
complaint about missing serverName.  Sure enough, the datadirect_oraclePool did
not have a serverName property.
Comment 20 Nitya Doraisamy 2006-10-02 08:35:41 UTC
Opened issue http://www.netbeans.org/issues/show_bug.cgi?id=86281
for new drivers that don't have all the properties. 

Closing this issue as the drivers identified in this issue were fixed.
Comment 21 Nitya Doraisamy 2006-10-02 08:37:33 UTC
Li, Please verify the fix in release55 for the drivers identified in the top
level descriptions. I have opened another P2 86281 for the other drivers
identified last week. 

   
Comment 22 liwang 2006-10-02 20:59:26 UTC
I tested SUN JDBC driver against Oracle 9i in release55 build
NetBeans-release55-20061002-1452. I still see the issue. Reopen the bug. This
time I use SUN JDBC Oracle driver (smbase.jar, smoracle.jar and smutil.jar). 
The following steps I performed:
1. Add sun JDBC driver (smbase.jar, smoracle.jar and smutil.jar) from IDE runtime
2. Add the JDBC driver also in application server 9.0 JVM classpath suffix and
restart application server domain
3. Create a new project by inport .ear
4. In project create a JDBC connection pool by selecting new configuration using
database.
5. select Sun DataDirect oracle driver. Give URL:
jdbc:sun:oracle://jws-cust-880-1.red.iplanet.com:1523;SID=ORA9201
6. Register the connection pool
7. In application server admin GUI, ping the connection pool. The following
error still thrown:
Operation 'pingConnectionPool' failed in 'resources' Config Mbean. Target
exception message: Connection could not be allocated because: [sunm][Oracle JDBC
Driver]Missing connection information: no serverName specified.
Comment 23 _ jimdavidson 2006-10-03 07:49:15 UTC
This configuration (Sun-branded DataDirect drivers on Oracle database) works for
me.  I just tested again, using Creator Shortfin:

1. Add sun JDBC driver (smbase.jar, smoracle.jar and smutil.jar) from IDE runtime
2. Copy the three jar files into App Server /lib directory, and restart
3. Right-click -> "Connect Using" to connect to DB.  Fill in URL etc.
4. Open new project, of type Web -> Visual Web Application
5. Drag/drop table component onto form
6. Drag/drop DB table onto form
7. Run project.  Works.

Connection Pool (sun_oraclePool) is created, with four additional properties
(serverName, SID, Password, User). 
JDBC Resource (jdbc/dataSource_1159856348281_) is created.
Comment 24 Nitya Doraisamy 2006-10-03 09:24:21 UTC
Li, Did you test the SUN JDBC driver against Oracle 9i zero-config resource
creation or did you use the wizards to attempt to create the resource?

The issue was filed and fixed against zero-config creation of resources. Jim
indicates that it is working for him. Please clarify. The wizards use a seperate
codepath. That still requires the user to do somelevel of setup and will be part
of rewrite for the next gen.NB 
  
Comment 25 liwang 2006-10-03 17:40:28 UTC
Change status back to fixed
Comment 26 liwang 2006-10-03 17:50:43 UTC
I created resource from wizard in project. I did not know non-zero scenario.
Since  Jim has verified the fix. Marked the bug verified.

I suggest every bug submitter give detail reproduce steps so that other people
could easily reproduce the issue.