this is a Java Code i wrote in Eclipse to retrieve information from a MySQL Database.. But the Compiler is giving an error saying conn cannot be resolved to a type.. can anyone pls tel me what i may be doin wrng??
import java.sql.*;
public class plh {
static Connection conn=null;
static Statement s=null;
public static void main(String[] args){
try {
Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/wonkashop","root", "");
String st= new String("select * from users;");
s= new conn.createStatement(st);//ERROR.. why??
}
catch (Exception e) {
System.out.println("Unable to connect to Database");
}
}
}