This is a migrated thread and some comments may be shown as answers.

How to connect to a Oracle database ?

11 Answers 909 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Shounak
Top achievements
Rank 1
Shounak asked on 26 Aug 2011, 08:34 AM
Hi ,

I am loving this site ever since I had stumbled upon it while googling . Awesome job , I must say.

But , I am facing some problem regarding datasource, In most of the examples , it has been used as JSON or XML database.

Can I connect without using XML or JSON ?



Keep up the good work.

Thank you.

11 Answers, 1 is accepted

Sort by
0
life
Top achievements
Rank 1
answered on 01 Sep 2011, 08:47 AM
About this,I think the javascript can not operate the Database it is not a server language,you can use like php  java or other to operate database and make json or xml.
0
Pasi
Top achievements
Rank 1
answered on 15 Sep 2011, 02:46 PM
Hello,

This might be a bit newbie question but how do I pass and read JSON dataSource parameters in PHP?
----
var dataSource = new kendo.data.DataSource({
                        transport: {
                            read: {
                                url: "http://example.com/test.php", // the remove service url
                                dataType: "json", // JSONP (JSON with padding) is required for cross-domain AJAX
                            }
                        },
                        data: {
                        status: 2
                        },
                        schema: { // describe the result format
                            data: "results" // the data which the data source will be bound to is in the "results" field
                        },
                        change: function() { // subscribe to the CHANGE event of the data source
                            $("#tweets").html(kendo.render(template, this.view()));
                        }
                    });
0
Todd Anglin
Top achievements
Rank 2
answered on 20 Sep 2011, 06:28 PM
@Shounak- @life is correct. Kendo UI is a JavaScript framework that runs in the browser. It does not have the ability to directly talk to database servers (for obvious security reasons). Instead, you can use any server-side framework and language, like PHP or .NET, to query your data from Oracle and then return it to your page via a JSON or XML web service. This is the standard pattern for any data service with JavaScript-powered sites and apps.

@Pasi- We will eventually provide server-side wrappers for PHP (and other languages) to make this process even easier. For now, you can simply use server-side code to "inject" static values in to your JavaScript configuration on the server, and then when the final HTML gets sent the browser, Kendo UI will initialize with these values.

For example, if you were trying to configure the data source with a server-side value for "status," then you might have PHP code like this:

var dataSource = new kendo.data.DataSource({
      transport: {
            read: {
                  url: "http://example.com/test.php",
                  dataType: "json",
             }
       },
      data: {
            status: "<?php echo $phpvar ?>"
      }...
});

Where $phpvar is the PHP variable with the value you want rendered in the script configuration.

Hope that helps.

-Todd
0
Shounak
Top achievements
Rank 1
answered on 21 Sep 2011, 07:46 AM
@Todd : Does Kendo UI support J2EE ? or is it only for PHP ?

I have to design my project in J2EE . Can I do like this as you have mentioned :

var dataSource = new kendo.data.DataSource({
      transport: {
            read: {
                  url: "http://example.com/test.jsp",
                  dataType: "json",
             }
       },
      data: {
            status: "<%= jspvar %>"
      }...
});
0
Todd Anglin
Top achievements
Rank 2
answered on 21 Sep 2011, 03:30 PM
I'm not as familiar with J2EE, but in theory, if your code example is just writing values to the page output, then yes! Again, Kendo UI is a front-end framework that runs in the browser. You can use any server-side framework you like to manipulate the HTML/JavaScript before it reaches the browser:

J2EE, Rails, ASP.NET WebForms/MVC, PHP, Python, Ruby, whatever

The syntax will change with the different frameworks, but the concept remains the same.

To be clear, a server framework is not required to use Kendo UI- you can do everything with static HTML and JavaScript. But if you want dynamic configuration, the example here should help show the way.

-Todd
0
Pasi
Top achievements
Rank 1
answered on 22 Sep 2011, 11:21 AM
Thanks Todd for your reply.

You can send parameters to PHP by calling the read method with parameters.

