Re: Is there a way to know which driver (thick / thin jdbc, odbc, .net, oci, ...) was used to connect to the database

  • From: Niall Litchfield <niall.litchfield@xxxxxxxxx>
  • To: Bruce.Reardon@xxxxxxxxxxxx
  • Date: Tue, 7 Jul 2009 09:35:07 +0100

Very nice Bruce (Jacques)

Even nicer in 11g where the definition of this view is

SID NUMBER Session identifier (can be used to join this view with V$SESSION)
AUTHENTICATION_TYPE VARCHAR2(26) How the user was authenticated:
DATABASE - Username/password authentication
OS - Operating system external user authentication
NETWORK - Network protocol or ANO authentication
PROXY - OCI proxy connection authentication
OSUSER VARCHAR2(30) External username for this database user
NETWORK_SERVICE_BANNER VARCHAR2(4000) Product banners for each Oracle
Net service used for this connection (one row per banner)
CLIENT_CHARSET VARCHAR2(40) Client character set as specified in the
NLS_LANG environment variable or in the OCIEnvNlsCreate() call;
Unknown if the Oracle client is older than release 11.1 or the
connection is through the JDBC thin driver
CLIENT_CONNECTION VARCHAR2(13) Client server connection flags:
CLIENT_OCI_LIBRARY VARCHAR2(27) OCI client library:
CLIENT_VERSION VARCHAR2(40) Client library version number
CLIENT_DRIVER VARCHAR2(9) Client driver name
CLIENT_LOBATTR VARCHAR2(23) Client LOB flags:
CLIENT_REGID NUMBER Query cache registration ID sent by the client



On Tue, Jul 7, 2009 at 12:39 AM, Reardon, Bruce
(RTABBAY)<Bruce.Reardon@xxxxxxxxxxxx> wrote:
> I use v$session_connect_info to distinguish between BEQ and Net8
> connections.
> I am not sure if this will help with distinguishing thick and thin
> drivers (don't have easy way to test at the moment).
>
> Example script - with thanks to Jacques R. Kilchoer response to Oracle-L
> in 19-Apr-2001 :
>
>
> COLUMN connection_method HEADING "Con Type" FORMAT A15 WRAP
>
> select
>   a.sid,
>   a.serial#,
>   a.username,
>   decode (rtrim (substr (b.network_service_banner, 1, 18)) ,
>           'Windows NT TCP/IP'  , 'SQL*Net' ,
>           'Oracle Bequeath NT' , 'Bequeath' ,
>           'Windows NT Named P' , 'IPC - Named Pipes' ,
>           'Other? - ' || b.network_service_banner
>          ) as connection_method
>  from
>   v$session a,
>   v$session_connect_info b
>  where
>   a.sid = b.sid(+)
>   AND ( INSTR ( b.network_service_banner , 'Oracle Advanced Security' )
> = 0
>         OR b.network_service_banner IS NULL
>       )
> ;
>
>
> Regards,
> Bruce Reardon
>
> ------------------------------------------------------------------------
> ---------------
>
> Hi Freek,
>
> my tests on 10.2.0.3 Linux show that at least the JDBC driver set the
> program column in v$session
> thin driver - connection string jdbc:oracle:thin:@... program = 'JDBC
> Thin Client'
> OCI (thick) - connection string jdbc:oracle:oci:@..  program =
> 'java.exe'
>
> HTH
> Jaromir
>
> This email is confidential and may also be privileged.  If you are not the 
> intended recipient, please notify us immediately and delete this message from 
> your system without first printing or copying it. Any personal data in this 
> email (including any attachments) must be handled in accordance with the Rio 
> Tinto Group Data Protection Policy and all applicable data protection laws.
> --
> //www.freelists.org/webpage/oracle-l
>
>
>



-- 
Niall Litchfield
Oracle DBA
http://www.orawin.info
--
//www.freelists.org/webpage/oracle-l


Other related posts: