Location.java:55: cannot find symbol
symbol : method preparedStatement(java.lang.String)
location: interface java.sql.Connection
PreparedStatement passwordQuery = conn.preparedStatement
(
^
1 error
package location;
import java.sql.*;
import java.io.*;
import java.util.*;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;
public class Location {
public String getFrmPin() {
//if (pin == null) {
Context ctx = new InitialContext();
DataSource ds= (DataSource) ctx.lookup("jdbc:mysql://localhost:3306/jobprop");
Connection conn = ds.getConnection();
try {
PreparedStatement passwordQuery = conn.preparedStatement(
"SELECT * FROM users WHERE username = ?");
passwordQuery.setString(1, "abc");
ResultSet result = passwordQuery.executeQuery();
} finally {
conn.close();
}
}
}
anyone know why i can't compile? BTW i removed some of the .java code, in case it looks wierd.