File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to get a string return from JPasswordField?

 
qionghua yang
Ranch Hand
Posts: 68
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am using JPasswordField in my program. I would like to use this password to access to my Informix Database.
Some source code:
.....
JPasswordField password = new JPasswordField();
.....
Connection c = DriverManager.getConnection(url, userName.getText(), password.getPassword());
.....
This gives me some the compile error because the return value of getPassword is char[], and the DriverManager is expecting a String.
Anyone can help? Thanks!
qionghua

 
Peter Tran
Bartender
Posts: 783
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then you should create a String object from the char[] like this,

-Peter
 
qionghua yang
Ranch Hand
Posts: 68
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot, peter.
qionghua
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic