Problem writing query in source adapter for sync in RhoConnet

Hi All,

   I am working with RhoMobile adn RhoConnect for last 3 months and have gone through plenty of examples given in the docs.rhomobile.com but didn't find any exact example of the queries written insid ethe Query method in source adapter classes. I have developed a Rhodes app and that application is trying to fetch data from backedn SQL 2008 R2 DB. I have developed a ASP.NET MVC4 base application with RhoConnect plugin support in all the controller classes for talking with Rhoconnect server.The database has 140 table with having relationship. If i don't implement any source adpater and run the rhoconnect server the Rhodes app is fetching all source model which i have implemented in my Rhodes app. BUt there are few table in the DB whihc are having 1 millions of record which is throuing me error in JSON level for exceeding allow3ed JSON length so i was thinking to implement the bulk-sync feature of RhoConnect. But i don't know how to write query for each model inside the Query/Create/Update/Delete methods. Can anybody has written such application and source adapter classes please help me sharing sample code so that i can follow that. Thanks in advance.

Glenn Sayer
Yes leveraging Bulk sync is

Yes leveraging Bulk sync is you best bet to initially load the data.

http://docs.rhomobile.com/rhoconnect/bulk-sync

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


sumanta chakraborty
I know that i have to use the

I know that i have to use the bulk sync feature but my question is can somebody has some sample sql query which will show how to fetch data from sql database?

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Lars Burgess
This is probably your best

This is probably your best bet for connecting to SQL server from ruby: https://github.com/rails-sqlserver/tiny_tds

To use this library in your source adapter, just add the following line in your Gemfile, followed by typing "bundle install" to install it:

gem "tiny_tds"

Note that this library depends on native extension code that links to freetds, so you'll need to go through the prerequisite instructions on the readme to setup freetds before installing the tiny_tds gem: https://github.com/rails-sqlserver/tiny_tds#freetds-compatibility--configuration

If you're using a Mac and have homebrew installed, this can be done by simply running "brew install freetds".

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Anonymous (not verified)
Hi Lars,following your

Hi Lars,

following your instruction i have added the following to the bottom of the GemFile of my RhoConnect project:

             gem "tiny_tds"

             bundle install

however when i try to run my RhoConnect application i am getting the following error:

$ rake rhoconnect:start

WARNING: Global access to Rake DSL methods is deprecated.  Please include

    ...  Rake::DSL into classes and modules which use the Rake DSL methods.

WARNING: DSL method Bundler::Dsl#install called at d:/Users/ameer.ilahi/RhoStudio/workspace/WDLiveServer/Gemfile:49:in `evaluate'

←[31mThere was an error in your Gemfile, and Bundler cannot continue.←[0m

following some documention on the Gemfile (from http://gembundler.com/man/gemfile.5.html), when i change the above line to (without specifying bundle install)

gem 'tiny_tds', :git => "git://github.com/rails-sqlserver/tiny_tds.git"

i am getting the following error:

$ rake rhoconnect:start

←[31mgit://github.com/rails-sqlserver/tiny_tds.git (at master) is not checked ou

t. Please run `bundle install`←[0m

I am fairly new to Ruby and RhoMobile and not sure how to use/setup the dependencies. I have RhoMobileSuite ver 2.1.1.7 on windows 7 (64 bit)

thanks.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Lars Burgess
             gem "tiny_tds"  


             gem "tiny_tds"

             bundle install

This is wrong, you only add this to your Gemfile:

             gem "tiny_tds"

The `bundle install` is a command you run after you edited the file.  So run that at the command prompt:

$ bundle install

`bundle install` will parse your Gemfile for changes and install any missing gems to your system (in this case it would pick up the new 'tiny_tds' gem that you just added).

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Anonymous (not verified)
i had already tried running

i had already tried running the bundle install from the command prompt, but when i do it i get the following error:

$ bundle install

sh.exe": /c/MotorolaRhoMobileSuite2.1.1.7/ruby/bin/bundle: C:/Android/installer/

rhoinstaller/package/ruby/bin/ruby.exe: bad interpreter: No such file or directory

i have installed the RhoStuio installer for windows (RMS_02010107.exe), following the installation tutorial. are there any other packages and/or other paths variable that one needs to install/setup to get the bundler package running.

thanks

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Anton Vishnevsky
Please on windows use only

Please on windows use only standard system console. Bash/Sh console working not properly on windows systems

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Anonymous (not verified)
@ Lars Burgess : editing the

@ Lars Burgess : editing the bundle file to udpate the ruby path did the trick. thanks. i also had to make a similar change to the "C:/MotorolaRhoMobileSuite2.1.1.7/ruby/bin/gem" file

@ anton vishnevskiy : didn't know the windows command prompt can be used the same way as the GIT bach console. i can now correct my typos

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Lars Burgess
This may be an issue with the

This may be an issue with the installer, can you try editing the file C:/MotorolaRhoMobileSuite2.1.1.7/ruby/bin/bundle, the ruby.exe line and point it to C:/MotorolaRhoMobileSuite2.1.1.7/ruby/bin/ruby.exe

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


John Duhart
"Please run `bundle install`

"Please run `bundle install`"

Try running bundle install.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Lars Burgess
Hi,I'm marking this assumed

Hi,

I'm marking this assumed answered for now, please let us know if you still have questions.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Log in to post comments