Comment on Tutorial - HashMap example in Java By Charles
Comment Added by : A Sadist
Comment Added at : 2012-07-05 12:13:45
Comment on Tutorial : HashMap example in Java By Charles
answers to the questions asked by ranjan in comment #24
yes ranjan it is very task if u has small knowledge on jdbc,
i will write the code(only logic) regarding to ur question:
step1:load driver
step2:create connection
step3:create statement
step3:execute quire and store the result in ResultSet
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con= DriverManager.getConnection("jdbc:odbc:FTW", "ur_name", "ur_lover_name");
//generally usernames are their names and passwords are their lover names//Step1
String st1="select uname, pass from Emp";
Statement st = con.createStatement();
ResultSet rs=st.executeQuery(st1);
Map m1 = new HashMap();
String my_name,my_lover_name;
while(rs.next())
{
my_name = rs.getString(1);//i.e user name
my_lover_name = rs.getString(2);//i.e passward
m1.put(my_name , my_lover_name); //here we add to our map
}
see how romantic this java is just enjoy
View Tutorial
- Data Science
- Android
- AJAX
- ASP.net
- C
- C++
- C#
- Cocoa
- Cloud Computing
- HTML5
- Java
- Javascript
- JSF
- JSP
- J2ME
- Java Beans
- EJB
- JDBC
- Linux
- Mac OS X
- iPhone
- MySQL
- Office 365
- Perl
- PHP
- Python
- Ruby
- VB.net
- Hibernate
- Struts
- SAP
- Trends
- Tech Reviews
- WebServices
- XML
- Certification
- Interview
categories
Subscribe to Tutorials
Related Tutorials
Program using concept of byte long short and int in java
Update contents of a file within a jar file
Tomcat and httpd configured in port 8080 and 80
Count number of vowels, consonants and digits in a String in Java
Student marks calculation program in Java
Calculate gross salary in Java
Calculate average sale of the week in Java
Vector in Java - Sample Program
MultiLevel Inheritance sample in Java
Archived Comments
1. Your output is not correct.. Give the correct out
View Tutorial By: Surendrakumar at 2014-06-04 07:00:16
2. i am using tata photon+ modem ,so which csca numb
View Tutorial By: ganesh at 2011-01-30 12:11:01
3. Sorry about this. I cannot run this program becaus
View Tutorial By: TanSW at 2008-04-28 20:14:20
4. i will make to try for rms :)
View Tutorial By: sebo at 2010-05-20 07:38:28
5. thanks for the definition...more power :)
View Tutorial By: saluki at 2011-07-19 05:36:00
6. It is the same as #include
View Tutorial By: Ballu at 2011-07-04 06:42:55
7. yes , this article is good & very help ful to
View Tutorial By: Laxmipriya at 2011-05-02 02:36:36
8. Can you Please send me the code for movable clock
View Tutorial By: Rajagopal at 2008-09-29 23:10:57
9. Very good examples are given by you on overloading
View Tutorial By: Ankur Rautela at 2011-11-03 10:22:46
10. My code runs smoothly. I have taken some steps for
View Tutorial By: Amit Shrivastava at 2015-01-25 13:48:46