Im building mob app for ios and android using xamarin studio on Mac and i want to connect to a mysql DB . so Ive downloaded the MySql connector from the below link : http://dev.mysql.com/downloads/connector/net/
and referenced it in my code and added the below code :
MySqlConnectionStringBuilder conn_string = new MySqlConnectionStringBuilder ();
conn_string.Server = "serverIP";
conn_string.UserID = "user";
conn_string.Password = "pssword";
conn_string.Database = "DBTest";
MySqlConnection conn = new MySqlConnection(conn_string.ToString());
conn.Open();
conn.Close()
When i build the solution ,the build is successful but when I run the solution ,it will give me the following error :
System.TypeLoadException has been thrown Could not load type 'MySql.Data.MySqlClient.MySqlTrace' from assembly 'MySql.Data, Version=6.9.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d'.
at
conn.Open();
I found later that this version is not compatible with xamarin.ios or xamarin.android profile .
After long research ,the choices available are :
-Use a MySql.Data.dll assembly built against a PCL profile that is supported by Xamarin.Android or Xamarin.iOS
-Recompile the MySql.Data source against the Xamarin.Android or Xamarin.iOS profile assemblies.
Does anybody have a workable DLL or was able to go through the above solutions or if there are any other ideas ?
Really appreciate it
I think the general approach when connecting to remote databases from a mobile app is to call a webservice (preferably rest based service with JSON). This way your logic for connecting to a MySQL, Oracle, SQL server database is solely on the server. For connecting to local databases on the device generally most folks will use SQLite. Hope this helps.
As of my opinion it won't be wise to connect directly to a MySQL database from an iOS app.
Personally I would need to make a web-based backend using REST, JSON or PHP. Or even a combo :)
Check this link for understanding the logic behind it: http://codewithchris.com/iphone-app-connect-to-mysql-database/#connectiphonetomysql
Otherwise try check your thread at the Xaramin forums :) Link for others
Related
I want to get product info by using barcode and want to query it in https://www.factual.com. How can I use factual API for Android and how I configure it ?
Start from factual's developer website .
You can follow up the get start in the documentation,
Here is the link: http://developer.factual.com/get-started/
Do it step by step, and on the step 4, you will get some example you need to try it out.
Go This page and download the relevant example
http://developer.factual.com/examples/
and start exploring.
You have to use http call to query the factual.com tables.
Here are some http examples you have to call on your code: (after you have your api key)
http://api.v3.factual.com/t/products-cpg?q=shampoo
http://api.v3.factual.com/t/products-cpg?q=shampoo&filters={"brand":"pantene"}
http://api.v3.factual.com/t/products-cpg?filters={"upc":"052000131512"}
You can look on this page for more examples:
http://developer.factual.com/working-with-factual-products/
I think you are looking for this table field: upc_e = The UPC-E barcode used for identifying products. 8-digits in length.
The product table schema is here:
http://www.factual.com/data/t/products-cpg/schema
I solved my issue by placing php driver of factual in root directory of WAMP server.Instead of android, i use php driver. Now i am sending barcode form android device to WAMP (server) PHP driver.
I would like to have a background service running all time that register the device using the Parse API and emits Push Notifications, while having the main app developed in Qt with QML/JS. My question is: Is this possible? How can I do it? Is there any code-like example or documentation?
This is because I would like to write my application using Qt (QML + JS) and use Parse on the server side with it's PHP SDK.
Thanks for any help!
this should help (commercial solution):
http://plugins.v-play.net/plugins/parse/
I am new to phonegap development and currently developing an app that will run on android, i-phone and on windows phone. But getting problem in handling session from phonegap app - I got few post here on stack overflow but that was only for iphone using appDelegate.m defining cookie storage and also I got few post for only android storing session in HttpClient object coded in java - but is there anything on phonegap side to handle session - because then we can use the same code for all 3 devices ( iphone, android, windows ).
Probably I may sounds some sort of odd but I am really undecided as can't find any clue how to maintain the session and how to use the same session on consecutive calls to serverside script for gettinf different session specific information.
Is there any common way to achieve this that I may missed. Any help is highly appreciated. Thanks in advance.
With Regards,
Supriyo
Unless I misunderstood you, HTML5's localStorage is the way to go.
It is implemented in Phonegap, as described here: http://docs.phonegap.com/en/1.7.0/cordova_storage_storage.md.html#localStorage
This one works for me.
var CheckboxValue=$("#rememberme").is("checked");
if (CheckboxValue== true)
{
var username = $("#user").val();
var password = $("#pass").val();
window.localStorage.setItem("username", username);
window.localStorage.setItem("password", password);
}
Now, I have a web application made using [html, asp.net, sql server,javascript & ajax].
As usual I use ajax to send data to the server using the aspx page.
My Application is working fine, but I want to deploy it on Android.
The asp urls I use at the ajax function are:
url:'http://localhost:49169/xxxxx.aspx'
As you can see, this won't be working on the mobile coz the url changes everytime.
So what should I do in order to change the url and IP Address to make them static & take the new configurations of the IP without recompiling the project ?
Thanks.
It depends upon which version of visual studio you are using. But the general gist is that you can set the port from "using dynamic port" which it chooses one for you e.g. 49169 to a fixed port which you can specify.
Here are the intructions for vissual studio 2008, I believe it's the same intructions (or very similar) for other versions of visual studio:
http://msdn.microsoft.com/en-us/library/ms178109%28v=vs.90%29.aspx
Does anyone know how does MondgoDB works on Android.
Does it work locally and you the data gets replicated later? Does work only online with just a web backend?
MongoDB has downloads for several operating systems. However, Android is not one of those systems.
People use MongoDB as a "web service" for storing data, but it does not have any features to support multi-master replication or your occasionally connected mobile scenario.
If you need these types of features, you'll want to check out CouchDB which specifically targets this scenario with Android Couchbase.
I'm going to revive this thread and say that MongoDB's Java driver IS currently compatible with Android. Some novice developers might have trouble getting their apps to use MongoDB's java library, so I'll just outline what you have to do (though all of this could be obsolete by the time you're reading this).
Go to your app build.gradle file. Add this "compile" entry under your dependencies (you will probably have to replace the version):
dependencies {
...
implementation 'org.mongodb:mongo-java-driver:3.0.3'
}
As you can see, the driver's version as of this post is 3.0.3. You can find the current version by searching "mongo-java-driver" or any related terms at http://search.maven.org.
If you're connecting to an external database, you will of course need to add the INTERNET permission to your manifest. Connecting to one is pretty simple. Here's an example. Replace the username, password, host domain, port, and database name:
MongoClientURI uri = new MongoClientURI( "mongodb://username:password#www.example.com:12345/db-name" );
MongoClient mongoClient = new MongoClient(uri);
MongoDatabase db = mongoClient.getDatabase(uri.getDatabase());
Since this is network related, you will need to run all of that in an AsyncTask class.
Following the java tutorials on https://www.mongodb.org/ should be relatively straightforward from here on out.
Dory mongoDB Server
Great new Android application
No Need to root your Phone and You Can Run your js File From anywere.
MongoDB (from humongous) is a free and open-source cross-platform document-oriented database program. Classified as a NoSQL database program, MongoDB uses JSON-like documents with schemas.
Usage:
1: install Dory mongoDB Server
2: run your Server
3: install Dory node.js
4: run this code in your js file:
Code:
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/test', { useMongoClient: true });
mongoose.Promise = global.Promise;
var Cat = mongoose.model('Cat', { name: String });
var kitty = new Cat({ name: 'Zildjian' });
kitty.save(function (err) {
if (err) {
console.log(err);
} else {
console.log('meow');
}
});
Enjoy. 😉
Unfortunately Mongo Java Driver 3.8.0 is not compatible with Android anymore: https://gitlab.com/mvysny/umn/issues/1 and they don't even claim Android support. Maybe following the unofficial fork or trying GnuSasl could help? mongodb 3.x driver Android compatibility
MongoDB is also available for android
The only problem is that it does not have well-structured documentation for android..
I recently managed to connect my android application to the remote database
here is a sample unit application
https://github.com/i-sachinkumar/MongoDB-for-Android
Its readme file contains all the steps to be followed in the back-end as well as in the android studio
Reactivating this Topic again after 2 years.
I was looking for an android app exactly like MongoDB Compass, but couldn't find "exactly" like it. So deciding to make one (and open source it)
Based on links given in #Astral1990's answer, I found this.
Now for a gist:
Gradle file: (more info here)
implementation 'org.mongodb:mongodb-driver-sync:4.2.3'
For creating the client: (more info here)
MongoClient mongoClient = MongoClients.create("mongodb://user1:pwd1#host1/?authSource=db1");
Then other things:
// get db
MongoDatabase database = mongoClient.getDatabase("test");
// get collection in db
MongoCollection<Document> coll = database.getCollection("myTestCollection");
// list collections (permission has to be present)
for (String name : database.listCollectionNames()) {
System.out.println(name);
}
Queries and others
It isn't possible to install MongoDB in android devices because the MongoDB's latest releases doesn't support android device's CPU architecture.
But I read an article on codipher.com and i gave it a try and it finally worked, i was able to use MongoDB on my android phone.
Here is the link: https://codipher.com/install-mongodb-on-android/