Re: ERROR 1193 (HY000): Unknown system variable
Posted by: Macamba .
Date: August 08, 2015 05:27AM

Todd Farmer Wrote:
> Hi Macamba,
> I'm a little confused about what this statement
> aims to do - can you clarify?

Hi Todd,

Thanks for taking the time to delve into my problem. I'm still programming with my training wheels on my bike.

This is the code I'm trying to run:
public void create(Project project) throws IllegalArgumentException, DAOException {
	if (project.getProjectId() != 0) {
		throw new IllegalArgumentException("Project is already created, the project ID is not null.");

	Object[] values = { project.getProjectNumber(), project.getProjectName(), 
			project.getActivity(), project.getPerNumber(),
			toSqlDate(project.getDate()), project.getTime()}; 

	System.out.println ("Data:  projectNumber=" + project.getProjectNumber() +
			", project=" + project.getProjectName() +
			", activity=" + project.getActivity() +
			", perNumber=" + project.getPerNumber() +
			", day=" + project.getDate() +
			", worked_time=" + project.getTime() );
	System.out.println ("Query: " + SQL_INSERT_PROJECT);
	try (Connection connection = daoFactory.getConnection();
		PreparedStatement statement = prepareStatement(connection, SQL_INSERT_PROJECT, 
				true, values);) {
		int affectedRows = statement.executeUpdate();
		if (affectedRows == 0) {
			throw new DAOException("Creating user failed, no rows affected.");
		try (ResultSet generatedKeys = statement.getGeneratedKeys()) {
			if ( {
			} else {
				throw new DAOException("Creating user failed, no generated key obtained.");
	} catch (SQLException e) {
		throw new DAOException(e);

The prepared statement is:
private static final String SQL_UPDATE = "SET projectnumber=?, project=?, activity=?, " + 
	" per_number=?, day=?, worked_time=? FROM projects WHERE pro_id=?";

And this is the code from above portion of code:
ProjectDAOImplementation: update(): 
	personnel number=100101, 
	project ID=2.
SET projectnumber=?, project=?, activity=?,  per_number=?, day=?, worked_time=? 
FROM projects 
WHERE pro_id=?

class - java.sql.SQLException: 
	Unknown system variable 'projectnumber'
Exception in thread "main" java.lang.NullPointerException

I used the output from my code to recreate the query in the MySQL console. The result I posted in my question. The result is the same (?)

Why is my column name 'projectnumber' an unknow system variable, as in I'm scratching my head.

Options: ReplyQuote

Written By
Re: ERROR 1193 (HY000): Unknown system variable
August 08, 2015 05:27AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.