Skip to content

Latest commit

 

History

History
59 lines (44 loc) · 2.33 KB

File metadata and controls

59 lines (44 loc) · 2.33 KB
title getReference Method (SQLServerDataSource) | Microsoft Docs
ms.custom
ms.date 01/19/2017
ms.prod sql
ms.prod_service connectivity
ms.reviewer
ms.technology connectivity
ms.topic conceptual
apiname
SQLServerDataSource.getReference
apilocation
sqljdbc.jar
apitype Assembly
ms.assetid b3fb1a97-86ee-4977-adca-c35ae199dbb3
author David-Engel
ms.author v-daenge

getReference Method (SQLServerDataSource)

[!INCLUDEDriver_JDBC_Download]

Returns a reference to this SQLServerDataSource object.

Syntax

  
public javax.naming.Reference getReference()  

Return Value

A Reference object.

Remarks

This getReference method is specified by the getReference method in the javax.naming.Referenceable interface.

Prior to [!INCLUDEssNoVersion] JDBC Driver 3.0, if SQLServerDataSource.setTrustStorePassword was called on a SQLServerDataSource object, the password would be present in the object returned by SQLServerDataSource.getReference, allowing the object to be used to make additional connections. In JDBC Driver 3.0, you will need to set the password on the object returned by SQLServerDataSource.getReference before you make connections with the object.

Also, if you set SQLServerDataSource.setTrustStorePassword before binding the data source properties, you must call SQLServerDataSource.setTrustStorePassword before getting the connection. For example,

ctx = new InitialContext(System.getProperties());  
  
SQLServerDataSource ds1 = (SQLServerDataSource) ctx.lookup(jndiName);  
  
ds1.setTrustStorePassword("XXXXX");  
Connection con = ds1.getConnection("user", "XXXXXX");  
  
ctx.rebind(jndiName, ds1);  
SQLServerDataSource ds2 = (SQLServerDataSource) ctx.lookup(jndiName);  
ds2.setTrustStorePassword("XXXXX");   // reset the truststore password  
con = ds2.getConnection("user", "XXXXXX");   // provide userid and password again  

See Also

SQLServerDataSource Members
SQLServerDataSource Class