public static ResultSet sqlread(String S){
ResultSet rs = null;
try
{
// create a mysql database connection
String myUrl = "jdbc:mysql://localhost:3306/firewall?zeroDateTimeBehavior=convertToNull";
Class.forName("com.mysql.jdbc.Driver");
Connection conn = DriverManager.getConnection(myUrl, "root", "Cns@54321");
Statement st = conn.createStatement();
// note that i'm leaving "date_created" out of this insert statement
rs = st.executeQuery(S);
}
catch (Exception e)
{
System.err.println("Got an exception!");
System.err.println(e.getMessage());
}
return rs;
}
ResultSet rs = null;
try
{
// create a mysql database connection
String myUrl = "jdbc:mysql://localhost:3306/firewall?zeroDateTimeBehavior=convertToNull";
Class.forName("com.mysql.jdbc.Driver");
Connection conn = DriverManager.getConnection(myUrl, "root", "Cns@54321");
Statement st = conn.createStatement();
// note that i'm leaving "date_created" out of this insert statement
rs = st.executeQuery(S);
}
catch (Exception e)
{
System.err.println("Got an exception!");
System.err.println(e.getMessage());
}
return rs;
}
Comments
Post a Comment