Connecting to a MS SQL 2012 using jquery? - php

I've built a web app using Sharepoint 2010 and was able to connect to a Sahrepoint list using REST API (ajax). THis method allowed to use a Sharepoint list as a database.
Now I am in the process of creating a web server with MSSQL. I havent dealt with MSSQL a whole lot to be honest. I know that the ideal way to access the database is via PHP but its not an option at this moment. So i'm trying to see if I can simply use jquery/javascript to get, update, create and delete records using AJAX.
Im having a hard time finding any info on this but would anyone know if MSSQL allows HTTP access liek Sharepoint's REST API?
I would imagine there might be a way to activate this function in MSSQL somehow but again, not finging a whole lot of noob guides or noob info on this. I would appreciate any input.

No, MSSQL does not natively host any RESTful APIs. You will need to use some kind of back end/server side code to actually make the database connection and run queries/return results.
You could use PHP (which is probably not the "ideal" for working with an MS product, but would certainly work), but you could also use a host of other server side languages - Perl, Python, Java, C#, C, C++, etc. and just expose JSON/RESTful methods for jQuery to interface with.
The "ideal" currently would be to look into oData services. Most likely you'd write an oData service hosted as a WCF service or ASP.NET site in C#.
See also:
http://www.hanselman.com/blog/CreatingAnODataAPIForStackOverflowIncludingXMLAndJSONIn30Minutes.aspx
how to query SQL Server via REST to get XML.

Related

Is it possible to connect a PHPmyAdmin database using Angular and Postman?

this is my first time using StackOverflow and I don't know how this works but I'll be quick and short. So, I'm in an internship and I'm learning Angular and I only know the basics. They told me to make a simple project so I can understand the basics of Angular by making a task manager and using as Database PHPmyAdmin and of course PHP language. I did the database and I'm using Postman to get the HTTP request as the company colleagues told me to use. I want to understand if it is possible to make the database connection to Angular and how.
No because there's no such thing as a "phpmyadmin database".
Phpmyadmin is a tool for interacting with a mysql/mariadb database management system which will contain one or more databases.
Meanwhile angular is a toolkit/framework/library for writing JavaScript code to run in a browser. Browsers communicate with servers using http. Mariadb and mysql don't speak http. You need to build something serverside to bridge the http to the DBMS. You appear to be using PHP serverside already for this but there are lots of other languages.

How do I locally simulate accessing a Dynamics CRM database for use with SOAP?

