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
- React Native
- 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
Read a file having a list of telnet commands and execute them one by one using Java
Open a .docx file and show content in a TextArea using Java
Step by Step guide to setup freetts for Java
Of Object, equals (), == and hashCode ()
Using the AWS SDK for Java in Eclipse
DateFormat sample program in Java
concurrent.Flow instead of Observable class in Java
Calculator application in Java
Sending Email from Java application (using gmail)