MongoDB out of the box: not authorized for insert (Windows 7) - node.js

I've been following along with the actual MongoDB docs here
as well as several tutorial articles that are getting me absolutely nowhere.
Running a 64bit windows OS (which is a work computer, and my particular windows login is not an administrator login.. so I make sure to open any exe files as administrator). I can't do anything in the terminal beyond "mongo" or "use [db name]".
I cannot save or add anything like db.testData.insert( j ). Even typing "show dbs", I get an error that says
listDatabases failed:{ "ok" :0, "errmsg" : "unauthorized" } at src/mongo/shell/mongo.js:46
With every example I've followed, I can never seem to be "authenticated" to get past point A. Please help me! I have no idea what I'm doing wrong at this point.
UPDATE:
Sorry for the confusion, everyone. The problem turned out to be that I had an old MongoDB service still running in the background that I needed to disable.
The service must have been turned on while I was testing out some node packages or something. Once I disabled the service, everything started working as expected.
So for those of you who are having trouble, make sure you open up services.msc and make sure nothing is running MongoDB

As there isn't a formal installer for Windows, I'd recommend you delete the data folder and restart. Out of the box, there is no security in MongoDb, so you've followed a step which later requires a password. Either retrace your steps, or start over.
You don't need to switch to the admin Database. I'd suggest you instead switch to a test database for example:
> use test
switched to db test
By default, without extra configuration, on Windows you can delete the contents of c:\data\db when MongoDb isn't running (but if you're using a configuration file that specifies the dbpath, delete the contents of that folder).
There are a number of tutorials with details of how to configure users/security with Mongodb that you may want to read after you've resolved this issue.
There's little reason to create users and administrative control with MongoDB until you gain some experience with the platform. In fact, I wouldn't recommend it at all. It just gets in the way as you're seeing for no real gain.

Related

pgAdmin 4 - preferences settings not applied

I'm using pgAdmin 4 (v. 6.12) on Windows 10.
Since (I believe) version 6.10 I've noticed that autocomplete always shows up. I tried to change preferences settings to only show it on Ctrl + space:
But it made no difference - autocomplete is always shown.
Then I've noticed, that some other settings are not respected, for example insert bracket pairs:
This is how editor looks just after typing opening bracket:
This is very annoying. I've completely removed previous installation of pgAdmin: uninstalled it, deleted all files and folders with pgAdmin in name and did the same in Windows registry. But new installation behaves the same.
New installation was made only for my user account, not for Anyone who uses this computer option.
Like you, I was also unable to turn off autocomplete-on-type after installing 6.12.
When using the web client, I was able to log out and log back in to solve it.
UPDATE from comments: using the Windows application, Adam was able to clean session data from the registry, open the editor window, change settings, close editor window, change settingsā€¦ And it started to work again.
More details...
It happened to me in Ubuntu when I first upgraded to 6.12 and restarted the server, while the client was connected. The web client appears to have held on to a session that at first seemed to work. Once I logged out and log back in, my autocomplete-on-type OFF setting was respected again.
I agree that this bug is completely frustrating. I'm not sure why anyone would want the autocomplete-on-type setting enabled, pgadmin4 is unusable with it on.

Access database from an application hosted on IIS

