How do I use OS Authentication with WebLogic jDriver
for Oracle and Connection Pools?
Using OS authentication in connection pools essentially
means that you are using the UserId of the user who
started WebLogic Server. OS authentication is available
on NT and UNIX, but not on Solaris. This means that
database security will rely strictly on the security of
WebLogic; that is, if you are allowed to make a client
connection to the WebLogic Server and access the pool,
then you can get to the database.
You can do this with WebLogic jDriver for Oracle because
Oracle uses the process owner to determine who is
attempting the connection. In the case of WebLogic JDBC,
this is always the user that started the WebLogic
Server.
To set up your Oracle instance to use this feature, your
DBA needs to follow these basic steps. The full
procedure is described in more detail in your Oracle
documentation.
1. Add the following line to the INIT[sid].ORA file:
OS_AUTHENT_PREFIX = OPS$
Note that the string "OPS$" is arbitrary and up to the
DBA.
2. Log in to the Oracle server as SYSTEM.
3. Create a user named OPS$userid, where userid is some
operating system login ID. This user should be granted
the standard privileges (for example, CONNECT and
RESOURCE).
4. Once the userid is set up, you can connect with
WebLogic jDriver for Oracle by specifying "/" as the
username property and "" as the password property. Here
is an example for testing this connection with the
dbping utility:
$ java utils.dbping ORACLE "/" "" myserver
Here is a code example for WebLogic jDriver for Oracle:
Properties props = new Properties();
props.put("user", "/");
props.put("password", "");
props.put("server", "myserver");
Class.forName("weblogic.jdbc.oci.Driver").newInstance();
Connection conn = myDriver.connect("jdbc:weblogic:oracle",
props);
1. Use the Administration Console to set the attribute
for your connection pool. The following code is an
example of a JDBC connection pool configuration using
the WebLogic jDriver for Oracle:
<JDBCConnectionPool
Name="myPool"
Targets="myserver,server1"
DriverName="weblogic.jdbc.oci.Driver"
InitialCapacity="1"
MaxCapacity="10"
CapacityIncrement="2"
Properties="databaseName=myOracleDB"
What type of object is returned by ResultSet.getObject()?
WebLogic jDriver for Oracle always returns a Java object
that preserves the precision of the data retrieved.
WebLogic jDriver for Oracle returns the following from
the getObject() method:
* For columns of types NUMBER(n) and NUMBER(m,n): a
Double is returned if the defined precision of the
column can be represented by a Double; otherwise
BigDecimal is returned.
* For columns of type NUMBER: Because there is no
explicit precision, the Java type to return is
determined based on the actual value in each row, and
this may vary from row to row. An Integer is returned if
the value has a zero-valued fractional component and the
value can be represented by an integer.
For example, 1.0000 will be an integer. A long is
returned for a value such as 123456789123.00000. If a
value has a non-zero fractional component, a Double is
returned if the precision of the value can be
represented by a Double; otherwise a BigDecimal is
returned.
How do I limit the number of Oracle database connections
generated by WebLogic Server?
You can use connection pools to limit the number of
Oracle database connections generated by WebLogic Server
in response to client requests. Connection pools allow
T3 applications to share a fixed number of database
connections. For information on how to set up connection
pools,
How do I call Oracle stored procedures that take no
parameters?
Here is what we use that works:
CallableStatement cstmt = conn.prepareCall("Begin
procName;
END;");
cstmt.execute();
where procName is the name of an Oracle stored
procedure. This is standard Oracle SQL syntax that works
with any Oracle DBMS. You might also use the following
syntax:
CallableStatement cstmt = conn.prepareCall("{call
procName};");
cstmt.execute();
This code, which conforms to the Java Extended SQL spec,
will work with any DBMS, not just Oracle.
Why do I get unexpected characters from 8-bit character
sets in WebLogic jDriver for Oracle?
If you are using an Oracle database with an 8-bit
character set on Solaris, make sure you set NLS_LANG to
the proper value on the client. If NLS_LANG is unset, it
defaults to a 7-bit ASCII character set, and tries to
map characters greater than ASCII 128 to a reasonable
approximation (for example, á, à, â would all map to a).
Other characters are mapped to a question mark (?).
How do I learn what codesets are available in Oracle?
To find out what codesets you currently have available
in Oracle, execute the following SQL query from SQLPlus
at the command line:
SQL> SELECT value FROM v$nls_valid_values WHERE
parameter='CHARACTERSET';
The response lists of all codesets currently installed
on your system. This listing will look something like
the following shortened list:
VALUE
---------------
US7ASCII
WE8DEC
WE8HP
US8PC437
WE8EBCDIC37
WE8EBCDIC500
WE8EBCDIC285
...
If you want to constrain the value in the query to a
specific codeset you are searching for, you might use a
SQL query like the following:
SQL> SELECT value FROM v$nls_valid_values
WHERE parameter='CHARACTERSET' and VALUE='AL24UTFFSS';
This would produce the following response if the codeset
is installed:
VALUE
-------------------
AL24UTFFSS
You can use Oracle's installation tools to install
additional codesets. Contact Oracle for more
information.
How many deployment descriptor files does a CMP entity
bean deployed on the WebLogic Server have?
a. One J2EE specific deployment descriptor and two
WebLogic specific deployment descriptors
b. One J2EE specific deployment descriptor and one
WebLogic specific deployment descriptors
c. One J2EE specific deployment descriptor only
d. One WebLogic specific deployment descriptor only
Choice A is correct. Deployment descriptors are text
documents formatted with XML tags. The J2EE
specifications define standard, portable deployment
descriptors for J2EE components and applications. BEA
defines additional WebLogic-specific deployment
descriptors required to deploy a component or
application in the WebLogic Server environment.
When packaging an enterprise bean, we need to create an
ejb-jar.xml deployment descriptor in the META-INF
subdirectory and add entries for the bean. We also need
to create a weblogic-ejb-jar.xml deployment descriptor
in the META-INF subdirectory and add entries for the
bean. If the bean is an entity bean with
container-managed persistence, first we create a
weblogic-rdbms-cmp-jar-bean_name.xml deployment
descriptor in the META-INF directory with entries for
the bean. Then we map the bean to this CMP deployment
descriptor with a attribute in the weblogic-ejb-jar.xml
file.
Page Numbers :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18