Bug #14505 CachedRowSet - PreparedStatement
Submitted: 31 Oct 2005 9:27 Modified: 31 Mar 2014 9:58
Reporter: Christian Augustat Email Updates:
Status: Can't repeat Impact on me:
None 
Category:Connector / J Severity:S2 (Serious)
Version:3.1.11 OS:Windows (Windows XP)
Assigned to: Alexander Soklakov CPU Architecture:Any

[31 Oct 2005 9:27] Christian Augustat
Description:
When using PreparedStatements together with a CachedRowSet, it is not possible to update a tablefield that is inside a sheme, that has a "-" in the name.

How to repeat:
Shema Name: `sdemig-ngt`
Tablename: `filename`

[Java Snipplet]
	public CachedRowSet getFiles() throws SQLException {

		ResultSet resultSet = null;

		String query = "SELECT * FROM `sdemig-ngt`.`filename`";

		
		PreparedStatement stmt = conn.prepareStatement(query);
		//stmt.setString(1,"%");
		logger.fine("running statement:" + stmt.toString());
		resultSet = stmt.executeQuery();
		CachedRowSet cRS = new CachedRowSetImpl();
		cRS.populate(resultSet);
		return cRS;

	}

	public void writeCachedRowSet(CachedRowSet cRS) throws SyncProviderException {
		cRS.acceptChanges(conn);
	}

[END OF JAVA]

[EXCEPTION]

Error was:object is not a file
java.sql.SQLException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-ngt.filename WHERE F1 = 'no file found: 7403-50-1-424-1| path: g:\\gas\\XXX' at line 1
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2926)
	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1571)
	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1666)
	at com.mysql.jdbc.Connection.execSQL(Connection.java:2978)
	at com.mysql.jdbc.Connection.execSQL(Connection.java:2902)
	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:933)
	at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1027)
	at com.sun.rowset.internal.CachedRowSetWriter.updateOriginalRow(CachedRowSetWriter.java:488)
	at com.sun.rowset.internal.CachedRowSetWriter.writeData(CachedRowSetWriter.java:331)
	at com.sun.rowset.CachedRowSetImpl.acceptChanges(CachedRowSetImpl.java:859)
	at com.sun.rowset.CachedRowSetImpl.acceptChanges(CachedRowSetImpl.java:919)
	at sde.tim.dwg_mass_converter.DBConnector.writeCachedRowSet(DBConnector.java:101)
	at sde.tim.dwg_mass_converter.DwgConverter.permanent_errorAbort(DwgConverter.java:80)
	at sde.tim.dwg_mass_converter.DwgConverter.checkFile(DwgConverter.java:69)
	at sde.tim.dwg_mass_converter.DwgConverter.getfilenames(DwgConverter.java:47)
	at sde.tim.dwg_mass_converter.DwgConverter.main(DwgConverter.java:36)
Exception in thread "main" javax.sql.rowset.spi.SyncProviderException: 16132 conflicts while synchronizing 
	at com.sun.rowset.internal.CachedRowSetWriter.writeData(CachedRowSetWriter.java:382)
	at com.sun.rowset.CachedRowSetImpl.acceptChanges(CachedRowSetImpl.java:859)
	at com.sun.rowset.CachedRowSetImpl.acceptChanges(CachedRowSetImpl.java:919)
	at sde.tim.dwg_mass_converter.DBConnector.writeCachedRowSet(DBConnector.java:101)
	at sde.tim.dwg_mass_converter.DwgConverter.permanent_errorAbort(DwgConverter.java:80)
	at sde.tim.dwg_mass_converter.DwgConverter.checkFile(DwgConverter.java:69)
	at sde.tim.dwg_mass_converter.DwgConverter.getfilenames(DwgConverter.java:47)
	at sde.tim.dwg_mass_converter.DwgConverter.main(DwgConverter.java:36)
[END OF EXCEPTION]

Suggested fix:
Workarround: Just rename the shema, so that the "-" is no more inside the name, then it will work fine.
[1 Nov 2005 10:51] Vasily Kishkin
As far as I can understand you use SDK 1.5. Unfortunally I was not able to find where I could download. Could you please say me URL of the SDK.
[1 Nov 2005 13:37] Mark Matthews
Have you filed a bug w/ Sun? Their implementation of CachedRowSet is responsible for producing that query, which has a syntax error (we've had this happen before in other bugs).
[2 Dec 2005 0:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[31 Mar 2014 9:58] Alexander Soklakov
I close this report as "Can't repeat" because there is no feedback for a long time and codebase is too old. Please, feel free to reopen it if the problem still exists in current driver.