There’s more than one way to do it

7 Dec
根本原因:
访问数据库的用户有登录权限,但无操作表的权限
解决办法:
1. 在[企业控制台]窗口–[树]子窗口–[安全性]子树–[登录]项里将你使用的登陆用户的默认数据库设为你所使用的数据库。
2. 在[企业控制台]窗口–[树]子窗口–[安全性]子树–[登录]项里新增一个登录用户(在其中选择SQL Server 身份验证、服务器角色和要访问的数据库),以后便可用些新增用户访问你勾选的数据库了。
大家在用java连接ms sql时可能会这样的问题
原因是sa用户为系统用户,它虽然能够登陆数据库,但是数据库里边的权限都是dbo的,所以,我们现在为这个数据库重新建立一个用户.
当然,这个情况只发生在java里边. .net是不会这样的.
只要新建立一个用户,再在权限那分配权限做好就行了.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | public Connection getConnectionDB() { String driverName = "com.microsoft.jdbc.sqlserver.SQLServerDriver"; String ConnectionString = "jdbc:microsoft:sqlserver://localhost:1433; DatabaseName=test;"; String userName = "username"; String userPwd = "password"; try { Class.forName(driverName); con = DriverManager.getConnection(ConnectionString, userName, userPwd); //System.out.println("Connection Successful!"); } catch (Exception e) { e.printStackTrace(); } return con; } ConnectionDB prod=new ConnectionDB(); Connection con=prod.getConnectionDB(); CallableStatement callStmt =null; java.sql.Statement stat = null; java.sql.ResultSet rs = null; stat = con.createStatement(); String sql="select * from table"; rs=stat.executeQuery(sql); |
17 Nov
本文逐步介绍了如何在 Access 中重置“自动编号”字段值。在 Access 中删除某个表中的一些行或所有行时,“自动编号”字段不会自动重置。要重置“自动编号”字段值并刷新引用表中的“自动编号”值,必需手动执行一些任务。
28 Sep
These formal definitions are taken from the book by Chris J. Date: An Introduction to Database Systems Volume 1 4th edition, © 1996, Addison-Wesley Publishing Co., Inc., Reading, Massachusetts.
First Normal Form
‘A relation R is in first normal form (1NF) if and only if all underlying domains contain atomic values only.’
Second Normal Form
‘A relation R is in second normal form (2NF) if and only if it is in 1NF and every nonkey attribute is fully dependent on the primary key.’
Recent Comments