The following code works under WebLogic, JRun, etc:

Clob clob = rs.getClob(1);
if(clob instanceof oracle.sql.CLOB)
   outStream = ((oracle.sql.CLOB)clob).getCharacterOutputStream();
else
   outStream = 
   ((weblogic.jdbc.common.OracleClob)clob).getCharacterOutputStream();

You don't need introspection or several packages from WebLogic at
runtime.
All that you need is weblogic.jar when you are compiling this code.
Since only WebLogic uses weblogic.jdbc.common.OracleClob (BTW, WL 6.1
SP2 - 6.1 SP4), you never reach "else" branch at runtime and never get
ClassNotFound exception under JBOSS, if you do not import
weblogic.jdbc.common.* in the class header.
We (with Siarhei) use it about 2 years...

Best regards,
Ihar Makushynski
 
-----Original Message-----
From: A mailing list for Enterprise JavaBeans development
[mailto:[EMAIL PROTECTED] On Behalf Of Siarhei Adzinets
Sent: Thursday, April 08, 2004 9:40 AM
To: [EMAIL PROTECTED]
Subject: Re: [EJB-INT] How to find out the type of application Server at
Runtime

By the way, what version of weblogic do you use?
I know that Weblogic 6.1 wraps LOB data with its specific class. All
upper
versions do not do this.

Also, you don't need to include all weblogic.jar with your application.
Can
extract weblogic.jdbc.common package only.

----- Original Message -----
From: "Chester Chen" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 08, 2004 12:21 AM
Subject: Re: How to find out the type of application Server at Runtime


> That's a good point. Unless you include all the application specific
.jar
> files
> (in this case weblogic.jar), you will get the ClassNotFound Exception.
>
> And It does not make much sense to include weblogic.jar when running
JBOSS.
>
> Chester
>
>
>
>
> > -----Original Message-----
> > From: Alex Paransky [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, April 07, 2004 2:07 PM
> > To: Chester Chen
> > Cc: [EMAIL PROTECTED]
> > Subject: Re: How to find out the type of application Server at
Runtime
> >
> >
> > Wouldn't you get a ClassNotFound exception when trying to run under
> > JBOSS using the weblogic.jdbc.common.OracleClob in your code?
> >   I think
> > you need to use introspection.
> >
> > -AP_
> > Chester Chen wrote:
> >
> > >Thanks for all the replies.  I guess there is no Metadata to
> > work with.
> > >
> > >the instanceof operator works for me.
> > >
> > >Thanks
> > >
> > >
> > >Chester
> > >
> > >
> > >
> > >>-----Original Message-----
> > >>From: Siarhei Adzinets [mailto:[EMAIL PROTECTED]
> > >>Sent: Tuesday, April 06, 2004 11:45 PM
> > >>To: [EMAIL PROTECTED]
> > >>Subject: Re: How to find out the type of application Server
> > at Runtime
> > >>
> > >>
> > >>Hi, Chester,
> > >>
> > >>I suggest you using instanceof operator.
> > >>Something like this:
> > >>
> > >>Clob clob = rs.getClob(1);
> > >>if(clob instanceof oracle.sql.CLOB)
> > >>      outStream =
> > ((oracle.sql.CLOB)clob).getCharacterOutputStream();
> > >>else
> > >>       outStream =
> >
>>((weblogic.jdbc.common.OracleClob)clob).getCharacterOutputStream();
> > >>
> > >>
> > >>Best regards,
> > >>Siarhei Adzinets
> > >>
> > >>----- Original Message -----
> > >>From: "Chester Chen" <[EMAIL PROTECTED]>
> > >>To: <[EMAIL PROTECTED]>
> > >>Sent: Tuesday, April 06, 2004 10:37 PM
> > >>Subject: How to find out the type of application Server at Runtime
> > >>
> > >>
> > >>
> > >>
> > >>>Hi,
> > >>>    Is there a way to find out the type of application server
> > >>>for example: Weblogic, JBOSS or Web Server, at runtime from code
?
> > >>>
> > >>>    Some sort of Application Server Metadata will help.
> > >>>
> > >>>    I am adding LOB support for Application Server. As the
> > >>>weblogic needs special JDBC Oralce extension for Oralce
> > >>>
> > >>>
> > >>Thin driver (for
> > >>
> > >>
> > >>>retrieving LOB) , I need
> > >>>to cast the proper class at run time for different
> > >>>
> > >>>
> > >>application Servers.
> > >>
> > >>
> > >>>   Any suggestions ?
> > >>>
> > >>>   Also, an related question: Does JBOSS or WebSphere need
> > >>>
> > >>>
> > >>JDBC extensions
> > >>
> > >>
> > >>>for Oracle Thin Driver ?
> > >>>   Some example or some pointers are appreciated
> > >>>
> > >>>
> > >>>Thanks
> > >>>
> > >>>Chester
> > >>>
> > >>>
> > >>>
> > >>>
> > >>==============================================================
> > >>=============
> > >>
> > >>
> > >>>To unsubscribe, send email to [EMAIL PROTECTED] and
> > >>>
> > >>>
> > >>include in the
> > >>body
> > >>
> > >>
> > >>>of the message "signoff EJB-INTEREST".  For general help,
> > >>>
> > >>>
> > >>send email to
> > >>
> > >>
> > >>>[EMAIL PROTECTED] and include in the body of the
> > message "help".
> > >>>
> > >>>
> > >>==============================================================
> > >>=============
> > >>To unsubscribe, send email to [EMAIL PROTECTED] and
> > >>include in the body
> > >>of the message "signoff EJB-INTEREST".  For general help,
> > >>send email to
> > >>[EMAIL PROTECTED] and include in the body of the message
"help".
> > >>
> > >>
> > >>
> > >
> > >=============================================================
> > ==============
> > >To unsubscribe, send email to [EMAIL PROTECTED] and
> > include in the body
> > >of the message "signoff EJB-INTEREST".  For general help,
> > send email to
> > >[EMAIL PROTECTED] and include in the body of the message
"help".
> > >
> > >
> > >
> >
> > --
> > -AP_
> > http://www.myprofiles.com/member/profile/apara_personal
> > http://www.myprofiles.com/member/profile/apara_business
> >
> >
>
>
========================================================================
===
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff EJB-INTEREST".  For general help, send email
to
> [EMAIL PROTECTED] and include in the body of the message "help".

========================================================================
===
To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to