[FORG0006] Unknown method:
Wednesday, 28 May 2014 · 11 messages · last reply 2 Jun 2014
EA
Erol Akarsu28 May 2014 03:23 #
I am getting this error when I call a java method from inside xquery script. I am using basex 7.8.2
Java constructor initialization (aBlob:new) went fine. Even I can call close method w/o any issue.
but when I call insertImage3 in xquery script, I am getting error
[FORG0006] Unknown method
I compiled the class into jar file and put it into libs folder of basex installation folder. I am using basexgui.bat to open basex gui that will load all jars in libs folder.
Is there anything I could not see here?
I appreciate your help
Stopped at D:/StepToDAR/DARImport.xq, 90/35:
[FORG0006] Unknown method: AddBlob.insertImage2(AddBlob, xs:integer, xs:string).
declare namespace aBlob ="com.ferguson.blobmanager.AddBlob";
let $bm := aBlob:new($connUrl,$username,$passwd)
let $r1 := aBlob:insertImage2($bm,xs:integer(3333),xs:string("eeeee"))
public class AddBlob {
public AddBlob (String connUrl,String username,String passwd) throws
SQLException
{
}
public void insertImage3( String fileName, int id) {
System.out.println ("test message here");
}
public void close () throws SQLException
{
connection.commit();
connection.close();
}
}ML
Marco Lettere28 May 2014 08:47 #
Hi Erol,
in the example you call insertImage2 from Xquery but the class declarea an insertImage3 method. Are you sure the issue is not this one?
Cheers,
Marco.
Quoted text · Erol Akarsu · 45 lines
On 05/28/2014 01:23 AM, Erol Akarsu wrote: > I am getting this error when I call a java method from inside xquery > script. I am using basex 7.8.2 > > Java constructor initialization (aBlob:new) went fine. Even I can call > close method w/o any issue. > > but when I call insertImage3 in xquery script, I am getting error > > [FORG0006] Unknown method > > I compiled the class into jar file and put it into libs folder of > basex installation folder. I am using basexgui.bat to open basex gui > that will load all jars in libs folder. > > Is there anything I could not see here? > > I appreciate your help > > > > Stopped at D:/StepToDAR/DARImport.xq, 90/35: > [FORG0006] Unknown method: AddBlob.insertImage2(AddBlob, xs:integer, > xs:string). > > declare namespace aBlob ="com.ferguson.blobmanager.AddBlob"; > > let $bm := aBlob:new($connUrl,$username,$passwd) > let $r1 := aBlob:insertImage2($bm,xs:integer(3333),xs:string("eeeee")) > > public class AddBlob { > public AddBlob (String connUrl,String username,String passwd) throws > SQLException > { > > } > public void insertImage3( String fileName, int id) { > System.out.println ("test message here"); > } > public void close () throws SQLException > { > connection.commit(); > connection.close(); > } > }
CG
Quoted text · Erol Akarsu · 1 line
> let $r1 := aBlob:insertImage2($bm,xs:integer(3333),xs:string("eeeee"))
You could try xs:int(3333).
CG
Christian Grün28 May 2014 10:14 #
Hi Erol (cc to the list),
Quoted text · Christian Grün · 4 lines
> That solved the issue! > Thanks for your help > > I like to know what is difference between xs:int and xs:integer ?
Values of type xs:integer may be bigger than Java integers. You'll need BigInteger to accept these values in a Java function.
Hope this helps,
Christian
EA
Marco
It is typo error in copying and pasting email
I am sure that java class has same method name called in xquery script
Sent from my iPhone
Quoted text · Marco Lettere · 48 lines
> On May 28, 2014, at 2:47 AM, Marco Lettere <marco.lettere at dedalus.eu> wrote: > > > Hi Erol, > in the example you call insertImage2 from Xquery but the class declarea an insertImage3 method. Are you sure the issue is not this one? > Cheers, > Marco. > >> On 05/28/2014 01:23 AM, Erol Akarsu wrote: >> I am getting this error when I call a java method from inside xquery script. I am using basex 7.8.2 >> >> Java constructor initialization (aBlob:new) went fine. Even I can call close method w/o any issue. >> >> but when I call insertImage3 in xquery script, I am getting error >> >> [FORG0006] Unknown method >> >> I compiled the class into jar file and put it into libs folder of basex installation folder. I am using basexgui.bat to open basex gui that will load all jars in libs folder. >> >> Is there anything I could not see here? >> >> I appreciate your help >> >> >> >> Stopped at D:/StepToDAR/DARImport.xq, 90/35: >> [FORG0006] Unknown method: AddBlob.insertImage2(AddBlob, xs:integer, xs:string). >> >> declare namespace aBlob ="com.ferguson.blobmanager.AddBlob"; >> >> let $bm := aBlob:new($connUrl,$username,$passwd) >> let $r1 := aBlob:insertImage2($bm,xs:integer(3333),xs:string("eeeee")) >> >> public class AddBlob { >> public AddBlob (String connUrl,String username,String passwd) throws SQLException >> { >> >> } >> public void insertImage3( String fileName, int id) { >> System.out.println ("test message here"); >> } >> public void close () throws SQLException >> { >> connection.commit(); >> connection.close(); >> } >> } >
CG
Quoted text · Erol Akarsu · 2 lines
> [BXSQ0001] An SQL exception occurred: 'ORA-01000: maximum open cursors > exceeded
Did you close your prepared statements via
sql:close [1]?
Best,
Christian
[1] http://docs.basex.org/wiki/SQL_Module#sql:closeCG
Quoted text · Erol Akarsu · 1 line
> sql:close is for connection to SQL server but prepared statement?
If I remember right, it's for both. Did you have a try?
EA
Christian,
That unknown method has gone, thanks for your help.
Now, I am getting this error after I called multiple
sql:execute-prepared calls
[BXSQ0001] An SQL exception occurred: 'ORA-01000: maximum open cursors exceeded
This error is called when we have exceed certain number of cursors in DBQuoted text · Christian Grün · 1 line
>A JDBC *ResultSet* is supported by a single *cursor* on the database. When
close() is called on the ResultSet, the cursor is released.
When basex made call for
sql:execute-prepared, does it close statement and resultset?
Erol Akarsu
On Wed, May 28, 2014 at 4:14 AM, Christian Grün
<christian.gruen at gmail.com>wrote:Quoted text · Christian Grün · 13 lines
> Hi Erol (cc to the list), > > > That solved the issue! > > Thanks for your help > > > > I like to know what is difference between xs:int and xs:integer ? > > Values of type xs:integer may be bigger than Java integers. You'll > need BigInteger to accept these values in a Java function. > > Hope this helps, > Christian >
EA
Christian,
I have to make multiple calls to prepared statement so that it is convenient to close SQL connection with
sql:close every time an statement is executed
sql:close is for connection to SQL server but prepared statement?
On Wed, May 28, 2014 at 3:47 PM, Christian Grün
<christian.gruen at gmail.com>wrote:Quoted text · Christian Grün · 10 lines
> > [BXSQ0001] An SQL exception occurred: 'ORA-01000: maximum open cursors > > exceeded > > Did you close your prepared statements via sql:close [1]? > > Best, > Christian > > [1] http://docs.basex.org/wiki/SQL_Module#sql:close >
EA
Christian,
I tried to close prepared statement and got this exception:
[BXSQ0002] No opened connection with id 1
It throws exception at line
let $clres := sql:close($prep)
let $prep := sql:prepare($conn,$sqlStmt)
let $params := <sql:parameters>
<sql:parameter type='string'>{$useType}</sql:parameter>
</sql:parameters>
let $result := sql:execute-prepared($prep, $params)
let $clres := sql:close($prep)Quoted text · Christian Grün · 6 lines
On Wed, May 28, 2014 at 3:51 PM, Christian Grün <christian.gruen at gmail.com> wrote: > > sql:close is for connection to SQL server but prepared statement? > > If I remember right, it's for both. Did you have a try? >
CG
Christian Grün2 Jun 2014 12:22 #
Thanks Erol,
I had time to revise the code. Please check out the latest snapshot [1], in which prepared statements can now be closed, too.
Christian
[1] http://files.basex.org/releases/latest/
Quoted text · Erol Akarsu · 30 lines
On Thu, May 29, 2014 at 3:03 PM, Erol Akarsu <eakarsu at gmail.com> wrote: > Christian, > > I tried to close prepared statement and got this exception: > > [BXSQ0002] No opened connection with id 1 > > It throws exception at line > > let $clres := sql:close($prep) > > > let $prep := sql:prepare($conn,$sqlStmt) > let $params := <sql:parameters> > <sql:parameter type='string'>{$useType}</sql:parameter> > </sql:parameters> > let $result := sql:execute-prepared($prep, $params) > let $clres := sql:close($prep) > > > > > On Wed, May 28, 2014 at 3:51 PM, Christian Grün <christian.gruen at gmail.com> > wrote: >> >> > sql:close is for connection to SQL server but prepared statement? >> >> If I remember right, it's for both. Did you have a try? > >
Written for BaseX 7.8. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery