java - Establishing JDBC through SID -


i connecting oracle 11g db trough java program. using service name , not sid.

addr = jdbc:oracle:thin:@hostip:1521:servicename class.forname("oracle.jdbc.oracledriver"); connection con = drivermanager.getconnection(addr,un,pw); statement stat = con.createstatement(); resultset rs = stat.executequery(select * table); 

this works great. able connect db , retrieve data.

however, if pass service id instead of service name, code doesn't work! exception. tried solution mentioned here - java jdbc - how connect oracle using service name instead of sid. still see same exception.


Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -