Workshop 81 Database Controls & Informix
Hi !
Does anybody have a solution for the following problem ?
Problem: Using Workshop 81 and Informix JDBC driver from IBM (version 2.21), I'm
trying to build a database control to insert/retrieve large TEXT data into Informix
DB.
Q: Of which java data type should be the input/return value from my method in
the Workshop database control (I think it should be java.sql.Clob) Is this correct?
Q: If so, does IBM's Informix JDBC driver support operations like (rs.getClob,
etx on TEXT fileds) ?
Q: If not, can I build this kind of database control with IBM's JDBC driver at
all ?
Please forward possible solutions to my email ([email protected]).
Mux thnx,
Matevz
Since no one answered yet, I'll answer myself (some). I found a neat article and the code to go with it on dev2dev that handles paging through many rows by wrapping the <netui:repeater> tag. See:
http://dev2dev.bea.com/pub/a/2005/02/netui_repeater.html
Very cool. Thanks to the author, Gerald Nunn. I'd much rather find code already written than have to write it myself. ;-)
Similar Messages
-
Workshop 8.1 beta - problem with creating Database control
I am using Workshop 8.1 beta to create a webservice, which uses a database control
to query the Db, as simpel as it comes. However, I get the following exception
when I try to create the new DBControl:
java.lang.AssertionError
at workshop.pageflow.ui.dialogs.wizards.jbcx.db.util.DbControlWizardUtil.getTables(DbControlWizardUtil.java:268)
at workshop.pageflow.ui.dialogs.wizards.jbcx.db.util.DbControlWizardUtil.getTablesAndViews(DbControlWizardUtil.java:223)
at workshop.pageflow.ui.dialogs.wizards.jbcx.db.step.PickMethodsStep$4.run(PickMethodsStep.java:299)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:448)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:197)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:140)
at java.awt.Dialog.show(Dialog.java:538)
at com.bea.ide.ui.wizard.WizardDialog.show(WizardDialog.java:117)
at workshop.pageflow.ui.dialogs.wizards.jbcx.db.DbControlWizard.runWizard(DbControlWizard.java:96)
at workshop.pageflow.ui.dialogs.wizards.jbcx.db.FileNewDbControlWizardAction.doAction(FileNewDbControlWizardAction.java:58)
at workshop.pageflow.ui.dialogs.wizards.jbcx.db.DbControlWizardDocHandler.launchWizard(DbControlWizardDocHandler.java:87)
at workshop.pageflow.ui.dialogs.wizards.jbcx.db.DbControlWizardDocHandler.createNewFile(DbControlWizardDocHandler.java:72)
at workshop.shell.wizards.NewFileWizard.getDisplayURI(NewFileWizard.java:232)
at workshop.shell.actions.file.FileNewAction$1.run(FileNewAction.java:111)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:448)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:197)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:144)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:136)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:99)
What's interesting is that it works well for the default dbcontrols of cgDataSource
and cgSampleDataSource. The connection pool and the datasources were created successfully
in the server. Its the workshop that seems to be complaining.
Anyone face this problem?Sanjeev,
This newsgroup is for Workshop 7.0 issues, till WebLogic Platform 8.1 goes
GA.
Meanwhile, please post Workshop 8.1 beta issues on
weblogic.developer.interest.81beta.workshop newsgroup.
Regards,
Anurag
"Sanjeev Saha" <[email protected]> wrote in message
news:[email protected]...
>
I am using Workshop 8.1 beta to create a webservice, which uses a databasecontrol
to query the Db, as simpel as it comes. However, I get the followingexception
when I try to create the new DBControl:
java.lang.AssertionError
atworkshop.pageflow.ui.dialogs.wizards.jbcx.db.util.DbControlWizardUtil.getTab
les(DbControlWizardUtil.java:268)
atworkshop.pageflow.ui.dialogs.wizards.jbcx.db.util.DbControlWizardUtil.getTab
lesAndViews(DbControlWizardUtil.java:223)
atworkshop.pageflow.ui.dialogs.wizards.jbcx.db.step.PickMethodsStep$4.run(Pick
MethodsStep.java:299)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:448)
atjava.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.ja
va:197)
atjava.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java
:150)
atjava.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java
:140)
at java.awt.Dialog.show(Dialog.java:538)
at com.bea.ide.ui.wizard.WizardDialog.show(WizardDialog.java:117)
atworkshop.pageflow.ui.dialogs.wizards.jbcx.db.DbControlWizard.runWizard(DbCon
trolWizard.java:96)
atworkshop.pageflow.ui.dialogs.wizards.jbcx.db.FileNewDbControlWizardAction.do
Action(FileNewDbControlWizardAction.java:58)
atworkshop.pageflow.ui.dialogs.wizards.jbcx.db.DbControlWizardDocHandler.launc
hWizard(DbControlWizardDocHandler.java:87)
atworkshop.pageflow.ui.dialogs.wizards.jbcx.db.DbControlWizardDocHandler.creat
eNewFile(DbControlWizardDocHandler.java:72)
atworkshop.shell.wizards.NewFileWizard.getDisplayURI(NewFileWizard.java:232)
at workshop.shell.actions.file.FileNewAction$1.run(FileNewAction.java:111)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:448)
atjava.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.ja
va:197)
atjava.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java
:150)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:144)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:136)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:99)
What's interesting is that it works well for the default dbcontrols ofcgDataSource
and cgSampleDataSource. The connection pool and the datasources werecreated successfully
in the server. Its the workshop that seems to be complaining.
Anyone face this problem? -
Database control hangs in Workshop Tutorial !!!
Hi,
I am using WLS 7.0.1.0/SP1 ( latest version ) with Workshop included, on Windows
XP Prof. In Workshop Tutorial, Step 3, the test hangs at the execution of
Applicant dbApplicant = bankruptciesDB.checkForBankruptcies(taxID);
I am asking if it is a known problem? There may be several reasons for this and
it is too expensive to investigate all of them:
1. Tutorial text misses a fragment describing special configuration for the Database
control
2. Tutorial is correct but default ( installation ) configuration of Database
control has bug(s)
3. A helper class, implementing BankruptciesDatabaseControl interface, is missed.
4. Implementation of Database control is buggy. What the magic happens when I
“SELECT TAXID, FIRSTNAME, LASTNAME, CURRENTLYBANKRUPT FROM BANKRUPTCIES WHERE
TAXID={taxID}”, i.e. only a sub-set of “Applicant” attributes in the query, and
how Database control ( using my interface method public Investigate.Applicant
checkForBankruptcies(String taxID) ) knows which database table field to map to
which Applicant” attribute ? [I suppose, creation of “Applicant” class is independent
from the database schema, isn’t it ?]
Thank you,
- MichaelSure, I will send you the dump. Please, provide me with your e-mail.
As of column names, don’t you find it error-prone approach where a developer has
to “find” the names and type them into the code ? Since you are already deal with
a db adapter/controller, I suggest, the adapter has to read a db schema, gets
the column names and data types. In other words, I would expect in this case the
same functionality as provided by, e.g., TogetherSoft’s Control Center. It creates
Entity Beans out of the db schema and only then allows you to manipulate them.
Thank you and wait for your e-mail.
- Michael
"Anurag Pareek" <[email protected]> wrote:
Michael,
The names of the elements in the 'Applicant' class should match one-on-one
with the database column names in the corresponding table.
I guess you are using the default Pointbase database. Can you check whether
you were able to create successful connections to the Pointbase database
during server startup?
If the server is hanging at the statement you have mentioned, can you
take a
thread dump by using Ctrl->Break and email it to me.
Thanks,
Anurag
"Michael Poulin" <[email protected]> wrote in message
news:[email protected]...
Hi,
I am using WLS 7.0.1.0/SP1 ( latest version ) with Workshop included,on
Windows
XP Prof. In Workshop Tutorial, Step 3, the test hangs at the executionof
Applicant dbApplicant = bankruptciesDB.checkForBankruptcies(taxID);
I am asking if it is a known problem? There may be several reasonsfor
this and
it is too expensive to investigate all of them:
1. Tutorial text misses a fragment describing special configurationfor
the Database
control
2. Tutorial is correct but default ( installation ) configuration ofDatabase
control has bug(s)
3. A helper class, implementing BankruptciesDatabaseControl interface,is
missed.
4. Implementation of Database control is buggy. What the magic happenswhen I
"SELECT TAXID, FIRSTNAME, LASTNAME, CURRENTLYBANKRUPT FROM BANKRUPTCIESWHERE
TAXID={taxID}", i.e. only a sub-set of "Applicant" attributes in thequery, and
how Database control ( using my interface method publicInvestigate.Applicant
checkForBankruptcies(String taxID) ) knows which database table fieldto
map to
which Applicant" attribute ? [I suppose, creation of "Applicant" class
is>independent>> from the database schema, isn't it ?
Thank you,
- Michael -
We are using workshop as our development tool for a new project. Are there any guidelines concerning when to use a Database Control vs an EJB for database updates? How do Database Controls differ from entity EJB's in terms of transaction management?
Henrik--
In general, the Workshop Database Control executes the SQL that you
see in each method's annotations. So, you can do a batch update in the
context of a single transaction if you wrap a database control in a
custom control which calls database control methods many times.
Relative to your JPF, this would look like a batch update.
If you pass RowSet objects to Database Control methods, the RowSet
will generate update / insert / delete SQL statements to push changes
made in the RowSet into the database.
Hope that helps...
Eddie
Henrik Fredholm wrote:
I want to insert many rows into a database. Does the Workshop Database Control
or RowSet Control support batch update? How is it done? -
Using "in" clause in the query in Database control
Hi,
I have a database control and need to fire an update query to update a set of rows based on a list of values as input
Like below
update tablename
set column1="value1"
where column2 in (.......)
I need to pass a list of values for this query where column2 is a NUMBER field in Oracle DB.
can anyone help me how to go about passing this list of values?
Help is appreciated.
ThanksYou may build the comma-separated list in Java and use " {sql: ...} " in your query: http://e-docs.bea.com/workshop/docs81/doc/en/workshop/java-class/com/bea/control/DatabaseControl.html (sorry, I can't find the documentation for WLI 9.2).
-
Database control support for "IN" clause
Does anyone know if the database control supports an 'IN' clause construct, e.g.,
SELECT name FROM mytable WHERE id IN ( {values} )
where values would be passed in as a variable length array of Strings or Integers?
Thanks,
DCI forgot to paste in the link to the documenation. Here it is
http://edocs.bea.com/workshop/docs81/doc/en/workshop/guide/controls/database/conParameterSubstitutionInJwsSqlStatements.html
"John Rohrlich" <[email protected]> wrote in message
news:[email protected]..
Dave,
I think you will need to build the sql and pass it to the control method.
For example
String matchMe = "('Bill Walton', 'Fred Williams')";
Customer[] customers = weblogicCustomer.getCustomersIn(matchMe);
* @jc:sql statement= "SELECT name from weblogic.customer where namein
{sql: matchMe}"
public Customer[] getCustomersIn(String matchMe);
Here is a link to a doc explaining parameter substitution for jc:sql
statements
- john
"Dave Chappelle" <[email protected]> wrote in message
news:[email protected]..
Does anyone know if the database control supports an 'IN' clauseconstruct, e.g.,
SELECT name FROM mytable WHERE id IN ( {values} )
where values would be passed in as a variable length array of Strings orIntegers?
Thanks,
DC -
How to use database control to execute sql queries which change at run time
Hi all,
I need to execute sql queries using database controls , where the sql changes
at run time
based on some condition. For eg. based on the condition , I can add some where
condition.
Eg. sql = select id,name from emp where id = ?.
based on some condition , I can add the following condition .
and location = ?.
Have anybody had this kind of situation.
thanks,
sathishFrom the perspective of the database control, you've got two options:
1) use the sql: keyword to do parameter substitution. Your observation
about {foo} style sbustitution is correct -- this is like using a
PreparedStatement. To do substitution into the rest of the SQL
statement, you can use the {sql: foo} substitution syntax which was
undocumented in GA but is documented in SP2. Then, you can build up
the filter clause String yourself in a JPF / JWS / etc and pass it into
the DB control.
For example:
* @jc:sql statement="select * from product {sql: filter}"
public Product[] getProducts(String filter) throws SQLException;
This will substitute the String filter directly into the statement that
is executed. The filter string could be null, "", "WHERE ID=12345", etc.
2) you can use the DatabaseFilter object to build up a set of custom
sorts and filters and pass that object into the DB control method.
There have been other posts here about doing this, look for the subject
"DatabaseFilter example".
Hope that helps...
Eddie
Dan Hayes wrote:
"Sathish Venkatesan" <[email protected]> wrote:
Hi Maruthi,
The parameter substituion , I guess is used like setting the values for
prepared
statements.
What I'm trying to do , is change the sql at run time based on some condition.
For example ,
consider the following query :
select col1,col2 from table t where t.col3 > 1
At run time , based on some condition , I need to add one more and condition.
i.e. select col1,col2 from table t where t.col3 > 1 and t.col4 < 10.
This MAY not address your issue but if you are trying to add "optional" parameters
you may try including ALL the possible parameters in the SQL but send in null
for those params that you don't want to filter on in any particular case. Then,
if you word your query
as follows:
select col1, col2 from table t where t.col3 > 1 and (t.col4 = {col4param} or
{col4param} is null) and (t.col5 = {col5param} or {col5param} is null) ...
you will get "dynamic" filters. In other words, col4 and col5 will only be
filtered if you send in non-null parameters for those arguments.
I have not tried this in a WL Workshop database control but I've used
this strategy dozens of times in stored procedures or jdbc prepared statements.
Good luck,
Dan -
Woes wiring up an ejb to use a database control
first my question & then background:
how do i wire up an ejb to use a database control jcx object so that the dbcontrol is instantiated at runtime?
here's the scene:
i created a java page flow from a database control & this works correctly, but i also need to be able to expose some of the functionality to another deployed application. this application, incidentally is not a workshop application; but rather is a hand-coded war.
the first application (a workshop app) renders forms that use a database control to persist the data. it only uses one table & therefore, there is only one pojo. as i mentioned, this resides in web project & works correctly. i abstracted my dbcontrol & my pojo to a separate java controls project & built this as a library. the jpf still has no problems seeing the dbcontrol.
there is a second application (a non workshop app) that needs to be able to use a method provided by the dbcontrol. i created an ejb in a third project in the first application that makes the call to dbcontrol in the exact same way that the jpf did. but i am finding, however, that the dbcontrol is null whenever the ejb makes the call to it's method.
here's the more detailed design:
i started with a database control. i mapped to my datasource, wrote out the sql for the methods i wanted & generated the pageflow from this. i rewrote the pageflow/jsps to suit my needs & everything just works. i did notice at the time that i generated the page flow that the dbcontrol was never instantiated. here is a snippet of the jpf:
<pre>
public class SiteAlertMessageManagementController extends PageFlowController {
* This is the control used to generate this pageflow
* @common:control
private SiteAlertMessageDBControl dbControl;
public Forward getCurrentMessage() {
SiteAlertMessage currentMessage = dbControl.getCurrentMessage();
</pre>
because SiteAlertMessageDBControl is an interface, i assumed that the '@common:control' annotation told weblogic what it needed to know in order to instantiate a runtime class of time SiteAlertMessageDBControl. because it just worked, i never questioned this.
with the form read/write functionality complete, i assumed i could quickly wrap an ejb around the dbcontrol method & be done with it. i soon realized that i could not create an ejb inside a web project & that an ejb project would not have classpath visibility to my dbcontrol & pojo, so i put the dbcontrol & the pojo into a java control project & made a library out of this. i double checked that the web project could see the classes in the library & they could.
so i created a separate ejb project that also could now see the classes in the library. i thought i was in the home stretch. i now have these projects in my first application:
administrationControls, administrationWeb, & administrationEjb. i moved the administrationControls.jar & the administrationEjb.jar over to the WEB-INF/lib directory of my (remember: non-workshop) war & wired up the code to pull the bean off jndi tree to make the rmi call. but it didn't work. so i backtracked & created a new jsp back in my workshop project that would make the same rmi call so that i could use the debugger. with this as the background, here is my specific problem.
what i noticed is that the ejb code itself works correctly. i guess i should show it as well.
<pre>
public class SiteAlertMessagesAPI extends GenericSessionBean implements SessionBean {
* This is the control used to generate this pageflow
* @common:control
private SiteAlertMessageDBControl dbControl;
public void ejbCreate() {
// Your code here
* @ejbgen:remote-method
public SiteAlertMessage getCurrentMessage() throws Exception {
SiteAlertMessage message = null;
try {
// dbControl is null here
message = dbControl.getCurrentMessage();
catch (Exception e) {
e.printStackTrace();
return message;
</pre>
the problem is that my dbControl object is null. what i did was cut & paste the code from the jpf over to my bean. like i stated earlier, i assumed that the annotation would tell weblogic to instantiate an instance. this was obviously not the case. incidentally, i rewrote my ejbCreate() method like this:
<pre>
public void ejbCreate() {
// Your code here
dbControl = new SiteAlertMessageDBControl();
</pre>
but workshop gives me a "error: this type is abstract and thus cannot be instantiated" warning.
my question is: how do i wire up an ejb to use a database control jcx object so that the dbcontrol is instantiated at runtime?
any light you could shed on this would be most appreciated. thanks,
dougHi,
unfortunatly, it's not possible to use a control outside a control or a
web service...
Emmanuel
douglas thomas a ?crit :
first my question & then background:
how do i wire up an ejb to use a database control jcx object so that the dbcontrol is instantiated at runtime?
here's the scene:
i created a java page flow from a database control & this works correctly, but i also need to be able to expose some of the functionality to another deployed application. this application, incidentally is not a workshop application; but rather is a hand-coded war.
the first application (a workshop app) renders forms that use a database control to persist the data. it only uses one table & therefore, there is only one pojo. as i mentioned, this resides in web project & works correctly. i abstracted my dbcontrol & my pojo to a separate java controls project & built this as a library. the jpf still has no problems seeing the dbcontrol.
there is a second application (a non workshop app) that needs to be able to use a method provided by the dbcontrol. i created an ejb in a third project in the first application that makes the call to dbcontrol in the exact same way that the jpf did. but i am finding, however, that the dbcontrol is null whenever the ejb makes the call to it's method.
here's the more detailed design:
i started with a database control. i mapped to my datasource, wrote out the sql for the methods i wanted & generated the pageflow from this. i rewrote the pageflow/jsps to suit my needs & everything just works. i did notice at the time that i generated the page flow that the dbcontrol was never instantiated. here is a snippet of the jpf:
<pre>
public class SiteAlertMessageManagementController extends PageFlowController {
* This is the control used to generate this pageflow
* @common:control
private SiteAlertMessageDBControl dbControl;
public Forward getCurrentMessage() {
SiteAlertMessage currentMessage = dbControl.getCurrentMessage();
</pre>
because SiteAlertMessageDBControl is an interface, i assumed that the '@common:control' annotation told weblogic what it needed to know in order to instantiate a runtime class of time SiteAlertMessageDBControl. because it just worked, i never questioned this.
with the form read/write functionality complete, i assumed i could quickly wrap an ejb around the dbcontrol method & be done with it. i soon realized that i could not create an ejb inside a web project & that an ejb project would not have classpath visibility to my dbcontrol & pojo, so i put the dbcontrol & the pojo into a java control project & made a library out of this. i double checked that the web project could see the classes in the library & they could.
so i created a separate ejb project that also could now see the classes in the library. i thought i was in the home stretch. i now have these projects in my first application:
administrationControls, administrationWeb, & administrationEjb. i moved the administrationControls.jar & the administrationEjb.jar over to the WEB-INF/lib directory of my (remember: non-workshop) war & wired up the code to pull the bean off jndi tree to make the rmi call. but it didn't work. so i backtracked & created a new jsp back in my workshop project that would make the same rmi call so that i could use the debugger. with this as the background, here is my specific problem.
what i noticed is that the ejb code itself works correctly. i guess i should show it as well.
<pre>
public class SiteAlertMessagesAPI extends GenericSessionBean implements SessionBean {
* This is the control used to generate this pageflow
* @common:control
private SiteAlertMessageDBControl dbControl;
public void ejbCreate() {
// Your code here
* @ejbgen:remote-method
public SiteAlertMessage getCurrentMessage() throws Exception {
SiteAlertMessage message = null;
try {
// dbControl is null here
message = dbControl.getCurrentMessage();
catch (Exception e) {
e.printStackTrace();
return message;
</pre>
the problem is that my dbControl object is null. what i did was cut & paste the code from the jpf over to my bean. like i stated earlier, i assumed that the annotation would tell weblogic to instantiate an instance. this was obviously not the case. incidentally, i rewrote my ejbCreate() method like this:
<pre>
public void ejbCreate() {
// Your code here
dbControl = new SiteAlertMessageDBControl();
</pre>
but workshop gives me a "error: this type is abstract and thus cannot be instantiated" warning.
my question is: how do i wire up an ejb to use a database control jcx object so that the dbcontrol is instantiated at runtime?
any light you could shed on this would be most appreciated. thanks,
doug -
IS java database control (jcx) sinchronized?
Hi,
I use workshop for create a web application.
I have make a java control database and I have import this control in my page flow.
So the database control result in controller class as a class intance variable .This class variable is used for all client request, there are synchronization problem?
In servlet analog case certainly , a class variable would have to be syncrhonized, and here ?
Thanks !Workshop Database control makes synchronous call to shuffle data to and from data source. Is this the question? Or, do you mean thread-safety?
-
Hi,
I'm using Weblogic Workshop 7.0.1.0.0829.0, developing a small service to retrive data from SQL server 2000. I created SQL connection pool to SQL server and TxDataSource using this pool. I could able to see the datasources from database control wizard in workshop. I'm using conversation for the webservices. whenever I execute the webservice, I get the following error :
weblogic.jws.control.ControlException: Unable to obtain connection to database[Connection has already been created in this tx context for pool named cgPool. Illegal attempt to create connection from another pool: sqlPool] at weblogic.knex.control.DatabaseControlImpl.acquireResources(DatabaseControlImpl.java:261) at weblogic.knex.context.JwsInternalContext.acquireResources(JwsInternalContext.java:220) at weblogic.knex.control.ControlHandler.invoke(ControlHandler.java:260) at WebServCntrlControl.LoadUser(WebServCntrlControl.ctrl) at Login.Verify(Login.jws:48)
How to resolve it?Muthu,
The exception that you are seeing is due of the fact that you are using two
different TX datasources within the same transaction context.
Workshop needs the following
1. an XA connection pool and data source for the conversational state
2. another XA connection pool and data source for the DB control which is
used in the conversational method,
3. a non-XA connection pool to which the JMSJDBCStore connects.
Reconfiguring your application and the workshop runtime to use a single non
transactional datasource-cgDataSource, removes the need for TX Data Sources
and XA Drivers.
The other option is to
Upgrade to Service Pack 2 and reconfigure the connection pools to use the XA
driver.
Hope this helps.
Thanks
Raj Alagumalai
WebLogic Workshop Support
"Muthu" <[email protected]> wrote in message
news:3efbc1d1$[email protected]..
Hi,
I'm using Weblogic Workshop 7.0.1.0.0829.0, developing a small serviceto retrive data from SQL server 2000. I created SQL connection pool to SQL
server and TxDataSource using this pool. I could able to see the datasources
from database control wizard in workshop. I'm using conversation for the
webservices. whenever I execute the webservice, I get the following error :
>
weblogic.jws.control.ControlException: Unable to obtain connection todatabase[Connection has already been created in this tx context for pool
named cgPool. Illegal attempt to create connection from another pool:
sqlPool] at
weblogic.knex.control.DatabaseControlImpl.acquireResources(DatabaseControlIm
pl.java:261) at
weblogic.knex.context.JwsInternalContext.acquireResources(JwsInternalContext
.java:220) at
weblogic.knex.control.ControlHandler.invoke(ControlHandler.java:260) at
WebServCntrlControl.LoadUser(WebServCntrlControl.ctrl) at
Login.Verify(Login.jws:48)
>
How to resolve it? -
Problem with database control returning multiple rows as Array using Oracle
Has anybody using Oracle gotten a Database control that
returns multiple rows to work returning an array?
The only way I can seem to return multiple rows is by returning
a RowSet. Returning an array gives me a NullPointerException
(when called within a pageFlow). When calling a database control
that returns an array from a web service I get a
"java.sql.SQLException: ResultSet has no more data." error.
The samples using the pointbase database seem to work, but when I
converted the CustomerDBClient web service to use Oracle, it starts
failing on calling the database control that returns an array
with: "java.sql.SQLException: ResultSet has no more data."
Has anybody gotten this to work using Oracle?
I'm also having some problem returning an Iterator. It seems
to work when called from a web service, but returns nothing
if called from a page flow.
I'm using Oracle 8.1.7 and WebLogic 8.1.
EricDo you need a particular service pack installed to return an array of custom object?
I am getting a ResultSet contained no data error when trying.
Thanks,
-Thomas
"Robin Karlin" <[email protected]> wrote:
>
Eddie O'Neil <[email protected]> wrote:
All--
Unfortunately, returning an Iterator to a JPF (or JSP) from a
database control is broken in WLW 8.1, though it will work inside of
a
JWS or JCS.
There shouldn't be a problem with returning an array of objects out
of Oracle to the JPF, and if you need an Iterator specifically, youcan
wrap the array in an Iterator implementation.
Sorry for the inconvenience.
Eddie
Lenny wrote:
I have gotten it to work on Oracle using Array:)
However, I haven't gotten it to work on Oracle using Iterator:( Itis so
simple, but doesn't work:(
"Eric Dokken" <[email protected]> wrote in message
news:[email protected]...
Has anybody using Oracle gotten a Database control that
returns multiple rows to work returning an array?
The only way I can seem to return multiple rows is by returning
a RowSet. Returning an array gives me a NullPointerException
(when called within a pageFlow). When calling a database control
that returns an array from a web service I get a
"java.sql.SQLException: ResultSet has no more data." error.
The samples using the pointbase database seem to work, but when I
converted the CustomerDBClient web service to use Oracle, it starts
failing on calling the database control that returns an array
with: "java.sql.SQLException: ResultSet has no more data."
Has anybody gotten this to work using Oracle?
I'm also having some problem returning an Iterator. It seems
to work when called from a web service, but returns nothing
if called from a page flow.
I'm using Oracle 8.1.7 and WebLogic 8.1.
Eric
I get the same error that Eric reported when trying to return an Array
of objects.
It is really frustrating because I can't use much of the built-in control
logic
that WLW provides. All I did was create a data pool for Oracle and a
datasource.
I modified the sample app in C:\bea81\weblogic81\samples\workshop\SamplesApp\WebApp\callJavaControl
to point to that datasource and I get the error that Eric reports above.
Can
anyone help me out????
Thanks,
Robin -
Database controls returning large datasets
In reading the Workshop help (Working with Java Controls -> Using Built-In Controls -> Database Control -> Designing a Database Control) it says one technique you should use is to return an Iterator:
"The Iterator wraps a java.sql.ResultSet object that accesses the database efficiently. The Iterator and ResultSet objects transparently make occasional requests to the database to obtain more data as needed as you iterate through the resultset. Using this technique, you may enable processing of resultsets that are larger than the available memory."
"However, note that ResultSets and Iterator types cannot be returned directly to classes in the web-tier (web services and page flows reside in the web-tier). This is because ResultsSet and Iterators will always be closed by the time they reach the web tier. As a workaround for this limitation, you should return custom array types to the web tier (such as Customer[])."
OK. So, what do I do? Have the DB control return an iterator, but have a custom control in front of it for the page flow that calls it and returns a Customer array? Does the custom control have to "manage" the iteration (i.e. return an array of 10 customers, when you ask for more iterate over the next 10 and return it, etc.)?
Thanks.Since no one answered yet, I'll answer myself (some). I found a neat article and the code to go with it on dev2dev that handles paging through many rows by wrapping the <netui:repeater> tag. See:
http://dev2dev.bea.com/pub/a/2005/02/netui_repeater.html
Very cool. Thanks to the author, Gerald Nunn. I'd much rather find code already written than have to write it myself. ;-) -
Hi, there
I would like to gather some options about in which case that we should use
database control in workshop to do DB access and in which case we should use
EntityBean. It seems that database control is called within a transaction
context --- if a custom control mades multiple calls to the database
control, all calls are within one single transaction (right?). So what is
the guideline we should have to choose one instead of the other?
Thanks
Coco"coco" <[email protected]> wrote in message
news:[email protected]..
I would like to gather some options about in which case that we should use
database control in workshop to do DB access and in which case we shoulduse
EntityBean. It seems that database control is called within a transaction
context --- if a custom control mades multiple calls to the database
control, all calls are within one single transaction (right?). So what is
the guideline we should have to choose one instead of the other?Generally speaking database controls are a good solution on a smaller
project as they enable you to put together a solution pretty quickly. They
do however have fairly limited features though, for example no automatic
management of keys or relationships between objects. On larger projects I
would recommend using a more full featured object persistence layer such as
entity beans or hibernate.
Gerald -
I'm try to use the @jc:log annotation with my database controls, but I'm not having any luck.
Has anyone had success using this annotation? If so, can you tell me what I'm doing wrong?
When I included the @jc:log annotation, Workshop complained that the attribute category was not allowed. Here is what I tried:
* @jc:connection data-source-jndi-name="cgDataSource"
* @jc:log category="mycategory"
public interface MyDbControl
extends DatabaseControl, ControlExtension
thanks in advance,
ErikRon--
There are some examples of how to do stored procedures with the DatabaseControl here:
http://edocs.bea.com/workshop/docs81/doc/en/workshop/guide/controls/database/conStoredProcedures.html
One issue with SPs and ResultSets is that the ResultSets can't be returned to JPFs because of
limiations in the DatabaseControl lifecycle in 8.1. So, you can process the ResultSets in a web
service or custom control if you need to return the data to a page flow.
Hope that helps...
Eddie
Ron wrote:
Hi,
I am developing database controls that use Sybase stored procedures.
My stored procedures mostly return result sets.
How would I specify the use of both a stored procedure and the processing
of the result sets returned? -
Hi,
I have a webservice and in the same server(weblogic 9.2) a data source(cgAppSource) is configured. the database control is not instanciating properly, it is always remains null despite the calling of webservice. I am getting NullPointerException in the webservice. First time I am using annotation to execute a SQL query. It is urgent.can anyone please help me. what code change I have to do in both the files.
SampleDatabaseControl.java -
package control;
import java.sql.SQLException;
import org.apache.beehive.controls.api.bean.ControlBean;
import org.apache.beehive.controls.system.jdbc.JdbcControl;
@org.apache.beehive.controls.api.bean.ControlExtension
@JdbcControl.ConnectionDataSource(jndiName="java:comp/env/jdbc/cgAppSource")
public interface SampleDatabaseControl extends JdbcControl ,ControlBean{
static final long serialVersionUID = 1L;
@JdbcControl.SQL(statement="SELECT SYSDATE FROM DUAL")
public String returnSysDate() throws SQLException;
The webservice : ControlWebservice.java
package service;
import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.jws.soap.SOAPBinding;
import weblogic.jws.WLHttpTransport;
import org.apache.beehive.controls.api.bean.Control;
import control.SampleDatabaseControl;
@WebService(name="ControlWebservicePortType", serviceName="ControlWebservice",
targetNamespace="localhost")
@SOAPBinding(style=SOAPBinding.Style.DOCUMENT,
use=SOAPBinding.Use.LITERAL,
parameterStyle=SOAPBinding.ParameterStyle.WRAPPED)
@WLHttpTransport(contextPath="ControlWebserviceProj", serviceUri="ControlWebservice",
portName="ControlWebservicePort")
public class ControlWebservice {
@Control
private SampleDatabaseControl SampleDatabaseControl;
@WebMethod()
public String returnDate()
String returnValue = null;
try{
returnValue = "This message sent date :" + SampleDatabaseControl.returnSysDate(); // getting null pointer Exception here.
catch(Exception e)
e.printStackTrace();
return returnValue;
}Hi james,
In that link it says to 'Create a Beehive-enabled Server Domain' in which On the second page(named <strong>Select Domain Source</strong>), I need to place a check in the <strong>Apache Beehive</strong> checkbox . But in my machine when I follow the steps I dont find any such checkbox in the (named <strong>Select Domain Source</strong>) page. Is this the problem? I can see only two check boxes. The page looks like......
Generate a domain configured automatically to support the following product. // radio select
Weblogic Server (Required) //check box
Workshop for Weblogic Platform // check box
Base this domain on an existing domain. //radio select
Templatelocation .... // a browse option
Do I need to do some other configuration to make beehive check box active in the page? All the beehive jars are present in the instalation. And as far as I remember I did the full instalation of Weblogic 9.2 after downloading from the bea site. and I am giving the beehive related jar
<p>
beehive-controls.jar,beehive-jdbc-control.jar,weblogic-jdbc-control.jar in the lib folder wnder WEB-INF and deploying.
</p>
Maybe you are looking for
-
How do I select multiple images in pages
In Apple works drawing it was simple to select several images by click and dragging a box over some images and they were all selected at the same time. Now I only get a pointer arrow when over an object at all other times I get an I bar. Am I missing
-
Cannot download a .jnlp file
I'm encountering an error while downloading a .jnlp file. Everytime I try to download a .jnlp file it just shows me the source code for the jnlp.
-
How do I find my pictures in icloud back up that have been deleted from my iphone? I lost them after updating my software on my phone.
-
From PSE (PC) to iPhoto - several questions
I've looked for answers for these questions, which are kind of interconnected, but not found what I'm after. Have also tried a few things with smaller folders of pictures. Hope someone can help. _Copy items into library?_ I want to use iPhoto organis
-
I just inherited a ibook g4 and wonder how to keep it stable?
having trouble with stability of the ibook G4 while doing youtube. It did run some of the videos on youtube but a little disjuncted. Sound and video sync not good. Just wondering if there is an optimal installation of either safari, firefox or oth