I am new to SSIS, I have created variables for connection string (Both source and destination). While generating the Config file, which property I need to select. Could you please help me with this?
It's not necessary to create variables for a connection string.
There are a few things you will need to provide to us to give you an exact answer.
The type of database you are connecting to.
What type of authentication you use to connect to it.
If you take the below image when setting up a connection manager for an OLE DB you simply need to provide the server name. Then which type of authentication it is.
If the connection is successful you should be able to select a database you wish to connect to. You can also test the connect to make sure the connection is working successfully.
Let me know if you have any other issues.
Thanks
Gav
I have two separate mongoDBs on our network. I want to periodically copy collections from a production like db to our testing dbs. I think clone collection is the simplest way to do this but I can't get the URI correct.
I'm getting the error more than one ':' detected. If this is an ipv6 address, it needs to be surrounded by '[' and ']';
Well I've tried reformatting the URI in several different ways but i haven't gotten it correct yet and continue to get errors.
This is what i think should work:
db.cloneCollection('mongodb://username:password#www.server.com/dbname', 'equipment', {})
I expect to be able to clone the collection sitting in another db to the current db.
From mongodb document
db.cloneCollection() cannot be used if the from server has authorization enabled.
I just set up a free MongoDB on Atlas. I added a database called 'react-project' that I'm trying to connect to using mongoose. Here is my connection string:
mongoose.connect('mongodb+srv://myUser:myPassword#myCluster.mongodb.net/react-project');
As you can see, at the end of the query I specify the database I want to connect to. I can connect to the mongodb instance just fine, but when I try and do an operation (such as Model.find()), I get the following MongoError:
MongoError: cannot do raw queries on admin in atlas
This leads me to believe that it is not connecting to the 'react-project' database, but is connecting to the 'admin' database instead.
Why is this happening and how can I connect to the correct database?
Here is the code I'm running that is giving me the error:
var productSchema = mongoose.Schema({
productId: Number,
img: String,
price: Number,
title: String,
type: String
});
var Product = mongoose.model('Product', productSchema);
// Return all products
Product.find(function(error,result) {
if (error) return console.error(error);
console.log(result);
});
I had the exact same issue. Seems like its a new one.
Heres my connection string that now works
mongoose.connect('mongodb://USERNAME:PASSWORD#myShard-shard-00-00-lbofd.mongodb.net:27017,myShard-shard-00-01-lbofd.mongodb.net:27017,myShard-shard-00-02-lbofd.mongodb.net:27017/MYDBNAME?ssl=true&replicaSet=myShard-shard-0&authSource=admin');
To create a new DB I used MongoDB Compass. Copy the connection string from the Atlas site(the longer one - 3.4 I believe), when you open mongodb compass it will recognize that there is a connection string in your clipboard (OSX) and will allow you to populate the connection for Compass with a simple click. You can create a new Database from there (Click on MyCluster at top left - then Create Database. Put the name of the new db in the bolded MYDBNAME in my connection string.
It did take a few refreshes to see new data.
I had much the same connection string as you (db name/shard different etc) - I was able to POST but not GET. POSTS didnt create error (but I could not find data I posted) and GET threw the same error as you got.
I just got this error after trying to switch from my paid Mongo Atlas cluster back to my free cluster. The solution for me ended up being blissfully simple:
In the URI, I changed /admin to the name of the free cluster's db or /test in my case.
String before fix:
"mongoURI": "mongodb+srv://<username>:<password>#cluster0-azhuz.mongodb.net/admin?retryWrites=true&w=majority"
String after fix:
"mongoURI": "mongodb+srv://<username>:<password>#cluster0-azhuz.mongodb.net/test?retryWrites=true&w=majority"
Had the same issue, none of the above helped. Documenting my solution since this page is the first hit on Google.
If you're using the connect-mongo library like I was, you can fix it by using the older connection string (Node 2.2 not Node 3.0). To get that in Atlas, Click on your cluster -> Connect -> Connect Your Application -> under driver choose node v. 2.2 and copy that connection string.
This is because connect-mongo can't handle the "+srv" in the newer strings.
So that string should look like
mongodb://<user>:<password>#cluster0-shard-00-00-rnmsm.mongodb.net:27017,cluster0-shard-00-01-rnmsm.mongodb.net:27017,cluster0-shard-00-02-rnmsm.mongodb.net:27017/test?ssl=true&replicaSet=cluster0-shard-0&authSource=admin&retryWrites=true&w=majority
Got the same issue.
Changing connection string to 3.4 version (the longer one instead of 3.6) helped.
Strange, it had worked well on it on 3.6 before the issue appeared.
I have faced the same problem. Just change the /admin to your Cluster name in MongoURL.
Example:
mongodb+srv://UserName:Password#cluster0-qkaef.mongodb.net/ClusterName?retryWrites=true&w=majority
I ran into this issue using the Serverless Framework and AWS Lambda. My issue was that the environment variables were not being updated with my deploy command and it was using an older version of my Atlas connection string with an out-dated user with incorrect permissions.
So while that was a specific occurrence of my error, for other users that run into this, it seems like it could also just be a permissions issue with the user.
I found a very simple solution on a different website, but decided to share it here!
Basically, substitute /admin in the connection string to the name of your cluster in MongoDB Atlas.
Make sure you following this step. (my node version v10.15.0, mongodb compass Version 1.16.3 (1.16.3))
Make Sure your user have right readWriteAnyDatabase#admin
then copy
mongodb+srv://<yourUsername>:<yourPassword>#devconnector-xszss.mongodb.net/admin
after you copy when open mongoDB Compass will display the alert prop like this then click connect button
after login create the new database. In this case my database that I already create is name devconnector.
then in your app (in this case my app is using Nodejs) and make sure that in the url mongodb+srv://<yourUsername>:<yourPassword>#devconnector-xszss.mongodb.net/YourdatabseYouJustCreate in my case the database that I just created is devconnector. make sure it is not admin
then you can make a post request. (my post request code). my UserSchema
I hope this will help you.
I know it's really late to answer this but I was having the same problem and I just put Mongodb user name after a '/' now my connection string looks like mongodb+srv://UddeshRW:uddesh#cluster0-2erky.mongodb.net/<Mongodb user name>
I noticed you're using mongoose. Banged my head against the wall for an hour, until I rechecked the mongoose docs.
mongoose.connect('mongodb://localhost:27017/myapp', {useNewUrlParser: true});
the .connect() method has a second parameter to specify to use the new url parser for mongo :)
Hope this helps someone (or my future self)!
Your connection URL can be any of the two:
1.
mongodb+srv://<username>:<pasword>#<your replica set>.mongodb.net/<your database name>?retryWrites=true&w=majority
mongodb+srv://<username>:<pasword>#<your replica set>.mongodb.net/<your database name>?authSource=admin&replicaSet=portal-shard-0&readPreference=primary&ssl=true
your replical set will be there automatically,
those you need to supply to your connection string are username, password and database name
so change the admin in your URL to one of your database name
Your username and password is the username and password of the user your created under Database Access in your mongo dashboard sidebar
In my express/mongoose app, say I have multiple dbs in the same mongodb server, one is xxx. If I don't have authenticaion, my connection string looks like
mongodb://myserver.cloudappserver.net/xxx
which works great. Now, I added authentication as
use admin
db.createUser({user:"admin",pwd:"yyy",roles:[{role:"root",db:"admin"}]});
Based on documentation, my connection string should look like
mongodb://admin:yyy#myserver.cloudappserver.net/admin
Now, my question is how do I specify the db "xxx" I want to work with?
I figured out based on this... the connection string should look like this
mongodb://admin:yyy#myserver.cloudappserver.net/xxx?authSource=admin
I am currently able to use the Typed UpdateDefinitionBuilder to tell the mongo server to set the datetime instead of my code setting it myself.
Is there a way to tell an insert the same thing using the strongly typed interface?
I was hoping for a BsonAttribute for that field
I need to do this for a InsertManyAsync
Thanks in advance
Richard