Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connection properties along with JDBC URL for oracle thin driver

Tags:

jdbc

How to supply DB connection properties along with JDBC URL when we used Oracle thin driver

like image 939
suresh Avatar asked Nov 08 '22 21:11

suresh


1 Answers

Oracle has a very good documentation on that point.

It boils down to:

Create a Properties file, add the connection properties you need and add them into your call to

 getConnection(String URL, Properties info);

Given your comment, you could try the following - but I could find no documentation that this connection property is actually available on the thin driver. This document that points to that driver suggests it's part of the deprecated weblogic oracle driver.

 Properties p = new Properties();
 p.setProperty ("user", youruser);
 p.setProperty ("password", yourpass);
 p.setProperty("EnableCancelTimeout", "true");

 Connection con = DriverManager.getConnection(jdbc:oracle:thin:@<host>:1521:<SID>), p);
like image 53
Jan Avatar answered Jan 04 '23 03:01

Jan