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
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. thanku verymuch. very helpfull
View Tutorial By: praveen at 2010-08-05 06:04:35
2. Very nice tutorial :)
I have teste
View Tutorial By: yannoo95170 at 2015-06-18 00:30:26
3. Hi
I can able to execute the abov
View Tutorial By: sruthy at 2010-07-23 03:29:39
4. this is because dear u r using here postfix increm
View Tutorial By: sajid at 2011-09-06 20:51:54
5. when I exported the data to excel there is a value
View Tutorial By: mizhelle at 2015-10-10 13:17:56
6. Thanks great tutorial..
View Tutorial By: Abul Rahman at 2009-07-24 11:39:52
7. Now what the hell does all this mean???
To
View Tutorial By: Søren at 2011-09-22 03:13:53
8. thanks alot!
View Tutorial By: gumuruh at 2010-11-06 11:27:18
9. All in all is not a comment.bt a question How 2 us
View Tutorial By: Tkalani at 2009-06-03 02:16:14
10. i am using tata photon+ modem ,so which csca numb
View Tutorial By: ganesh at 2011-01-30 12:11:01