This rule detects the use of WebLogic-specific strings and classes that are used for JDBC.
The following string literals are detected.
- weblogic.jdbc.rmi.Driver
- jdbc:weblogic:rmi
- jdbc:weblogic:jts
- weblogic.server.url
- weblogic.jdbc.datasource
- weblogic.user
- weblogic.credential
For example, the following code will be detected:
- propertiess.put("weblogic.jdbc.datasource", "myDataSource").newInstance();
- java.sql.Driver myDriver = (java.sql.Driver) Class.forName("weblogic.jdbc.rmi.Driver").newInstance();
Instances of the following objects, or the cast operations are detected.
- weblogic.jdbc.extensions.WLConnection
- weblogic.jdbc.vendor.oracle.OracleConnection
- weblogic.jdbc.vendor.oracle.OracleArray
- weblogic.jdbc.vendor.oracle.OracleStruct
- weblogic.jdbc.vendor.oracle.OracleRef
- weblogic.jdbc.vendor.oracle.OracleThinBlob
- weblogic.jdbc.vendor.oracle.OracleThinClob
The following code shows examples of detecting WLConnection object usage:
- Object instance (Qualified Type): weblogic.jdbc.extensions.WLConnection myWLConnection
- Object instance (Simple Type): WLConnection myWLConnection2
- Object Cast (Qualified Type): java.sql.Connection vendorConn = ((weblogic.jdbc.extensions.WLConnection) myConnection).getVendorConnection();
- Object cast (Simple Type) java.sql.Connection vendorConn = ((WLConnection) myConnection).getVendorConnection();
The Simple Type cases are detected as long as one of these two import statements is present:
- import weblogic.jdbc.extensions.WLConnection;
- import weblogic.jdbc.extensions.*;