Quantcast
Channel: Xojo Programming Forum - Latest topics
Viewing all articles
Browse latest Browse all 3695

Connect to CubeSQL in Xojo with MBS

$
0
0

If you like SQLite and you look for a server version, you quickly find CubeSQL. If you like to connect to it using MBS Xojo SQL Plugin, you can use the SQLDatabaseMBS or SQLConnectionMBS class.

First you need to get a CubeSQL client library. Within our plugin is the built-in library, which you can activate using InternalCubeSQLLibraryMBS module. Otherwise you can of course use a libcubesql.dylib/so/dll of your choice.

// use internal CubeSQL library
	Call InternalCubeSQLLibraryMBS.Use
	
	Dim con As New SQLConnectionMBS
	
	// optional use external DLL instead of built-in
	// con.Option("CUBESQL.LIBS") = "/Users/cs/Desktop/libcubesql.dylib"
	
	// you can put in an application name for monitoring who connects
	con.Option("APPNAME") = "Xojo Test"
	
	// we use a short timeout to not block too long if the server is not reachable
	con.Option("ConnectionTimeout") = "5"
	
	// optionally enable encryption
	con.Option("ConnectionEncryption") = "AES128" // or "AES192" or "AES256"
	
	// connect
	con.Connect("localhost@mydatabase.sqlite","admin","admin",SQLConnectionMBS.kCubeSQLClient)

Once connected, you can of course continue with your application and run queries against the connection. The great thing is that CubeSQL is based on SQLite, so all the features from SQLite are available, just through a network connection.

A small CubeSQL server license is free and the higher levels are quite affordable. Enjoy!

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 3695

Trending Articles