How do you specify the username and password for a JDBC connection when acessing a secure database?
+7
A:
You should be able to specify them in DriverManager.getConnection()
, like
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@" + dbname,
dbusername, dbpassword);
Michael Myers
2009-06-08 21:49:48
+1
A:
The DriverManager.getConnection method has a signature which takes a username and password. In addition, JDBC drivers tend to support specifying them on the URL
Yishai
2009-06-08 21:51:22