The VistaDB connection string is made up of a number of parts, just as an MSSQL connection string is, each part is separated by a semi-colon.
The first part we’re going to look at is the Data Source. In VistaDB the data source can be written as follows ‘Data Source = Data.vdb4’. In this case, the local path is assumed. This can also be written as ‘Data Source = |DataDirectory|Data.vdb4’. Here, the |DataDirectory| part is a shorthand to tell the engine you want it to try to find the database in a local working path. This is commonly used for websites where App_Data is the database directory.
Next well look at the Open Mode part. There are a number of parameters that can be passed to this. A couple of the more important ones are:
ExclusiveReadWrite which enables a single process read write. This is the fastest access mode since the database does not have to worry about multi user locks.
NonExclusiveReadWrite which enables shared access for multiple processes. Lock files may be generated when running in this mode. Your application should also be prepared to handle LockTimeout and Concurrency error exceptions.
Then we’ll look at the Password=Secret part as some people get confused with this as they think it’s for user level access, when in fact, it’s the key for encrypted databases. On that note, encryption has 40% or more overhead to encrypt each packet to disk, so take that into account when you’re thinking about encrypting your database!
The last part we are going to look at is Transaction Mode=[on|off|ignore]. Where ‘on’ is the default and means that transactions operate normally. ‘Off’ means that transactions are not to be attempted and to create one generates an error, and ‘ignore’ means that attempts to create transactions should be ignored. This is useful for people using tools that generate transactions through SQL and are unable to turn them off in the tool, ORMs frequently do this, for example.
Well that’s it for this post. This has been a look at the most commonly used parts of the VistaDB connections string, but it has not been exhaustive. For a more detailed look, please check out the connections string page in the documentation.
Until next time, happy coding! 🙂
Is there something else we could do to make Gibraltar more valuable to you? Submit your killer idea to our contest! You’ll have a chance to win a fantastic prize and may just see your ideas in our next release!