Reputation: 23
not able to create table in netbeans java connected to MS SQL server
Error- Create table permission denied in database
How can I get the permissions. Please suggests some solutions.
Upvotes: 0
Views: 2368
Reputation: 576
To create table your login must have db_owner permission. These permissions can be granted by the database owner.
1. Launch "SQL Server Management Studio"
2. Expand <servername> - 'Security' - 'Logins'
3. Double-click on SQL login 'fastnet' // u have to open your created login
4. Inside the section 'Server Roles' ensure that the ONLY options ticked are 'bulkadmin' and 'public'. Do NOT tick any other options.
5. Inside the section 'User Mapping' highlight the your database
6. Ensure that the option 'Map' is ticked
7. Inside the window 'Database role membership for <databasename>' ensure that 'db_owner' and 'public' are ticked. Do NOT tick any other options.
8. Save changes and exit, login again with your login then test.
Upvotes: 0
Reputation: 89141
To create a table your user must have ALTER permission on the target schema and CREATE TABLE permissions on the database. These permissions can be granted by the database owner.
If this SQL Server instance is running on your PC, connect using SSMS with Windows Integrated auth from an elevated session, or using the SA account and grant the target user the rights to create tables. Connected to the target database run
GRANT ALTER ON SCHEMA::DBO TO SomeUser
GRANT CREATE TABLE TO SomeUser
Or to make that user a database-level admin
GRANT CONTROL TO SomeUser
Upvotes: 1