dataSource.read({status: $('#status').val()});

Is the data parameter in the next example the same thing? 
var dataSource = new kendo.data.DataSource({
      transport: {
            read: {
                  url: "http://example.com/test.php",
                  dataType: "json",
             }
       },
      data: {
            status: $('#status').val()
      }...
});
0
Todd Anglin
Top achievements
Rank 2
answered on 22 Sep 2011, 11:17 PM
@Pasi- Yes, those two techniques are functionally equivalent. Both will append the values as named parameters to the querystring when the data source fires a request to the remote service.

Thanks for highlighting the alternate syntax option!

-Todd
0
Florian
Top achievements
Rank 1
answered on 08 May 2012, 01:55 PM
Hello guys,

I'm trying to get the data via Coldfusion query I was wondering if someone could help me out with this?
Hope I'd get a reponse, thx in advance, Flo

0
Todd Anglin
Top achievements
Rank 2
answered on 09 May 2012, 07:25 AM
Hello Flo-

Thanks for using Kendo UI! It sounds like you're asking a new question. For future reference, in general it's best to start new forum threads for new questions so it's easier for others to find related answers. We're always happy to help, though, so let me try to provide some direct assistance.

Whether you're using ColdFusion, PHP, Java, .NET, or any other server-side platform, the process for getting data to Kendo UI is mostly the same. You need to expose a web service endpoint that can serve-up data to your page with Kendo UI widgets. The web service can return JSON or XML data, though JSON is the more popular and common format.

I'm not a ColdFusion expert, so I can't provide a direct code sample, but this site has a basic example of a ColdFusion web service that returns JSON: http://www.bennadel.com/blog/764-Learning-ColdFusion-8-Javascript-Object-Notation-JSON-Part-III-AJAX-Demo.htm

Hopefully it gives you an idea of where your query fits-in to the picture. Once your query is returning JSON data, you can bind a Kendo UI DataSource directly to the endpoint (let's say it's http://yoursite.com/services/yourQueryServce.cfd?method=getData).

Good luck on your project!
-Todd

0
Vesselin Obreshkov
Top achievements
Rank 2
answered on 09 May 2012, 03:12 PM
@Florian I haven't used ColdFusion in years, but from what I remember, when it serializes objects into JSON, it makes all field names UPPERCASE so a component like this:

<cfcomponent>
  <cfproperty type="numeric" name="ProductID" />
  <cfproperty type="string" name="ProductName" />
  <cfproperty type="date" name="ExpirationDate" />
</cfcomponent>

will serialize with properties PRODUCTID, PRODUCTNAME, etc instead of ProductID, ProductName, etc. ColdFusion isn't case-sensitive but JavaScript (and in turn Kendo UI is). You can probably use a custom Java serializer to get proper serialization out of your ColdFusion apps  

Look at this StackOverflow thread for some more pointers and sample code:
http://stackoverflow.com/questions/2556476/ajax-coldfusion-cfc-json-hello-world

Look at this blog post about a (hacky) way to get your objects serialized with their proper case:
http://www.bennadel.com/blog/2162-Maintaining-Key-Case-During-JSON-Serialization-In-ColdFusion.htm 

Probably your best bet would be to find some third party component/cfc (possibly written in Java that works with Jrun) that will give your proper JSON serialization. From what I remember, ColdFusion's built-in one sucks really, really bad.
0
PRAVEEN KUMAR
Top achievements
Rank 1
answered on 07 Nov 2013, 07:46 AM
Hi,, I did mobile web app in html5/javascript and i should connect for mysql database,, so i need to interact to jsp?
Tags
Data Source
Asked by
Shounak
Top achievements
Rank 1
Answers by
life
Top achievements
Rank 1
Pasi
Top achievements
Rank 1
Todd Anglin
Top achievements
Rank 2
Shounak
Top achievements
Rank 1
Florian
Top achievements
Rank 1
Vesselin Obreshkov
Top achievements
Rank 2
PRAVEEN KUMAR
Top achievements
Rank 1
Share this question
or