Difference between revisions of "Information Systems:Using JDBC"

From uniWIKI
Jump to navigation Jump to search
m
 
(2 intermediate revisions by the same user not shown)
Line 7: Line 7:
   
 
==Connection Pooling==
 
==Connection Pooling==
Using a connection pool is important to prevent the opening and closing of DB connections (worst case scenario is one connection open/close per DB operation), which is an "expensive" process. The JDBC API provides the facilities to implement a connection pooling mechanism from scratch, but there are established libraries that already do this for you. The one in use for the UWD Integrations project is HikariCP.
+
Using a connection pool is important to prevent the opening and closing of DB connections (worst case scenario is one connection open/close per DB operation), which is an "expensive" process. Integrator provides connection pooling as one of the core features, but using it will require further training.
 
Integrator itself
 
   
 
==JTOpen==
 
==JTOpen==
The database facilities in [[Information Systems:IBM Toolbox for Java|JTOpen]] extend JDBC classes. For example, the AS400JDBCConnection class extends <code>java.sql.Connection</code>
+
The database facilities in [[Information Systems:IBM Toolbox for Java|JTOpen]] extend JDBC classes. For example, the AS400JDBCConnection class extends <code>java.sql.Connection</code>.
  +
  +
As of June 2021, JTOpen is at version 10.6, but '''version 9.4 or below''' must be used, as the JDBC driver in later releases is incompatible. Trying to connect using >9.4 will first yield a "Unable to load driver" error, but even when that's fixed, you'll get a "Connection unexpectedly dropped error". This is most likely due to the fact that the i is at version 7.2.
  +
  +
''Edit this section when the i is upgraded and this no longer applies.''
   
   

Latest revision as of 16:35, 4 June 2021

JDBC is what allows Java to access databases. It is a part of the standard JDK (java.sql). Resources for learning JDBC are abundant. This page discusses usage of JDBC at uniPHARM.

UWDDBConnection

Found in com.unipharm.uwd.utils (UWD Java Integrations).

This class was created to be a connection manager of sorts i.e. to provide convenience methods. The current state is that it requires massive improvement. For one, it should be converted to use connection pooling.

Connection Pooling

Using a connection pool is important to prevent the opening and closing of DB connections (worst case scenario is one connection open/close per DB operation), which is an "expensive" process. Integrator provides connection pooling as one of the core features, but using it will require further training.

JTOpen

The database facilities in JTOpen extend JDBC classes. For example, the AS400JDBCConnection class extends java.sql.Connection.

As of June 2021, JTOpen is at version 10.6, but version 9.4 or below must be used, as the JDBC driver in later releases is incompatible. Trying to connect using >9.4 will first yield a "Unable to load driver" error, but even when that's fixed, you'll get a "Connection unexpectedly dropped error". This is most likely due to the fact that the i is at version 7.2.

Edit this section when the i is upgraded and this no longer applies.