How to force LocalDB to use a certain version - localdb

On my machine I've installed LocalDb 2012, 2014 and 2016. When I run my application it won't pick the latest version by default.
The used connection string:
Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\ServiceLocal.mdf;Integrated Security=True;Connect Timeout=5
So I use 'MSSQLLocalDB' (instead of v11.0). But it won't run 2016, but 2014 (i.e 12.0.2000.8). It doesn't work to choose v13.0. So what else can I do?

Recreating the instance as explained by Gabriƫl works but may not be an option. In the typical example, you want to create/attach a database on a client machine where you should not mess with existing instances.
Facing the same problem, I decided the best workaround was to start my application by script and create my own instance using SqlLocalDB.exe in the desired version before starting my application:
SqlLocalDB.exe create "MyVeryOwnInstance" 13.0 -s
The -s flag causes the instance to be started immediately. Afterwards in your application you can connect with:
Data Source=(LocalDB)\MyVeryOwnInstance;AttachDbFilename=|DataDirectory|\ServiceLocal.mdf;Integrated Security=True;Connect Timeout=5
This of course requires that the desired version is installed. I ensured this by bundling it with my applications installer.

I now understand the concepts. Each instance is really an instance. The connection string targets such an instance, so to get another version you either create a new instance with that version. In the case of MSSqlLocalDb, delete the instance and it will be automatically recreated when queried using the lastest installed version of LocalDb

Related

You have specified a database that is not empty, please specify an empty database

I'm trying to connect to an RDS cluster in AWS that's an Aurora PostgreSQL database. It's a brand-new database that I created along with the instances that I have Jira deployed to. However, when I try to connect to the instance from the Jira configuration screen I get this error
You have specified a database that is not empty, please specify an empty database.
I haven't touched this database at all, why is it giving me this error? I have one read and one write database in my cluster and the "hostname" is the endpoint for my write database, which is what the docs say. Could this be an issue with the Jira version I'm using?
This is the download link I'm using in my user-data script to install Jira. I'm also using PostgreSQL version 12.11
https://www.atlassian.com/software/jira/downloads/binary/atlassian-servicedesk-4.19.1-x64.bin
I switched to a different PostgreSQL version and now it's working.
PostgreSQL version 12.11 was giving me the error and switching to version 13.7 works as expected.

How to copy database from MongoDB 1.6 instance

I have a MongoDB instance with two databases, let's call them "realdb" and "copydb".
All I want to do is to periodically copy realdb to copydb. The copydb database is our "testing" instance of the actual database "realdb", and we want to periodically update it.
Normally the answer to this question would be "copydb" or "export/import". However, there are some challenges:
The target Mongo instance is running version 1.6 and is not likely to be updated anytime soon.
The target Mongo instance is on a remote server to which I don't have direct access.
This seems like basic enough a function that even 1.6 should have the ability to do it. But when I try anything I get "No such cmd" errors as if the newer Mongo can't communicate with the ancient Mongo.
Any thoughts on how this could be done?
The error "no such command" might mean that:
The command was mistyped, or does not exist
There is a mismatch of the client version (e.g. mongo shell, mongodump, mongoexport, or a mongodb driver) and the server version.
In this case it was a mismatch of the mongo shell version (3.4) vs server version (1.6).

MobileFirst install - cannot connect to database appcntr after it was created

Trying to install MobileFirst 6.3 (Using DB2 v 10.5, Windows Server 2012 R2 std) - and during the creation of the DB2 APPCNTR database stage, I get the error:
Creating database APPCNTR (this may take 5 minutes) ...failed:
Cannot connect to database 'APPCNTR' with user 'db2admin' after it was created: com.ibm.db2.jcc.am.SqlException: DB2 SQL Error: SQLCODE=-1035, SQLSTATE=57019, SQLERRMC=null, DRIVER=4.17.29
This is a clean installation of DB2, with no other programs using it (that I know of). The db2admin user is a member of my windows security group 'DB2ADMS' as well as 'DB2USERS' just in case
If I go back in the installer, then press next again, it says the database is already created (not sure if it's fully successful or partial)....
I believe that the database has been created successfully but for some reason, it is not possible to connect to the database via JDBC.
The explanation for the error message can be found here -- it can be many reasons: http://www-01.ibm.com/support/knowledgecenter/SSEPGG_9.5.0/com.ibm.db2.luw.messages.sql.doc/doc/msql01035n.html
When that happens to me the issue is often resolved by waiting a bit and retarting Installation Manager. Restarting the DB2 instance helps also. (If you don't restart Installation Manager, it believes it needs to create the database and fails because the database was created).
If the problem is not resolved by waiting a bit, you can also create the database manually prior running install Manager using that procedure (use a different database name than the one that is considered busy):
https://www-01.ibm.com/support/knowledgecenter/SSHS8R_6.3.0/com.ibm.worklight.installconfig.doc/admin/t_creating_the_db2_database_for_App_Center.html
Then use that database name when running Installation Manager,

SQL22223N creating database with DB2 Express C for Windows

I am having problems trying to create a database with DB2 Express C (v9.7).
I already have a another version of DB2 installed on my system:
Product: DB2 Connect Enterprise Edition
Version: 8.2
Copy: DB2COPY1
Instance: DB2
I understand that it is possible to have coexistence.
Express C has seemingly installed OK on my laptop, and I am able to use the Sample Database without a problem. I created new copy DB2COPY2, and new instance DB2_01.
I've installed it as a DB2ADMN.
When I try and create a database I get the error:
SQL22223N The Instance "DB2_01" does not exist on host "host name".
It is saying that the instance does not exist on the host. Which is strange because I installed it locally as a DB2ADMN.
Coexistence is supported. You have to open correct CLP version, and
set db2instance=db2_01
db2cc
and then it should work. If it doesn't you have to probably uncatalog and re-catalog your node and databases.

Postgresql in Active Directory Machine

I have a server in which Postgresql is installed. In this server I want to install the Microsoft Active Directory. Can I do this without a problems? Can I change the user that runs the Postgresql service without a problem?
When I install the AD all the machine users will be deleted so I need to create domain users to run that service.
It will work, but there could be performance issues since you're basically running two databases on the same machine.
It's a risk that the upgrade will remove the PostgreSQL service user. In this case, you will jus thave to create a new one and assign it to the service. Another option is to uninstall PostgreSQL (this will not uninstall the data), turn the machine into an AD controller, and then reinstall PostgreSQL (same version!). It will then pick up the old data directory automatically.