1.0 Introduction
2.0 Prerequisites
3.0 Limitations and known problems
3.1 Full scrolling support for large result sets is not automatic
3.2 Initial class path set for applications that use Java DataSources is incomplete
3.3 Must modify Java security profile to run Data Access Beans in applet
4.0 Hints and Tips
4.1 Must add the Data Access Beans feature before you can use the beans
4.2 Must get the database driver into your classpath
4.3 May need to clear the workspace cache before switching JDBC(TM) levels
The Data Access Beans provide an easy way to access relational data through Java's JDBC interface. The following support has been added to VisualAge for Java, Version 3.5 since Version 3.0:
If you are using DB2(R) as your database, and you plan to use the new Data Access Bean support for the Java DataSource object or take advantage of full scrolling support for result sets when the cache size has been limited, you must be using DB2 UDB, Version 7.1 or higher. DB2 began to provide JDBC 2.0 drivers in Version 6, however, those drivers do not contain support for these new functions.
The online documentation for the Data Access Beans indicates that if you are using a JDBC 2.0 database driver you will automatically be able to scroll back and forth among all rows of a large result set even if you have limited the size of its in-memory cache by setting the maximumPacketsInCache property of your Select or ProcedureCall bean to a value other than 0. This is incorrect.
As the mechanisms available for determining at run-time whether a database driver is at the JDBC 2.0 level caused hangs under some conditions, this support could not be made automatic.
If you want full scrolling support for a Select or ProcedureCall bean whose cache size you have limited, and you are using a JDBC 2.0 driver, you must set an undocumented property of the Select or ProcedureCall bean called setLargeResultSetScrollingEnabled to true. This property does not appear on the property sheet for a Select or ProcedureCall bean in the Visual Composition Editor. To set it to true, you must write a line of code like the following:
ivjSelect1.setLargeResultSetScrollingEnabled(true);
For code generated using the Visual Composition Editor the recommended location for this line of code is in the user code portion of the generated method getSelect1() (or getXXX(), where XXX is the name of your Select bean.)
If you develop an application that uses the Data Access Beans and it uses a DataSource
to obtain the database connection, the initial class path that is generated by
the Visual Composition Editor is incomplete. It will not contain the
IBM Enterprise Extension Library project that contains the java packages that are
needed to work with DataSources. Without this project in the class path, you will
get a NoClassDefFoundError when the application attempts to connect to the database.
To generate a accurate class path for your application, right-click on the application class
to bring up the pop-up dialog. Select Run > Check Class Path. On the ClassPath
page of the Properties dialog, click Compute Now to re-compute the class path. The complete class path will be computed that will contain the IBM Enterprise Extension
Library project.
3.3 Must modify Java security profile to run Data Access Beans in applet
Java security has been changed in J2SDK(TM) v 1.2.2.
You cannot run an applet that contains the Data Access Beans with the default java.profile that is shipped with VisualAge for Java.
To run the applet in the Applet Viewer within VisualAge for Java you must add one or more of the following statements to the java.profile that is located
in the X:\VAJava\ide\program\lib\security directory. 'X:\VAJava' is the directory where you installed VisualAge for Java,
Version 3.5.
If your applet contains the DBNavigator bean, you need to add the following statement to allow the
DBNavigator to access the icons for the buttons
permission java.io.FilePermission "X:\\VAJava\\ide\\project_resources\\IBM Data Access Beans\\-","read";
Replace 'X:\\VAJava' with the directory where you installed VisualAge for Java,
Version 3.5.
If your applet uses the DBNavigator, you may have to add the following permissions since
the DBNavigator starts a new thread to execute methods on the other Data Access Beans
permission java.lang.RuntimePermission "modifyThreadGroup";
permission java.lang.RuntimePermission "modifyThread";
If you are using the DB2 net driver or other database drivers that require use of sockets,
you must add the following permission.
permission java.net.SocketPermission "serverName", "resolve, connect";
Replace 'serverName' with the name of the server that you are attempting to connect to.
If you do not see a bean category called "Database" in the beans palette of the Visual Composition Editor, the Data Access Beans feature has not yet been added.
To add the feature, use the Quick Start menu (F2) from the Workbench. When the Quick Start menu appears, select Features > Add Feature and click OK. Select Data Access Beans from the feature list, and click OK.
You can either include your driver in the Workspace classpath, by specifying it in the Resources page of the Options dialog. using the "Resources" category in the "Options..." menu; or you can include it separately in the classpath of each application that requires it by specifying it in the Class Path page of the Property dialog of the application. To open the dialog, right-click the application and select Run > Check Class Path.
For example, to include the DB2 JDBC drivers in your Workspace classpath, select Window > Options and select Resources. To add the full path for the db2java.zip file to the workspace class path field, type:
C:\SQLLIB\java\db2java.zip;
Substitute the location of your SQLLIB directory for C:\SQLLIB.
To do so, select Window > Options to open the Options dialog. Expand the General category and select Cache. Click Clear Disk Cache and Clear Memory Cache and then click OK. You must exit VisualAge for Java and restart it before this takes effect.
If you do not clear the cache before using the new level of the database driver, your workspace may become corrupted, and have to be rebuilt.
The DB2 database drivers for JDBC 1.0 and JDBC 2.0 do use the same class names, so if you are using DB2, this consideration applies to you.