java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]对象名 ‘xxx’ 无效2007-09-08 23:54java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]对象名 ‘xxx’ 无效
根本原因:
访问数据库的用户有登录权限,但无操作表的权限
解决办法:
1. 在[企业控制台]窗口–[树]子窗口–[安全性]子树–[登录]项里将你使用的登陆用户的默认数据库设为你所使用的数据库。
2. 在[企业控制台]窗口–[树]子窗口–[安全性]子树–[登录]项里新增一个登录用户(在其中选择SQL Server 身份验证、服务器角色和要访问的数据库),以后便可用些新增用户访问你勾选的数据库了。
大家在用java连接ms sql时可能会这样的问题
原因是sa用户为系统用户,它虽然能够登陆数据库,但是数据库里边的权限都是dbo的,所以,我们现在为这个数据库重新建立一个用户.
当然,这个情况只发生在java里边. .net是不会这样的.
只要新建立一个用户,再在权限那分配权限做好就行了.
我的测试代码:
<%@ page language="java" contentType="text/html; charset=gb2312" %>
<%@ page import="java.lang.*, java.io.*, java.sql.*, java.util.*" %>
<html>
<body>
<%
String driverName = "com.microsoft.jdbc.sqlserver.SQLServerDriver";
String dbURL = "jdbc:microsoft:sqlserver://localhost:1433; DatabaseName=sample";
String userName = "sa";
String userPwd = "sa";
Connection dbConn;
try {
Class.forName(driverName).newInstance();
Connection conn = DriverManager.getConnection(dbURL, userName, userPwd);
Statement stmt = conn.createStatement();
String sql="select * from userInformation";
ResultSet rs=stmt.executeQuery (sql);
while(rs.next())
{
out.println(rs.getString(1));
out.println(rs.getString(2));
}
out.println("Connection Successful!");
}
catch (Exception e) {
e.printStackTrace();
}
%>
</body>
</html>
SQLServer2000的表格:
运行结果:
1 用户1 2 用户2 3 用户3 4 用户4 5 用户5 Connection Successful!
分享到:
相关推荐
java.sql.SQLException: 不支持的字符集 (在类路径中添加 orai18n.jar): ZHS16GBK ……
NULL 博文链接:https://listen-raining.iteye.com/blog/1962065
在oracle里面运行一下,解决Exception java.sql.SQLException ORA-00600 内部错误代码
服务器出现java.sql.SQLException No suitable driver found for 的
NULL 博文链接:https://zhang-zling.iteye.com/blog/980488
java.sql.SQLException: null, message from server: “Host ‘223.72.41.7’ is not allowed to connect to this MySQL server” 客户端访问时报错: 解决方法: 1,登陆服务器 mysql> use mysql; //用mysql ...
oracle ora-各种常见java.sql.SQLException归纳
本文主要介绍了关于MySQL存储表情报错:java.sql.SQLException: Incorrect string value: ‘\xF0\x9F\x92\xA9\x0D\x0A…’的相关解决方法,分享出供大家参考学习,下面话不多说了,来一起看看详细的介绍: ...
主要给大家介绍了关于MySQL存储表情时报错:java.sql.SQLException: Incorrect string value: 'xF0x9Fx92xA9x0Dx0A...'的解决方法,文中通过示例代码介绍的非常详细,需要的朋友可以参考借鉴,下面来一起看看吧。
Q: I am working with ... I am using updateBinaryStream method of resultset to update the BLOB field but it is failing after giving following exception java.sql.SQLException: Internal Error: Unable to
oracle 10g 数据库驱动下载:oracle jdbc dirver
mysql5.6连接驱动jaf,可处理报错java.sql.SQLException: No suitable driver
异常错误:java.sql.SQLException: The server time zone value ‘?й???’ is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTime...
java.sql.SQLException: Operation not allowed after ResultSet closed java.sql.SQLException: QueryRunner requires a DataSource to be invoked in this way, or a Connection should be passed in
import java.sql.SQLException; import java.sql.Statement; import java.sql.ResultSet; /** * @author Administrator * */ public class sqlServer { String DBDriver=...
该用户与可信 SQL Server 连接无关联。 说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.Data.SqlClient....
问题是这样的…我在VS2008直接运行打开网页,可以连接... 异常详细信息: System.Data.SqlClient.SqlException: 无法打开登录所请求的数据库 “TakeClass”。登录失败。 用户 ‘2D2727E2578F446\ASPNET’ 登录失败。
绝对好用的9i驱动包+10g驱动包 解决java.sql.SQLException: 不支持的特性 解决oracle.jdbc.driver.OracleDatabaseMetaData.supportsGetGeneratedKeys()Z异常 等等
主要介绍了解决IDEA错误 Cause: java.sql.SQLException: The server time zone value的问题,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下