/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
In order to access to
*/
package helloworld;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Scanner;
import java.sql.*;
/**
*// In order to get database mysql connection you need add mysql-connector-java-5.0.8.tar jar file to the libraries in netbeans or eclipse
for doubts contact jayachandra1805@gmail.com
* @author jayachandra
*/
public class Helloworld {
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws ClassNotFoundException, SQLException {
// TODO code application logic here
char c;
Hashtable ht=new Hashtable();
for(int i=0;i<10;i++) { ht.put(i,"a"); } // public final native Class getClass();
System.out.println(!ht.contains("ad"));
Enumeration e=ht.keys();
while(e.hasMoreElements())
{
System.out.println(ht.get(e.nextElement()));
}
Scanner sc=new Scanner(System.in);
sqlConnection();
}
public static void sqlConnection() throws ClassNotFoundException, SQLException{
Connection con;
Statement st;
ResultSet rs;
Class.forName("com.mysql.jdbc.Driver");
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/practice","root", "root");
System.out.println(con);
String s="Select * from orders"; // write any query here
st=con.createStatement();
rs=st.executeQuery(s); // query is performing on database
if (rs.next()) {
System.out.print(rs.getString(1)+" ");
System.out.print(rs.getString(2)+" ");
System.out.print(rs.getString(3)+ " ");
}
con.close();
}
}
* To change this template, choose Tools | Templates
* and open the template in the editor.
In order to access to
*/
package helloworld;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Scanner;
import java.sql.*;
/**
*// In order to get database mysql connection you need add mysql-connector-java-5.0.8.tar jar file to the libraries in netbeans or eclipse
for doubts contact jayachandra1805@gmail.com
* @author jayachandra
*/
public class Helloworld {
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws ClassNotFoundException, SQLException {
// TODO code application logic here
char c;
Hashtable ht=new Hashtable();
for(int i=0;i<10;i++) { ht.put(i,"a"); } // public final native Class getClass();
System.out.println(!ht.contains("ad"));
Enumeration e=ht.keys();
while(e.hasMoreElements())
{
System.out.println(ht.get(e.nextElement()));
}
Scanner sc=new Scanner(System.in);
sqlConnection();
}
public static void sqlConnection() throws ClassNotFoundException, SQLException{
Connection con;
Statement st;
ResultSet rs;
Class.forName("com.mysql.jdbc.Driver");
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/practice","root", "root");
System.out.println(con);
String s="Select * from orders"; // write any query here
st=con.createStatement();
rs=st.executeQuery(s); // query is performing on database
if (rs.next()) {
System.out.print(rs.getString(1)+" ");
System.out.print(rs.getString(2)+" ");
System.out.print(rs.getString(3)+ " ");
}
con.close();
}
}