Retrieving data from database

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
riadhazzouz
Active Member

Retrieving data from database

I connected my allinone project to MySql database,  I created a table and added some data.
How can I retrieve that data using javascript backed webscript ?

3 Replies
shyam_ghodasra
Active Member II

Re: Retrieving data from database

Hi,
Can you describe what actually you are wanted to do with that data which you entered in the database manually?

If i talk about the alfresco best practice whatever data you want to use that should goes in to alfresco table with the help of content model(in some case its okay to connect with some other database and get the data from there).
 

Thanks,
Shyam Ghodasra.

riadhazzouz
Active Member

Re: Retrieving data from database

I didn't add the data manually, I created a behaviour, When someone add a file, I save the filename, and username to a table. Now I want to display a message to the share telling that " username added filename ".

jpotts
Advanced II

Re: Retrieving data from database

First, realize this is not the greatest idea. Don't create tables in Alfresco's database. Create them in a separate database. With that said, you wrote a behavior to save the data, so what is the problem trying to get it out?

If the problem is that you need to query the data from JavaScript, you can write a base scope processor extension to expose a Java class as a root-scoped JavaScript object. The Java class can query the data from the database and return it. Then, in JavaScript you can just call the root scoped object to get the data.

If you are not sure how to do a custom root scoped object, there are many examples in public source code. Here's one that I did for the acl-templates project: alfresco-acl-templates/acl-templates-repo/src/main/java/com/conexiam/acl/templates/service at master...