The error I get is:
Cannot open database "DBNAME" requested by the login. The login failed.\r\nLogin failed for user 'IIS APPPOOL\DefaultAppPool'
Initial connection string is as follows, further in the question I'll only be using only a part of it.
Data Source=(localdb)\\MSSQLLocalDB;Initial Catalog=DBNAME;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False;
I believe I have tried everything:
My application that is hosted on IIS is using a
'ApplicationPoolIdentity' as identity. I have tried changing the
identity to other, but to no avail. Only to be greeted by a similar
error, but with a changed user. (Havent tried using Custom account)
Tried sharing my localDB instance
with the following command sqllocaldb share mssqllocaldb IIS_DB.
Restarting the instance, changing my connection string data source
to the following (localdb)\\.\\IIS_DB.
Tried plainly using
SQLEXPRESS instance with the following data source .\\SQLEXPRESS.
I have added IIS APPPOOL\\DefaultAppPool user to all possible places, given full access to everything, allowed Everyone to access the folders where the database is located.
One thing I haven't tried is to try and repeat everything from scratch, since I might've messed something up. All help is appreciated.
IIS: version 10.0.19041.1
SSMS: version 18.12.1
Backend: .NET 6 minimal API + DAPPER
Thank you #Lex Li
I used to login to my PC via the microsoft acc and thus I never did use a windows acc. So whoever stumbles, keep in mind that it's easy to create the acc, windows helps you with that.
Other than that, what I was missing was exactly this. Use your own acc and not a DefaultAppPool (even though it should still work.).
Dont forget to check that your SQL instance is running:
Open cmd and write sqllocaldb i (this should show you all of your instances)
to check whether an instance is running. (It is started when you open your local SSMS and connect to your instance or you run it through cmd): Write sqllocaldb i instancename (should see it as running) - (if you want to restart it, write sqllocaldb stop instancename and then sqllocaldb start instancename.
Other than that, feel free to ask for help in the comments, I might remember this stuff even after a year or two. (Literally spent 7 days on this issue)

Can't save content or make changes - Liferay

Liferay 6.1.1 CE GA2 works works fine-and-dandy on my local machine and my coworkers as well. When we deploy it to our main dev server, we find that we can't save any changes (i.e., create web content, change theme/schemes, etc).
Any idea why this is happening?
Cheers!
check the log output, this might give you hints on what's going wrong
If you get UI errors, this might help as well
check what database you're connecting with, make sure that the user account you use has write access to the database
In case you use hsql (don't do this unless on an unimportant demo server) make sure that the user your appserver runs as is able to write to the data directory and persist the database
If you're running on a cluster and the second machine doesn't pick up changes made through the first machine, you need to configure clustering properly. The Userguide at https://www.liferay.com/documentation/ has a chapter on this.
If nothing of this helps, please give more information

Oracle error when executing sqlplus: "SP2-1503: Unable to initialize Oracle call interface"

I'm struggling with the following error when starting up sqlplus as my regular user - say "scott".
$ sqlplus
SP2-1503: Unable to initialize Oracle call interface
SP2-0152: ORACLE may not be functioning properly
Environment is:
Oracle 11.2.0.2
OpenSuse Linux 11.1 (64bit)
Misc other detail:
Oracle installed and running on localhost
No tnsnames issues as can run sqlplus as oracle admin user
Database up and listener started (11.2.0.2 install).
user scott in database admin group (/etc/group)
user scott references correct 11.2.0.2 installation
This is most bizarre as I can happily run sqlplus as the oracle user (say "oraadmin") and user scott is registered in the oracle admin group. Additionally, I had no such problems with my previous Oracle install (10.2.0.7). My ~scott's $ORACLE_HOME references the 11.2.0.2 installation.
Comparing my 11.2.0.2 and 10.2.0.7 environments, I've noticed several libraries (including $ORACLE_HOME/lib/libsqlplus.so) have group read-only permissions (744) so have chmod'ded these.
Other than that, my $ORACLE_HOME/lib, $ORACLE_HOME/bin, $ORACLE_HOME/oracore and $ORACLE_HOME/rdbms all seem reasonable with sensible permissons.
N.B: There's a plethora of stuff on-line but, as is often the case, there's a lot of case-specific issues and mainly around different versions of Windows. Focusing mainly on comparing my envs. Besides, as far as I can tell, this question doesn't yet exist on SO so could be useful to start collating answers by environment. I'll report back any sensible findings.
If it is Windows 7, You can right click on SQL Plus or whatever software you using, I use Crystal Reports.
so to you would have to right click and Run as Administrator.
it fixed for me.
Fixed my particular issue...
User scott's $PATH still contained the ora11.1.0.7 bin. So, on starting sqlplus, I was running the ora11.1.0.7 sqlplus client against the 11.2.0.2 server. Think there may be more to it than that (i.e. I'd probably expect that client to work with that server) but that is the hub of the problem.
In my defence, my.bashrc sets the $PATH correctly so not yet sure what preempts it with the 11.1.0.7 version. Guess the sensible rule of thumb is to add my $ORACLE_HOME/bin to the front of the $PATH to ensure mine is found first, despite what else is set by whatever other environment config, as in
export PATH=$ORACLE_HOME/bin:$PATH
Yours, a little embarrassed but hopefully will be of help again to someone.
Some of the more useful sites...
Various Windows environments:
https://forums.oracle.com/forums/thread.jspa?threadID=338426
https://www.administrator.de/Zugriff_auf_OracleDB_(10i)_per_sql_plus_von_WTS_2003_(Servicepack_2).html
http://www.orafaq.com/forum/t/100549/2/
Linux environments:
http://databaseoracle.blogspot.com/2006/11/permitting-user-on-unix-linux-to-use.html
In Windows i found the solution ---
Assign the "Create global objects" user right to the non-Administrator account.
Go to Administrative Tools, and then click Local Security Policy.
Expand Local Policies, and then click User Rights Assignment.
In the right pane, double-click Create global objects.
In the Local Security Policy Setting dialog box, click Add.
In the Select Users or Group dialog box, click the user account that you want to add, click Add, and then click OK.
Click OK.

(IIS/Win2000Pro) Granting Registry read rights to IIS user?

Okay, so I'm running a small test webserver on my private network. I've got a machine running Windows 2000 Pro, and I'm trying to run an ASP.NET app through IIS.
I wrote it so that the webpage would use the registry to store certain settings (connection strings, potentially volatile locations of other web services, paths in the local filesystem where certain information is stored etc...) Of course, it worked fine when testing with VStudio.NET 2005, because the user running the app has elevated privileges. However, running it on IIS I get a "Access to the registry key 'HKEY_LOCAL_MACHINE\Software' is denied.", which suggests the IIS user doesn't have read access to that part of the registry (I only do reads through the website itself, never writes).
I was like "okay, simple enough, I'll just go give that user rights to that part of the registry through regedit." The problem is, I don't see an option anywhere in regedit to change security settings... at all. Which got me thinking... I don't think I've ever actually had to change security settings for registry hives/keys before, and I don't think I know how to do it.
Half an hour of searching the web later, I haven't found any usable information on this subject. What I'm wondering is... how DO you change security rights to portions of the registry? I'm stumped, and it seems my ability to find the answer on Google is failing me utterly... and since I just signed up here, I figured I'd see if anyone here knew. =)
If your having touble with RegEdit in Windows 2000 you can try the following:
Copy the Windows XP RegEdt32.exe to the Windows 2000 Machine
Using a Windows XP Machine, connect to the Windows 2000 registry remotely: File > Connect Network Registry
You can set permissions at the folder level for which you want to grant user permissions read/write access.
In your case, right click on the "Software" folder and select "Permissions".
You'll probably know the rest from there.
EDIT: If you still run into issues, you may want to modify your web.config file and use impersonation to have your web application run as a certain user account. Then you can put a tighter reign on the controls.
RegEdt32.exe will allow you to set permissions to registry keys.
Simply right click on a Key (Folder) and click Permissions, then you can edit the permissions as you would an file system folder.
I did so, assuming that a Security setting would be available. I didn't see any "Security" option when I right-clicked on the Key. =( I triple-checked just to make sure... and I just tried it on my XP machine, and it does indeed have the "Permissions" section... but the Windows 2000 machine doesn't. (how's that for wierd?)
In my searching, I found:
http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/Q_21563044.html
Which notes that RegEdit for Windows 2000 doesn't have the Security/Permissions settings... but it proposes no solution to the problem. (Whoever asked the question was using Windows XP so he was okay... but in my case, it's 2000)
Is there any way to make it happen specifically in 2000?
EDIT: Ahhhh... if worse come to worse, I suppose I can do the impersonation as mentioned below... though if I can't set security settings for the registry in 2000, I'm left with making that user have Administrative access (I assume?) to actually get those rights, which sadly defeats the purpose. =(
Oh, let me try that! I didn't realize you could remotely connect to another registry.
(EDIT: I was wrong, it did work... it just took several minutes to respond to my request to change permissions remotely)
The remote connection idea did it! You're good! Thanks so much for your help! I never realized you could remote connect with RegEdit... you learn something new every day, they say! =) Thanks again for your assistance! =)
On another note though, about copying the XP version of RegEdit to Windows 2000... is that safe? I figured they would be coded in such a way as to be incompatible... but I could be assuming too much. =)
Just use RegEdt32.exe instead of Regedit.exe.
Go to the desired key or folder, then open the security menu and click on 'permissions'.

Resources