how can you retrive information from database by using
hashmap/arraylist ,plz explain with example briefly?
Answer / none
import java.util.*;
import java.sql.*;
public class Jdbc
{
public static void main(String[] a)
{
Connection conn=null;
try
{
String s1="Driver name for registration";
Class.forname(s1);
String url="Driver Port No name";
String username="Database Username";
String password="Database password";
conn=Drivermanager.getConnection(url,username,password);
String sql="SELECT name,address FROM tb"
Statement stmt=conn.createStatement(sql);
Resultset rs=stmt.executeQuery();
ArrayList al=new List();
while(rs.hasnext())
{
al.add(index,rs.getString());
}
rs.close();
stmt.close();
conn.close();
}
//handle Exceptions
}
}
Is This Answer Correct ? | 8 Yes | 4 No |
write a program to create an vector and listeterator.and value should be enter through keyboard.
What is the biggest integer?
How do you convert string to int in java?
what is thread? What are the high-level thread states? : Java thread
What is float in java?
what is main purpose of interface?
2 Answers Accenture, HCL, NIIT,
Which class should you use to obtain design information about an object in java programming?
What is private static class in java?
Realized?
What is scanner in java?
How do you start a new line in java?
is it mandatory to deaclare all variables public static fianl in interfaces?if i declare like in the below program, public interface A { public static final int I=0; int j=0; } in interface A,what is the difference between I,j?