1

I was wondering if anyone has come across the error access is denied in command prompt when wanting to load a shapefile using shp2pgsql for postgresql.

I have set my user access security level to bare minimums, given every single user/admin etc.. full rights to the shapefile folder and command prompt. I am puzzled to what it could be. I have fairly heavy firewalls but I don’t think that should be preventing access.

  • worth a shot.. try running the command prompt as admin thewindowsclub.com/… – user92055 Feb 21 '18 at 16:13
  • check that you are hitting the PG db as the correct user – Ian Turton Feb 21 '18 at 16:42
  • what access? file access or DB access? – JGH Feb 21 '18 at 17:30
  • I ran the command prompt as administrator, did not receive the error again but it didn’t enter the db. – David Smith Feb 21 '18 at 19:58
1

To make a long story short. I had to change security permissions for role: 'Everyone' for command prompt and PostgreSQL download file. **This eliminated the access denied error.

Next I couldn't transfer my shapefile into the SQL database because it was reading the username to the previous version of software that I had uninstalled. Going to the psql help "C:\Program Files\PostgreSQL\9.6\bin> shp2pgsql -I -s 26918 C:\Database\CVEN\StLawrenceRiverAtlas\OriginalData\Railroad.shp railroad2017 | psql --help" in command prompt allowed me to realize what username was being read.

Thank you all for your amazing suggestions! I appreciate everything! You just saved me 20 points on my graduate school homework assignment.

0

If the file is located on a network drive use UNC Paths not mapped network drives

for example not

F:\path\to\file

use:

\\serverName\path\to\file

to see the server names open CMD and type net use

  • The file is on my c drive . C:\database\cven\stlawrenceriveratlas\originaldata\railroad.shp – David Smith Feb 21 '18 at 20:02
  • can you post the exact error and command your trying to execute? – NULL.Dude Feb 21 '18 at 20:32
  • C:\Program Files\PostgreSQL\9.6\bin>shp2pgsql -I -s 26918 C:\Database\CVEN\StLawrenceRiverAtlas\OriginalData\Railroad.shp railroad2017 | psql - U postgres -d CVEN1 > railroad_data.sql Access is denied. – David Smith Feb 22 '18 at 2:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.