Form populate with data from sql

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Form populate with data from sql

karthik Jayaraman
I am a beginner. I have had a good look at the tutorials offered by orbeon. Now here is my problem.

I have a form which contains two textboxes. My requirement is if i enter a value in one text box and click the second one , the latter must b populated with values from db corresponding to the value entered in the first textbox.

Already my tomcat is configured to use mysql.

I figured out that i could use database services and action for it from the link

http://wiki.orbeon.com/forms/doc/user-guide/form-builder-user-guide#TOC-Advanced:-services-and-actions

But it s not self explanatory. Can anyone provide me step by step or atleast good explanation how to do this. Thanks ...
Reply | Threaded
Open this post in threaded view
|

Re: Form populate with data from sql

Alessandro  Vernet
Administrator
Hi,

Let me go over an example:

1. Using the employee sample database in MySQL
(http://dev.mysql.com/doc/employee/en/employee.html).
2. Setup a datasource for MySQL in Tomcat; I named it "mysql".
2. Create two fileds: first-name, last-name, and want to populate
last-name based on the first employee that has that first name the
user typed: http://screencast.com/t/N2E1Nzg4YWMt
3. Create a database service as follows: http://screencast.com/t/MjRiZWJhNjQt
4. Create an action as follows: http://screencast.com/t/MzY1NTZjZjgt
5. Testing the form, type "Georgi" in the first name field, hit tab
and you'll see the last name field populated with "Facello".

I hope this helps,

Alex

On Tue, Mar 23, 2010 at 5:48 AM, karthik Jayraman <[hidden email]> wrote:

>
> I am a beginner. I have had a good look at the tutorials offered by orbeon.
> Now here is my problem.
>
> I have a form which contains two textboxes. My requirement is if i enter a
> value in one text box and click the second one , the latter must b populated
> with values from db corresponding to the value entered in the first textbox.
>
> Already my tomcat is configured to use mysql.
>
> I figured out that i could use database services and action for it from the
> link
>
> http://wiki.orbeon.com/forms/doc/user-guide/form-builder-user-guide#TOC-Advanced:-services-and-actions
>
> But it s not self explanatory. Can anyone provide me step by step or atleast
> good explanation how to do this. Thanks ...
> --
> View this message in context: http://n4.nabble.com/Form-populate-with-data-from-sql-tp1678998p1678998.html
> Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>
>


--
Orbeon Forms - Web forms, open-source, for the Enterprise -
http://www.orbeon.com/
My Twitter: http://twitter.com/avernet


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Form populate with data from sql

karthik Jayaraman
This post was updated on .
Thanks for your help !! I have a DB named orbeang3 and it contains tables

1. orbeon_form_data
2. orbeon_form_data_attach
3. orbeon_form_definition
4. orbeon_form_definition_attach

It is the table used by orbeon. I have created another table in this DB named employee, contains first-name and last-name fields.

In my tomcat server's conf/server.xml i have included the lines to access my datasource which s as follows


<Resource name="mysql" auth="Container" type="javax.sql.DataSource"
 username="root"
 password="root"
 driverClassName="com.mysql.jdbc.Driver"
 url="jdbc:mysql://localhost:3306/orbeong3"
 maxActive="15"
 maxIdle="7"  />


and i configured database service and action as given in the screenshot. But if i enter the first-name and click last-name loading symbol appears and nothing happen after that.

PLS HELP ME ...

-------------------------------------UPDATE--------------------------------------------

I have checked orbeon log and it says

" Name mysql is not bound in this Context" error . I cant figure out what's wrong

------------------------------------UPDATE 2-------------------------------------------

And now i am gettin this excption after writing my datasource details in web.xml of tomcat



java.sql.SQLException: No suitable driver
        at java.sql.DriverManager.getDriver(DriverManager.java:243)


Please any one help me soon


Reply | Threaded
Open this post in threaded view
|

Re: Form populate with data from sql

karthik Jayaraman
K friends . I figured it out by myself. Thank for support !!
Reply | Threaded
Open this post in threaded view
|

Re: Re: Form populate with data from sql

Alessandro  Vernet
Administrator
Excellent; I am glad you figured this one out! Thanks for the update.

Alex

On Wed, Mar 24, 2010 at 4:35 AM, karthik Jayraman <[hidden email]> wrote:

>
> K friends . I figured it out by myself. Thank for support !!
> --
> View this message in context: http://n4.nabble.com/Form-populate-with-data-from-sql-tp1678998p1680404.html
> Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>
>


--
Orbeon Forms - Web forms, open-source, for the Enterprise -
http://www.orbeon.com/
My Twitter: http://twitter.com/avernet


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Re: Form populate with data from sql

ManMohan Vyas
can you guys please share what was the reason behind the error ?? I am getting the same one



thanks
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Form populate with data from sql

fl.schmitt(ops-users)
ManMohan,

> can you guys please share what was the reason behind the error ?? I am
> getting the same one

you'll need to put the MySQL JDBC driver [1] where tomcat looks for it,
for example $CATALINA_HOME/lib (see [2]).

HTH
florian

[1] http://dev.mysql.com/downloads/connector/j/
[2]
http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html#MySQL_DBCP_Example



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Form populate with data from sql

ManMohan Vyas
thank you for you reply .. m now getting warnings

2010-10-28 06:25:24,671 WARN  XFormsServer  - xxforms:instance() - instance not found {instance id: "fr-uuid"}
2010-10-28 06:25:24,671 WARN  XFormsServer  - xxforms:instance() - instance not found {instance id: "fr-save-locally-file-name"}
2010-10-28 06:25:24,687 INFO  ProcessorService  - /xforms-server - Timing: 47 - Cache hits for cache.main: 24, fault: 1, adds: 0, expirations: 0, success rate: 96%
2010-10-28 06:25:25,109 INFO  ProcessorService  - /xforms-server - Received request
2010-10-28 06:25:25,125 INFO  ProcessorService  - /fr/service/exist/crud/orbeon/bookshelf/data/60863644d29995225c69ab983387fd5a/data.xml - Received request
2010-10-28 06:25:25,156 INFO  ProcessorService  - /fr/service/exist/crud/orbeon/bookshelf/data/60863644d29995225c69ab983387fd5a/data.xml - Timing: 31 - Cache hits for cache.main: 275, fault: 2, adds: 0, expirations: 0, success rate: 99%
2010-10-28 06:25:25,156 WARN  XFormsServer  - instance() - instance not found {instance id: "fr-persistence-instance"}
2010-10-28 06:25:25,171 WARN  XFormsServer  - xxforms:instance() - instance not found {instance id: "fr-uuid"}
2010-10-28 06:25:25,171 WARN  XFormsServer  - xxforms:instance() - instance not found {instance id: "fr-save-locally-file-name"}
2010-10-28 06:25:25,187 WARN  XFormsServer  - xxforms:instance() - instance not found {instance id: "fr-uuid"}
2010-10-28 06:25:25,187 WARN  XFormsServer  - xxforms:instance() - instance not found {instance id: "fr-save-locally-file-name"}
2010-10-28 06:25:25,203 INFO  ProcessorService  - /fr/service/exist/crud/orbeon/bookshelf/data/60863644d29995225c69ab983387fd5a/data.xml - Received request
2010-10-28 06:25:25,234 INFO  ProcessorService  - /fr/service/exist/crud/orbeon/bookshelf/data/60863644d29995225c69ab983387fd5a/data.xml - Timing: 31 - Cache hits for cache.main: 275, fault: 2, adds: 0, expirations: 0, success rate: 99%
2010-10-28 06:25:25,234 WARN  XFormsServer  - instance() - instance not found {instance id: "fr-persistence-instance"}
2010-10-28 06:25:25,250 WARN  XFormsServer  - xxforms:instance() - instance not found {instance id: "fr-uuid"}
2010-10-28 06:25:25,250 WARN  XFormsServer  - xxforms:instance() - instance not found {instance id: "fr-save-locally-file-name"}
2010-10-28 06:25:25,281 INFO  ProcessorService  - /xforms-server - Timing: 156 - Cache hits for cache.main: 24, fault: 1, adds: 0, expirations: 0, success rate: 96%


I really dont know what they mean ??? please help ...it is my second day and I am still not able to connect mysql

Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Form populate with data from sql

ManMohan Vyas
me too was able to make it work. know can you please tell me where I can find documentation for inserting two data fields in RDBMS rather than xml

thanks,
ManMohan
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Re: Form populate with data from sql

Erik Bruchez
Administrator
In reply to this post by ManMohan Vyas
You can safely ignore these warnings. They are not related to the MySQL setup.

-Erik

On Wed, Oct 27, 2010 at 11:26 PM, ManMohan Vyas
<[hidden email]> wrote:

>
> thank you for you reply .. m now getting warnings
>
> 2010-10-28 06:25:24,671 WARN  XFormsServer  - xxforms:instance() - instance
> not found {instance id: "fr-uuid"}
> 2010-10-28 06:25:24,671 WARN  XFormsServer  - xxforms:instance() - instance
> not found {instance id: "fr-save-locally-file-name"}
> 2010-10-28 06:25:24,687 INFO  ProcessorService  - /xforms-server - Timing:
> 47 - Cache hits for cache.main: 24, fault: 1, adds: 0, expirations: 0,
> success rate: 96%
> 2010-10-28 06:25:25,109 INFO  ProcessorService  - /xforms-server - Received
> request
> 2010-10-28 06:25:25,125 INFO  ProcessorService  -
> /fr/service/exist/crud/orbeon/bookshelf/data/60863644d29995225c69ab983387fd5a/data.xml
> - Received request
> 2010-10-28 06:25:25,156 INFO  ProcessorService  -
> /fr/service/exist/crud/orbeon/bookshelf/data/60863644d29995225c69ab983387fd5a/data.xml
> - Timing: 31 - Cache hits for cache.main: 275, fault: 2, adds: 0,
> expirations: 0, success rate: 99%
> 2010-10-28 06:25:25,156 WARN  XFormsServer  - instance() - instance not
> found {instance id: "fr-persistence-instance"}
> 2010-10-28 06:25:25,171 WARN  XFormsServer  - xxforms:instance() - instance
> not found {instance id: "fr-uuid"}
> 2010-10-28 06:25:25,171 WARN  XFormsServer  - xxforms:instance() - instance
> not found {instance id: "fr-save-locally-file-name"}
> 2010-10-28 06:25:25,187 WARN  XFormsServer  - xxforms:instance() - instance
> not found {instance id: "fr-uuid"}
> 2010-10-28 06:25:25,187 WARN  XFormsServer  - xxforms:instance() - instance
> not found {instance id: "fr-save-locally-file-name"}
> 2010-10-28 06:25:25,203 INFO  ProcessorService  -
> /fr/service/exist/crud/orbeon/bookshelf/data/60863644d29995225c69ab983387fd5a/data.xml
> - Received request
> 2010-10-28 06:25:25,234 INFO  ProcessorService  -
> /fr/service/exist/crud/orbeon/bookshelf/data/60863644d29995225c69ab983387fd5a/data.xml
> - Timing: 31 - Cache hits for cache.main: 275, fault: 2, adds: 0,
> expirations: 0, success rate: 99%
> 2010-10-28 06:25:25,234 WARN  XFormsServer  - instance() - instance not
> found {instance id: "fr-persistence-instance"}
> 2010-10-28 06:25:25,250 WARN  XFormsServer  - xxforms:instance() - instance
> not found {instance id: "fr-uuid"}
> 2010-10-28 06:25:25,250 WARN  XFormsServer  - xxforms:instance() - instance
> not found {instance id: "fr-save-locally-file-name"}
> 2010-10-28 06:25:25,281 INFO  ProcessorService  - /xforms-server - Timing:
> 156 - Cache hits for cache.main: 24, fault: 1, adds: 0, expirations: 0,
> success rate: 96%
>
>
> I really dont know what they mean ??? please help ...it is my second day and
> I am still not able to connect mysql
>
>
> --
> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Form-populate-with-data-from-sql-tp1678998p3016670.html
> Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>
>


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Re: Form populate with data from sql

Erik Bruchez
Administrator
In reply to this post by ManMohan Vyas
Form Runner has a persistence API, see:

http://wiki.orbeon.com/forms/doc/contributor-guide/form-builder-integration-notes#TOC-Persistence-API

You can write your own persistence layer implementation, or try to
write e.g. a relational view over the XML data (this is supported by
Oracle).

-Erik

On Thu, Oct 28, 2010 at 12:02 AM, ManMohan Vyas
<[hidden email]> wrote:

>
> me too was able to make it work. know can you please tell me where I can find
> documentation for inserting two data fields in RDBMS rather than xml
>
> thanks,
> ManMohan
> --
> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Form-populate-with-data-from-sql-tp1678998p3016698.html
> Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>
>


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws