数据库问题?
错误提示:[Microsoft][SQLServer JDBC Driver]The specified SQL type is not supported by this driver.
代码:
package oa.DataAccess;
import java.sql.*;
public class User {
private Connection _Cn=null;
private ResultSet _Users=null;
private String _UserID="";
private String _LoginName="";
private String _UserName="";
private String _AllName="";
private String _PassWord="60FD7DD82EA95B91";//默认为空
private byte _Verify=3;//默认值3
private String _State="1";
private String _Note="";//备注
private java.util.Date _UpDateTime;
private String _UpUserID="";
private String _ErrMsg="";
public User() {
_Cn=new jdbcCn().getCn();
}
public ResultSet getUsers()
{
try
{
Statement mStmt=_Cn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY);
_Users=mStmt.executeQuery(" select * from PubSystemUser ");
}
catch(Exception ex)
{
ex.getStackTrace();
System.out.print("User is Nothing!!!");
}
return _Users;
}
public void Close()
{
try
{
if(_Users!=null)
{
_Users.close();
}
if (_Cn.isClosed() == false) {
_Cn.close();
}
}
catch(Exception ex)
{
ex.getStackTrace();
System.out.print("Close is Fail!!!");
}
}
//设置登录ID
public void setLoginName(String value)
{
_LoginName=value;
}
//设置用户真实姓名
public void setAllName(String value)
{
_AllName=value;
}
//设置备注
public void setNote(String value)
{
_Note=value;
}
public void setUpUserID(String value)
{
_UpUserID=value;
}
private boolean getUserID()
{
try
{
String mSql = "select max(UserID) " +
" from PubSystemUser ";
Statement mStmt = _Cn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY);
ResultSet mRs = mStmt.executeQuery(mSql);
mRs.last();
if(mRs.getRow()==0)
{
_UserID="001";
}
else
{
int mID=Integer.parseInt(mRs.getString("UserID"))+1;
}
return true;
}
catch(Exception ex)
{
ex.getStackTrace();
System.out.print("Insert is Fail!!!");
return false;
}
}
public boolean Insert()
{
try
{
if(getUserID())
{
throw new Exception("Get UserID is fail!");
}
String strSql = "INSERT INTO PubSystemUser " +
"(UserID, LoginName, UserName, AllName, PassWord, Verify, State, Note, "+
"UpDateTime, UpDateUserID)"+
"VALUES (?,?,?,?,?,?,?,?,?,)";
PreparedStatement pstmt = _Cn.prepareStatement(strSql);
if(_UpUserID.trim()=="")
{
_UpUserID=_UserID;
}
pstmt.setString(1,_UserID);
pstmt.setString(2,_LoginName);
pstmt.setString(3,_UserName);
pstmt.setString(4,_AllName);
pstmt.setString(5,_PassWord);
pstmt.setByte(6,_Verify);
pstmt.setString(7,_State);
pstmt.setString(8,_Note);
pstmt.setObject(9,_UpDateTime);
pstmt.setString(10,_UpUserID);
pstmt.executeUpdate();
pstmt.close();
_Cn.close();
return true;
}
catch(Exception ex)
{
ex.getStackTrace();
_ErrMsg=ex.getMessage();
System.out.print("Insert is fail!!!");
return false;
}
}
public String GetErrMsg()
{
return _ErrMsg;
}
}
执行Insert()函数出现错误,数据库是SQL 2000,Note类型是Text。
代码:
package oa.DataAccess;
import java.sql.*;
public class User {
private Connection _Cn=null;
private ResultSet _Users=null;
private String _UserID="";
private String _LoginName="";
private String _UserName="";
private String _AllName="";
private String _PassWord="60FD7DD82EA95B91";//默认为空
private byte _Verify=3;//默认值3
private String _State="1";
private String _Note="";//备注
private java.util.Date _UpDateTime;
private String _UpUserID="";
private String _ErrMsg="";
public User() {
_Cn=new jdbcCn().getCn();
}
public ResultSet getUsers()
{
try
{
Statement mStmt=_Cn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY);
_Users=mStmt.executeQuery(" select * from PubSystemUser ");
}
catch(Exception ex)
{
ex.getStackTrace();
System.out.print("User is Nothing!!!");
}
return _Users;
}
public void Close()
{
try
{
if(_Users!=null)
{
_Users.close();
}
if (_Cn.isClosed() == false) {
_Cn.close();
}
}
catch(Exception ex)
{
ex.getStackTrace();
System.out.print("Close is Fail!!!");
}
}
//设置登录ID
public void setLoginName(String value)
{
_LoginName=value;
}
//设置用户真实姓名
public void setAllName(String value)
{
_AllName=value;
}
//设置备注
public void setNote(String value)
{
_Note=value;
}
public void setUpUserID(String value)
{
_UpUserID=value;
}
private boolean getUserID()
{
try
{
String mSql = "select max(UserID) " +
" from PubSystemUser ";
Statement mStmt = _Cn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY);
ResultSet mRs = mStmt.executeQuery(mSql);
mRs.last();
if(mRs.getRow()==0)
{
_UserID="001";
}
else
{
int mID=Integer.parseInt(mRs.getString("UserID"))+1;
}
return true;
}
catch(Exception ex)
{
ex.getStackTrace();
System.out.print("Insert is Fail!!!");
return false;
}
}
public boolean Insert()
{
try
{
if(getUserID())
{
throw new Exception("Get UserID is fail!");
}
String strSql = "INSERT INTO PubSystemUser " +
"(UserID, LoginName, UserName, AllName, PassWord, Verify, State, Note, "+
"UpDateTime, UpDateUserID)"+
"VALUES (?,?,?,?,?,?,?,?,?,)";
PreparedStatement pstmt = _Cn.prepareStatement(strSql);
if(_UpUserID.trim()=="")
{
_UpUserID=_UserID;
}
pstmt.setString(1,_UserID);
pstmt.setString(2,_LoginName);
pstmt.setString(3,_UserName);
pstmt.setString(4,_AllName);
pstmt.setString(5,_PassWord);
pstmt.setByte(6,_Verify);
pstmt.setString(7,_State);
pstmt.setString(8,_Note);
pstmt.setObject(9,_UpDateTime);
pstmt.setString(10,_UpUserID);
pstmt.executeUpdate();
pstmt.close();
_Cn.close();
return true;
}
catch(Exception ex)
{
ex.getStackTrace();
_ErrMsg=ex.getMessage();
System.out.print("Insert is fail!!!");
return false;
}
}
public String GetErrMsg()
{
return _ErrMsg;
}
}
执行Insert()函数出现错误,数据库是SQL 2000,Note类型是Text。
...全文
相关推荐
PyCharm MySQL可视化Database配置过程图解
在填写信息的过程中,可能会遇到时间区问题,如错误信息提示:“The server time zone value ‘?й???????’
Mysql数据库编码问题 (修改数据库,表,字段编码为utf8)
MySQL数据库编码问题涉及到字符集的选择、配置以及数据的迁移和处理。字符集是决定数据库中存储和检索文本数据的方式,对于多语言支持和数据迁移至关重要。
SQL Server 2008 数据仓库 指南
面试中可能会问到的问题可能涵盖以下方面:1. 数据仓库的架构组成是什么?2. 如何设计和实施ETL流程?3. OLAP(在线分析处理)和OLTP(在线事务处理)的区别是什么?4.
数据仓库建模
**逻辑建模**:将领域模型中的概念实体和关系转化为数据库逻辑模型。4. **物理建模**:最后一步是生成物理模型,解决数据库的具体技术实现问题,例如表结构、索引等。
数据仓库实例.ppt
#### 三、确定系统边界在设计数据仓库时,首先需要明确系统边界,这包括:- **决策类型**:需要解决哪些类型的决策问题?- **关注问题**:决策者最关心的问题是什么?


