
Version: 1.10
Last Modified: 14. Mar 2007
Add the file Entwo.jar to your classpath or extract the jar file in the directory of the application.
Add the file Entwo.jar to the Archive attribute of the applet tag, e.g.:
<APPLET CODE="..." Codebase="..." ARCHIVE="Entwo.jar" WIDTH="100%" HEIGHT="100%"> ... </APPLET>
or extract the jar in the directory of the applet.
Java Versions: 1.2.x or higher
JDBC Version: 2.0
DB2 Server Version:
Tested with:
*as far as we know
(also see Known Problems)
This driver works with DB2 Servers that are configured to use the TCP/IP networking protocol. Please verify that your server is currently listening on a TCP/IP port.
If you know that your DB2 Server is listening on a TCP/IP port and you know the host name of your DB2 Server and the port number you can go to the next chapter.
The default port number for the DB2 Server is usually 50000. However servers can be configured to listen on any port number.
To make sure that the RDBMS server is listening on the machine name and port number you specified use:
telnet <hostname or ip address> <port number>
If the connection is refused then the hostname or the port number is incorrect.
The class name of the driver is: com.inet.drda.DRDADriver
jdbc:inetdb2: ….
jdbc:inetdb2:hostname:portnumber
| Name | Values | Description |
| bind | 0 - do not bind any packages 1 - autodetect if binding is neccessary (default) 2 - force (re)bind all packages | set bind mode |
| cursorTimeout | time in milliseconds | The time the thread will wait for a free cursor. A garbage collection is suggested to the VM at this time to recover unclosed resources. |
| database | database to use (mandatory) | |
| host | overide the value in the JDBC URL | |
| level | dump - dump all send/received data packets debug - show debug data info - show informational data (default) warn - show warnings only error - show errors only fatal - show fatal errors only each level automatically includes all more severe ones | set log level (only for this connection) |
| log | out - enable logging to console (stdout) err - enable logging to console (stderr) off - disable logging filename - enable logging to this file | set logging (only for this connection) |
| port | overide the value in the JDBC URL | |
| safe | true - disable optimizations false - enable optimizations | switch off optimizations |
| sqlam | maximum sqlam level allowed (see drda spec) |
There are three ways to put the properties to the driver:
jdbc:inetdb2:hostname:portnumber?database=MyDb&language=deutsch
With the interface FailoverListener it is possible to manage the reconnection process. The FailoverListener receives an event if the Connection was broken, if the reconnection process was successful and if an error occurred be the try of reconnect. In depend of the value returned from FailoverListener, a new try of reconnect will be started or not.
The Connection tryes to reconnect to the same server with the same properties. If reconnection was successful, all Statements, PreparedStatements and CallableStatements will be restored. The ResultSets won't be restored. For restore that, you have to executed the Statement again.
For more information see com.inet.pool.PoolManager.addFailoverListener(), com.inet.pool.FailoverListener, com.inet.pool.FailoverEvent and sample.MonitoredFailover.
There are multiple possibilities about how to configure the Monitored Failover. It is possible to use the default implementation of the FailoverListener or to use your own implementation. The default FailoverListener is similar to the TimedFailoverListener in the samples package. To every created Connection automatically an instance of the configured FailoverListener will be added.
Set a FailoverListener via Connection properties:
| Name | Default | Description |
| useDefaultFailoverListener | false | if set on true, a default FailoverListener will be added automatically to every Connection |
| waitTimeToNextAttempt | 500 | property for the default FailoverListener. Sets the wait time in millis, that will be wait to the next reconnect attempt. |
| totalTimeOfAttempts | 30 | property for the default FailoverListener. Sets the total time in seconds, in that the reconnection process must be finished. |
| failoverListener | - | the class name of your own FailoverListener implentation. This class has to implement the FailoverListener interface AND the default public constructor. This is important to create a new instance of this class via reflection. |
Example URLs:
For more flexibility it is also possible to manage the registered FailoverListener of a Connection in Java. A FailoverListener can be only added to a Connection, that implements the interface TAFConnection. Those Connection can be received from:
com.inet.pool.PoolDriver, com.inet.ora.PDataSource, com.inet.tds.PDataSource, com.inet.syb.PDataSource, com.inet.drda.PDataSource.
The interface TAFConnection allows you to add and remove a FailoverListener to/from the Connection.
Example:
//receive a Connection Class.forName("com.inet.pool.PoolDriver"); Connection con = DriverManager.getConnection("jdbc:inetpool:inetora:localhost?database=orcl", "scott", "tiger"); //add a FailoverListener FailoverListener fl = new samples..MonitoredFailover.CounteredFailoverListener(99); ((TAFConnection)con).addFailoverListener(fl); //remove a FailoverListener ((TAFConnection)con).removeFailoverListener(fl); //remove all FailoverListener ((TAFConnection)con).removeAllFailoverListener(); //get all registered FailoverListener FailoverListener[] fls = getFailoverListener();
The driver implements escape clauses as follows:
{d 'yyyy-mm-dd'}
??? {t 'hh:mm:ss[.fff]'}
??? {ts 'yyyy-mm-dd hh:mm:ss[.fff]'}
{call storedProcedures('Param1'[,'Param2'][,?][…])}
{? = call storedProcedures('Param1'[,'Param2'][,?][…])}
Example:
st = con.createStatement(); st.execute("{call MyProc('value')}"); pr = con.prepareStatement("{call MyProc('value')}"); pr.execute(); pr = con.prepareStatement("{call MyProc( ? )}"); pr.setString("value"); pr.execute();
The following functions are supported. You can find more info at http://java.sun.com/products/jdbc/driverdevs.html.
Example:
st = con.createStatement(); rs = st.executeQuery( "select * from all_users where username like {fn ucase( 'scott' )}" ); ... rs.close(); st.close();
{fn ABS(number)}
{fn ACOS(float)}
{fn ASIN(float)}
{fn ATAN(float)}
{fn ATAN2(float1,float2)}
{fn CEILING(number)}
{fn COS(float)}
{fn COT(float)}
{fn DEGREES(number)}
{fn EXP(float)}
{fn FLOOR(number)}
{fn LOG(float)}
{fn LOG10(float)}
{fn PI()}
{fn POWER(number, power)}
{fn RADIANS(number)}
{fn RAND(integer)}
{fn ROUND(number, places)}
{fn SIGN(number)}
{fn SIN(float)}
{fn SQRT(float)}
{fn TAN(float)}
{fn now()}
{fn curdate()}
{fn curtime()}
{fn DAYNAME(datetime)}
{fn DAYOFMONTH(datetime)}
{fn DAYOFWEEK(datetime)}
{fn DAYOFYEAR(datetime)}
{fn HOUR(datetime)}
{fn MINUTE(datetime)}
{fn MONTH(datetime)}
{fn MONTHNAME(datetime)}
{fn QUARTER(datetime)}
{fn SECOND(datetime)}
{fn WEEK(datetime)}
{fn YEAR(datetime)}
{fn TIMESTAMPDIFF(interval, count, datetime)}
{fn TIMESTAMPADD(interval, datetime, datetime2)}
interval may be one of the following:
SQL_TSI_FRAC_SECOND SQL_TSI_SECOND SQL_TSI_MINUTE, SQL_TSI_HOUR SQL_TSI_DAY SQL_TSI_WEEK SQL_TSI_MONTH, SQL_TSI_QUARTER SQL_TSI_YEAR
{oj table1 LEFT OUTER JOIN table2 ON table1.id = table2.id}
{oj table1 RIGHT OUTER JOIN table2 ON table1.id = table2.id}
If you have problems with the driver then you can enable the logging of the driver with:
DriverManager.setLogStream( System.out );
or
DriverManager.setLogStream( System.err );
You can also use any other PrintStream to make this output. This can be used if you can not see the default PrintStreams
If you use the driver in an servlet, .jsp script or in an Application Server then you need to set an PrintStream on an log file:
PrintStream ps = new PrintStream( new FileOutputStream( "c:\driver.log" ) ); DriverManager.setLogStream( ps );
Now the driver prints the logging output in the file that you have specified.
Please note: Enable the logging of the driver only when you need it to find a problem because the driver performance will be better without the logging.
If you get error 51002 this means you have not bound the packages this driver needs. These are the packages INETCRSR and INETHOLD.
The driver will try to bind the packages automatically, but if it does not have the permissions to do so we have provided a small tool for you.
Simply execute:
"java -cp ENTWO.jar com.inet.drda.BindUtil jdbc-url username password"
where the username you provide has to have the privilege to create packages in the database.
The following methods are not supported by this release:
If you prepare a statement and alter the table later, the prepared statement will not work any longer as expected and will return the old meta data. As almost all applications do not alter the tables in a production environment and a fix would result in a slowdown we decided not to fix this now. If you have urgent need for this you can force the SQLDA level to 6 or send an email and we can see what is appropriate for you.
You can find the documentation at: http://www.inetsoftware.de/products/jdbc/db2/documentation.htm
Please read this file and our FAQ at: http://www.inetsoftware.de/products/jdbc/db2/faq.htm
If you have not found your problem in the FAQ then post your problem to our helpdesk system as much information of what occurred or happened as possible. You can find more info about our support at: http://www.inetsoftware.de/support
Please include at least:
If possible/applicable:
Copyright by i-net software
More info and updates can be found at http://www.inetsoftware.de/
© 2003-2007 i-net software