JDBC+SSL?
- From: "Ted" <r.ted.byers@xxxxxxxxxx>
- Date: 15 Dec 2005 14:12:22 -0800
OK, I am working with MySQL and Postgres. Both indicate I can create
connections to them using SSL so that data exchanged with them is
encrypted while in transit. The question is,"How do I use JDBC to
create a secure connection instead of a clear text connection?"
What would I change in the following to ensure sensitive data is
encrypted between my servlet and the database back end?
String driver = "org.postgresql.Driver";
try {
Class.forName(driver);
} catch (ClassNotFoundException e1) {
RequestDispatcher dispatcher =
request.getRequestDispatcher("/LoginError.jsp");
dispatcher.forward(request, response);
}
String url = "jdbc:postgresql://localhost/People";
// credentials offered by the user
String user = lBean.getUid();
String pword = lBean.getPword();
try {
Connection con = DriverManager.getConnection(url, user,
pword);
} catch (SQLException e2) {
RequestDispatcher dispatcher =
request.getRequestDispatcher("/LoginError.jsp");
dispatcher.forward(request, response);
}
// code to assess user credentials offered and redirect
accordingly
I think I know how to tell my database servers what certificate to use,
but how do I tell JDBC what certificate to use, and how do I tell both
servers to accept the certificates I've created for them? I am not
sure, though, because I have not figured out how to use JDBC to test
it. These certificates will be self signed, but that's OK since I
trust myself.
Any ideas?
Thanks
Ted
R.E. (Ted) Byers, Ph.D., Ed.D.
R & D Decision Support Software
http://www.randddecisionsupportsolutions.com/
.
- Follow-Ups:
- Re: JDBC+SSL?
- From: Mladen Adamovic
- Re: JDBC+SSL?
- Prev by Date: J2EE: Storing hierarchical data
- Next by Date: Re: J2EE: Storing hierarchical data
- Previous by thread: J2EE: Storing hierarchical data
- Next by thread: Re: JDBC+SSL?
- Index(es):
Relevant Pages
|
|