• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to get SQLServerDataSource reference....

 
nilesh bhattad
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a way to get a referece of SQLServerDataSouce from JNDI... ?
Following code throws ClassCastException....
Context ctx = (Context) new InitialContext();
SQLServerDataSource ds = (SQLServerDataSource) ctx.lookup("jdbc/RiskAppetite");
ds.setSelectMethod("cursor");
Connection con = ds.getConnection("RiskAppetiteAppID", "RiskAppetiteAppID");
System.out.println(con);
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!