I am currently starting on a project for school where we are to make a prototype for an application that uses PHP and SOAP to access a Dynamics CRM server.
So far I've gotten my apache server up and running and a project set up in Netbeans, simple .php files work just fine...
Now I'd need a similar database as is used in a MS Dynamics CRM system that I can run locally (so no network connection or configuration is required). Connection to the actual database (of the company we make the prototype for) is impossible.
An SQL server would be the easiest option I know of (according to a post here MySQL is incompatible with the dynamics database so that's not an option) since we have used this in class already, but is this a comparable database to the one used in Dynamics CRM?
This assignment is slightly out of my league since I have had no experience with PHP or SOAP coding, but then again we only need to simulate a couple of simple insert/update/delete/... statements - only problem being I have no idea how I should simulate their database.
Thanks in advance for you help, feel free to ask any extra questions if you need more information
Just having a database isn't going to be enough here. Dynamics CRM is the application which has the SOAP web service endpoint and then performs any actions on the database.
You cannot just run SOAP calls directly against the database and you should not be directly editing the CRM database - its not supported by Microsoft.
What you really need is a full development environment - CRM, SQL, AD the whole setup.
So traditionally you might go for a local server with CRM On-Premise, SQL and all their prerequisites installed, not a cheap option and it sounds like it might be beyond your current resources.
So my suggestion would be to go for CRM Online - basically Microsoft host everything and you access CRM via the web. CRM Online is basically the same as CRM On-Premise, there are some key differences but you will be able to perform all your SOAP calls against a real working CRM.
Even better CRM Online has a 30-Day free trial, after that its a $44 a month per user, but as I understand you can just keep creating more free trials.
Also you then need to get your clients customisations installed on the environment. You can export those from CRM and import them into your development environment. You can do this without taking an live data - which is probably why the client doesn't want to give you their database. The reason this is important is so you have the correct data model which is very important for the SOAP web service calls.
In regards to the PHP SOAP bits you might want to have a look at: PHP MSCRM, I haven't used it myself but it looks useful.
As a side, you may want to look at the OData endpoint of MSCRM you may find it more straightforward to use from PHP.

Connecting MySql with Android without using PHP

I want to connect a MySql DB with my android application.
However, I DON'T want to/CAN'T use PHP for doing this.
Almost all solution for MySql connection with android on internet uses PHP.
I read somewhere that, If one don't want to use PHP then web service should be used.
But I'm not able to find any tutorial/sample example for the same.
Any help appreciated.
It seems you're mixing up some things.
A web service is simply some code on the internet (web) which allows you to receive and send information to a server, where it is saved per example in a database.
PHP is just a language, in which you can write a web service.
You can use a vast array of languages to create a web service ( read: expose your database) to other devices. Among others, you can easily do this in Java, .NET, Python ...
If you're looking for a way to connect to an external database without any web service / API in between, i'll have to disappoint you with the news that this is not supported by Android.
Most examples of a simple web service / a bunch of scripts contain PHP since this is probably the easiest and can be used on pretty much any server.
A webservice, is as it's called, a service, meaning that you have one side consuming it (the android client). if all you want is a persistent storage, you could use SQLite which is an SQL compliant solution which exists within android.
If it's possible to SSH to a server via Android, you could use that to connect to mysql, because the only other solution involves having mysql binaries installed locally on your android machine, and that's not possible AS FAR AS I KNOW, on Android.
One major reason for using a webservice (e.g. written in PHP) to connect to a remote DB is that you don't want to store the database login credentials inside your app. Because otherwise it'll be easy to extract your login for that database and access and edit it in a way you might not have planned (eg. delete stuff).
Its Possible to connect mysql database .
I have done with out using php file . I have used an spring configuration file to establish an connection to the database and dao to access the data from the database.
Create an Web Application that access the Server through the Spring Framework and an Servlet .
Create an Android Client Application tat make an get / post request to the Servlet , process the results in the servlet and return the response to the Android Client Application (json format ) Process the json format reponse in the Android Client Side and use it to your application

What is the best way to connect an android application and a php server using sockets?

What is the best way to connect an android application and a php server using sockets? I am trying to implement a chat system between multiple clients, but I know that PHP does not allow multithreads.
Sorry for not giving enough information about what I intend to do. I basically want to create an app simmilar to google latitude, and I also want to implement a chat system between the users. I have aldready decided that I am going to use a MySQl DB and therfore a PHP server so the client communicates with the DB using JSON for data exchange. I am quite new to this and I don't know how the architecture Client-Server-Client communication should look like. I found out that the easiest way to do this is using HTTP requests, but I don't know how I should implement this.
I think you can use jabber protocol, install any xmpp server and you can connect to that from android, this is standard for chat applications
use xml-rpc base php webservices for chat server. your chat client will contact to chat server throught web services.
*I was going to make this a comment but I ran out of space, plus it does have some answer-y qualities to it.
This question does not contain nearly enough information for anyone to usefully help you. How do you think it should be done? You can't ask people to critique an idea when you haven't told them what your idea is.
PHP is the wrong language for this, because (as you rightly point out) it can't be multi-threaded - amongst a multitude of other reasons. I personally would recommend Node.js (or possibly Java), but that's just my preference.
If you still insist on using PHP, take a look at this. It might give you a point in the right direction for a non-blocking multi-IO setup such as this - but you're letting yourself into a whole world of unnecessary complication by doing this in PHP.

Can I expose MySQL data using PHP and OData?

As I understand it, OData is just a standardized way to expose relational data RESTfully. If I've got a PHP application, it should be able to process those RESTful requests and manipulate a MySQL database based on the request data and then return an ATOM feed. First, are the preceeding statements correct? Second, does a PHP library to do this already exist or would I have to create my own?
If I have completely misunderstood these technologies and my question doesn't make sense, please feel free to let me know.
OData is a way of exposing all sorts of structured data over an HTTP interface. The underlying repository for data may be relational or not. For example, when using WCF Data Services on top of SQL Server it's certainly a relational data set, but the OData endpoints in SharePoint Server 2010 or on Windows Azure Table Storage run on top of other data models. The high order bit is to make all data available in a web-friendly way.
As for your specific question about MySQL/PHP, there is an OData client for PHP but to my knowledge there isn't a server implementation available. I know there is a MySQL provider for ADO.NET, maybe if it has Entity Framework support you can use WCF Data Services, but that means you'd be running on .NET and not on PHP, don't know if it's acceptable for your situation.
MySQL/PHP OData Server - http://sourceforge.net/projects/mysqlodata/
Here is a library to do what you want:
https://github.com/MSOpenTech/odataphpprod/
The library you needed came out only in September 2011. Here is an MSDN article.

Categories