JDBC规范-java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]The specified SQL type is not supported by this driver
2006-10-12 23:12
966 查看
The java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]The specified SQL type is not supported by this driver is returned from JDBC Driver (DataDirect Connect JDBC, WebSphere embedded Connect JDBC or Microsoft SQL Server 2000 Driver) when an application uses something that is not supported by the JDBC Driver. The JDBC specification, Chapter 17 Customized Type Mapping, section 17.7 on "NULL Data" states: "An application uses the existing getObject and setObject mechanism to retrieve and store SQLData values. We note that when the second parameter, x, of method PreparedStatement.setObject has the value null, the driver executes the SQL statement as if the SQL literal NULL had appeared in its place. void setObject (int i, Object x) throws SQLException; When parameter x is null, there is no enforcement that the corresponding argument expression is of a Java type that could successfully be passed to that SQL statement if its value were not null. The Java programming language null carries no type information. For example, a null Java programming language variable of class AntiMatter could be passed as an argument to an SQL statement that requires a value of SQL type MATTER, and no error would result, even though the relevant type map object did not permit the translation of MATTER to AntiMatter." Based on the JDBC specification, it is not recommended to use setObject(int, null). |
[b]Solution[/b] |
The following 3 setObject methods are available for use with the PreparedStatement object: setObject(int, Object) setObject(int, Object, int) setObject(int, Object, int, int) Using the second method setObject(int, Object, int) where the third parameter is the targetJDBCType works fine. For example: setObject(1, null, java.sql.Types.VARCHAR) |
相关文章推荐
- java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]The DBMS returned an unspecified error.
- java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]The DBMS returned an unspecified e
- java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]ResultSet can not re-read row dat
- java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]ResultSet can not re-read row data for column 4.
- java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]ResultSet can not re-read row dat
- 用sql server2005的错误 java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket. 解决办法
- java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Connection reset
- java里连接sqlserver对象名无效的解决方法 java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]对象名 无效
- java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]传入的表格格式数据流(TDS)远程过程调用(R
- java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]对象名 'xxx' 无效
- java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket解决
- 解决java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket这个异常
- java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]对象名 ‘xxx’ 无效
- 关于javax.servlet.ServletException: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket. 错
- java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Invalid column name
- java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket
- java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Software caused
- java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]对象名 ‘xxx’ 无效
- java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket
- java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]问题