Skip to Main Content

Java Database Connectivity (JDBC)


For appeals, questions and feedback, please email

Issue with Query Results when Including Angle Condition

Knag zengJul 5 2023


I'm currently facing an issue with my code and would appreciate some assistance in identifying the error. Here's a brief description of the problem:

When I include the angle condition in my SQL query, the data returned is incorrect. However, if I remove the angle condition, the query returns the correct data.

Here's an excerpt of the relevant code:

Copy code
// Connection to the database
String url = "jdbc:mysql://localhost:3306/product";
String username = "root";
String password = "123456";
Connection conn = null;
PreparedStatement preparedStatement = null;
ResultSet resultSet = null;

conn = DriverManager.getConnection(url, username, password);

// Parameter handling
String[] sizeOptions = request.getParameterValues("sizeOption");
String[] CurOptions = request.getParameterValues("curOption");
String d_minParam = request.getParameter("d_min");
String d_maxParam = request.getParameter("d_max");
String angle_minParam = request.getParameter("angle_min");
String angle_maxParam = request.getParameter("angle_max");
String i_minParam = request.getParameter("i_min");
String i_maxParam = request.getParameter("i_max");

// Code continues...
I have examined the code and suspect that the issue lies in the angle condition of the SQL query. However, I can't pinpoint the exact cause of the problem.

Any help or insights on resolving this issue would be greatly appreciated. Thank you in advance for your assistance.

I want to insert the battery swap plan in this

Post Details
Added on Jul 5 2023