I am trying to access Azure SQL Database , using java. Our code will be staying in MS Appcenter. Since the DB firewall is not letting the Appcenter to access the database, I am trying to use API. Can someone help me provide me steps / sample code to get it started?
You will need to enable firewall of Azure SQL Database to allow
connection from azure (as you are hosting it in the MS Appcenter).
In order to do that read document
Once that is enabled, you can use documentation Quickstart to see how you can connect from it from application. Above document is in java language but you can find similar document for other languages also.
Related
can someone help me with any sample working code or any project that I can look at? I have been searching this on google for few days but I always end up an answer with spring boot but I need to connect without using spring boot. I need to write automated API tests where I have to connect to cloud Sql fetch the data from Db and validate it.
As #siamsot mentioned, there is an article in the official GCP documentation on how to connect to a Cloud SQL instance.
Basically, you have the following options to connect to a Cloud SQL instance:
By using the proxy (Second Generation instances only)
By configuring access for one or more public IP addresses
By using the JDBC Socket Factory (for the Java programming language,
Second Generation instances only)
By using the Cloud SQL Proxy library (for the Go programming language, Second Generation instances only)
I have developed a REST web-service in Java interacting with a MySQL database.I want to deploy the web-service and the create a database at a server so that I can invoke it from an application.I tried Microsoft Azure but was unable to get it done.Where can I find relevant information for this?
I had similar problems with a MySQL database using the third party option in the Azure Marketplace from ClearDb. What I ended up doing was switching my database from a MySQL instance to an Azure Database Instance (Subset of SQL Server's features.) This worked perfectly for me! I was able to query from my database feed data to my api, and access the API through my Azure Web App.
I understand this may not be an option for you, however, Digital Ocean is a great cloud hosting option (with scaling similar to Azure, although not as good in my honest opinion.) You can set up a Linux Environment with a MySQL Server and JVM and serve your whole API through there. Best of Luck!
#coderden, According to your description, I think you have been deployed your Java Application on an Azure WebApp. Then when you created a MySQL database on Azure for connection from the Java webapp, please make sure the webapp & mysql instance created in a same resource group and note the connection string of MySQL on Azure.
As reference, please see the article to try again although it's for PHP, the steps are the same for Java.
I wanted to use RDS to store data created within my webapp.
I am already storing data in dynamo tables and can pipe the same data into S3 files.
Due to some project requirements, I wanted to store the data into RDS tables. I havent found any resources to help me find a way to use the AWS Java SDK to store data incrementally into RDS.
Does any one know of a way to do that? Or is there any way to achieve that via some other way?
Thanks a lot for you help!
You can't use the AWS SDK to store data in Amazon RDS like Dynamo DB. RDS is a managed database service that hosts many different database engines (Amazon Aurora, MySQL, MariaDB, Oracle, SQL Server, and PostgreSQL database engines) that each have their own clients and protocols for transferring data.
You'll need to evaluate these database engines separately, determine which one you want to use, and use a client for that engine to read and write your data.
The AWS SDK and APIs can be used to provision and modify your RDS DB instances (the servers hosting your database) but not to manipulate or read the data itself. You can view the API documentation for a full listing of available actions.
After digging up myself and Anthony helping me out with clarification, I understand it better.
In case anyone else comes here searching for the same issue:
The endpoint that is provided for the database you create in RDS can be used to write into the table or execute any db query, for that matter.
Here is a nice tutorial to get you started.
http://zetcode.com/db/postgresqljavatutorial/
Good luck guys.
Just came accross this post. My understanding is that you don't need AWS SDK:
you make the databse accessible from the Internet
you use traditional jdbc calls as with any other db
This info is in the manual of the management console, but it is valid in general:
https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/java-rds.html
I want to fetch all the names of tables present in a database, which is present in a Google CloudSQL instance. Is this possible through their Java Client libraries (Java SDK).
I know 'gcloud (command line)' can be used, but I want to do every call using Java APIs. Please help. Thanks. :)
Yes, it's possible. You can enable MySQL Connector/J in your Java App Engine application:
https://cloud.google.com/appengine/docs/java/cloud-sql/#enable_connector_j
Connect and communicate with your database. Check this document:
https://cloud.google.com/appengine/docs/java/cloud-sql/
Does anybody have specifics on how to connect an Android application to MongoDB running on Azure roles?
--
Hi, I have MongoDB replica set running on multiple Azure roles in the Cloud Service. I have used the mongo-azure library on GitHub to create the role instances and have them running in Azure.
Most articles online seem to only talk about connecting to Azure-MongoDB locally (via localhost). But, since my application won't be running locally to Azure, I feel that I have to use REST to somehow connect to Azure cloud servers, which may or may not propagate data to the MongoDB replica set.
Does anybody have more specifics on how to connect an Android application to MongoDB running on Azure roles?
(Or, for those that don't have experience with Android/Java: how to connect from non-localhost using non-.NET?)
ps - In other MongoDB questions, people have already answered Android is not natively support by MongoDB, and using non-native methods is fine by me. There are apps out there that already do this, mainly Foursquare. Unfortunately, they use AWS instead of Azure (the requirement for me).
pps - if anybody has any more resources for the linked mongo-library about how it works in more detailed terms, then that would be very helpful too.
UPDATE:
I found the most up-to-date version of mongo-java-driver.jar (currently 2.11.3) and am testing that.
Thanks to another question I've found the particular issue with Android not supported by the java driver, but that issue appears to be resolved.
Possible Solution:
In the Visual Studio project, I created an Input Endpoint for the role. So far that seems to do the trick, using MongoClient mongo = new MongoClient("<my_ip_address>", 27017);
Your 'possible solution' is the right one in my view - you need to open a (load balanced) TCP port in the firewall surrounding your roles and InputEndpoint is the way to do that.
You cannot use an input endpoint if you are doing writes when using a replica set of size > 1 if you are the github solution above. You do not want the Azure load balancer to route a write (insert or update) to a secondary of MongoDB in which case your write will fail.
If you use Azure virtual machines then you can create a port mapping per virtual machine instance and overcome this.