Article View: borland.public.jbuilder.database
Article #211Re: ProcedureDataSet and resultSetToDataSet doesn't work
From: Christa Schneider
Date: Tue, 27 Jun 2006 08:19
Date: Tue, 27 Jun 2006 08:19
173 lines
7162 bytes
7162 bytes
Thank you very much, I will try it.
I think it is not the best way, but I know no other.
I have a problem with setProcedure too!
I haven't found any example that works.
Is there a way to run this?
Database db = new Database();
ProcedureDataSet pr = new ProcedureDataSet();
db.setAutoCommit(false);
row.addColumn("ref", Variant.OBJECT, ParameterType.OUT);
row.getColumn("ref").setSqlType(Types.OTHER);
row.addColumn("krit", Variant.STRING, ParameterType.IN);
row.setString("krit", "where k_kd_id=15");
// pr.addColumn("ref",Variant.OBJECT);
// pr.addColumn("krit",Variant.STRING);
pr.setProcedure(new com.borland.dx.sql.dataset.ProcedureDescriptor(db,
"{:ref = call func_tn_im_kurs(:krit) }", row, true,
Load.ALL));
//pr.open(); // Exeption: close the DataSet first.
pr.executeQuery(); //GET THE Exception
while (pr.next()) {
System.out.println(pr.getString(3));
}
See com.borland.dx.dataset.DataSetException error code: BASE+47
com.borland.dx.dataset.DataSetException: Chain of 2 or more Exceptions
occurred
at com.borland.dx.dataset.DataSetException.a(Unknown Source)
at com.borland.dx.dataset.DataSetException.throwExceptionChain(Unknown
Source)
at com.borland.dx.sql.dataset.JdbcProvider.c(Unknown Source)
at com.borland.dx.sql.dataset.JdbcProvider.provideData(Unknown Source)
at com.borland.dx.dataset.StorageDataSet.refresh(Unknown Source)
at com.borland.dx.sql.dataset.ProcedureDataSet.refresh(Unknown Source)
at com.borland.dx.sql.dataset.ProcedureDataSet.executeQuery(Unknown Source)
at tools.StoredTest.jbInit(StoredTest.java:68)
at tools.StoredTest.<init>(StoredTest.java:20)
at tools.StoredTest.main(StoredTest.java:29)
Chained exception:
org.postgresql.util.PSQLException: Connection is closed. Operation is not
permitted.
at
org.postgresql.jdbc1.AbstractJdbc1ResultSet.next(AbstractJdbc1ResultSet.java:138)
at com.borland.dx.sql.dataset.JdbcProvider.a(Unknown Source)
at com.borland.dx.sql.dataset.JdbcProvider.c(Unknown Source)
at com.borland.dx.sql.dataset.JdbcProvider.provideData(Unknown Source)
at com.borland.dx.dataset.StorageDataSet.refresh(Unknown Source)
at com.borland.dx.sql.dataset.ProcedureDataSet.refresh(Unknown Source)
at com.borland.dx.sql.dataset.ProcedureDataSet.executeQuery(Unknown Source)
at tools.StoredTest.jbInit(StoredTest.java:68)
at tools.StoredTest.<init>(StoredTest.java:20)
at tools.StoredTest.main(StoredTest.java:29)
Thanks
Christa
"John Moore (TeamB)" <jbm@microps.com> schrieb im Newsbeitrag
news:44a023aa$1@newsgroups.borland.com...
> Christa Schneider wrote:
>> Here the exeption:
>> java.lang.NullPointerException
>> at
>> org.postgresql.jdbc2.AbstractJdbc2ResultSetMetaData.getColumnCount(AbstractJdbc2ResultSetMetaData.java:34)
>> at com.borland.dx.sql.dataset.RuntimeMetaData.a(Unknown Source)
>> at com.borland.dx.sql.dataset.JdbcProvider.a(Unknown Source)
>> at com.borland.dx.sql.dataset.Database.resultSetToDataSet(Unknown
>> Source)
>> at tools.StoredTest.jbInit(StoredTest.java:73)
>> at tools.StoredTest.<init>(StoredTest.java:20)
>> at tools.StoredTest.main(StoredTest.java:29)
>>
>
>
> Ok.. the problem is that your resultset has no metadata attached.. (it's
> null) Notice "ResultSetMetaData.getColumnCount(...)"
>
> I have never used this syntax.. (row.getObject(..)) so I'm not familiar
> with what it returns. I would research this first.. It could be a jdbc
> implementation issue.. (contact Postgresql folks.. maybe..??)
>
> John...
>
>
>> This is the code:
>> ResultSet rs1 = (ResultSet) row.getObject("ref");
>> StorageDataSet pd=new StorageDataSet();
>> db.resultSetToDataSet(pd,rs1);
>> while (pd.next()) {
>> System.out.println(pd.getString(3));
>> }
>> /*
>> //this works
>> while(rs1.next()) {
>> System.out.println(rs1.getString(3));
>> }
>> */
>> Thanks
>> Christa
>>
>> "John Moore (TeamB)" <jbm@microps.com> schrieb im Newsbeitrag
>> news:449d80af$1@newsgroups.borland.com...
>>> It should...
>>>
>>> What errors are you getting.. (stacktrace.. please...)
>>>
>>> John...
>>>
>>>
>>>
>>>
>>> Christa Schneider wrote:
>>>> Thank you for the answer, but it is only a type mistake.
>>>>
>>>> THIS DOESN' T WORK, why?
>>>> StorageDataSet pd=new StorageDataSet();
>>>> db.resultSetToDataSet(pd,rs1); //or pd = db.resultSetToDataSet(rs1);
>>>>
>>>> Thanks
>>>> Christa Schneider
>>>>
>>>> "John Moore (TeamB)" <jbm@microps.com> schrieb im Newsbeitrag
>>>> news:449c3030$1@newsgroups.borland.com...
>>>>> Christa Schneider wrote:
>>>>>
>>>>>> StorageDataSet pd=new StorageDataSet();
>>>>>> db.resultSetToDataSet(ds,rs1); //or pd = db.resultSetToDataSet(rs1);
>>>>> Try...
>>>>>
>>>>> StorageDataSet pd=new StorageDataSet();
>>>>> db.resultSetToDataSet(pd,rs1);
>>>>>
>>>>>
>>>>> --
>>>>> =============================================
>>>>> TeamB are volunteer helpers. Please DO NOT REPLY VIA EMAIL!
>>>>> Post all questions and replies to this newsgroup ONLY
>>>>> For papers on DataExpress, Applets, JSP, and Web Development go to:
>>>>> http://www.microps.com/mps/paperFAQ.html
>>>>> ====================================================
>>>>>
>>>>
>>>>
>>>
>>> --
>>> =============================================
>>> TeamB are volunteer helpers. Please DO NOT REPLY VIA EMAIL!
>>> Post all questions and replies to this newsgroup ONLY
>>> For papers on DataExpress, Applets, JSP, and Web Development go to:
>>> http://www.microps.com/mps/paperFAQ.html
>>> ====================================================
>>>
>>
>>
>>
>
>
> --
> =============================================
> TeamB are volunteer helpers. Please DO NOT REPLY VIA EMAIL!
> Post all questions and replies to this newsgroup ONLY
> For papers on DataExpress, Applets, JSP, and Web Development go to:
> http://www.microps.com/mps/paperFAQ.html
> ====================================================
>
Technical Details
Message-ID:
<44a0ea3c$2@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news2.volia.net!newsfeed.utanet.at!reader.uucp.at!feeder02.uucp.at!newsfeed.uucp.at!news.uucp.at!newsgroups.borland.com!not-for-mailReferences:
<449bca0b$1@newsgroups.borland.com> <449c3030$1@newsgroups.borland.com> <449c3946$1@newsgroups.borland.com> <449d80af$1@newsgroups.borland.com> <449db611@newsgroups.borland.com> <44a023aa$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 1073da,de14a88c3d1af0e4 X-Google-Attributes: gid1073da,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Christa Schneider" <csk@ignicon.de> Newsgroups: borland.public.jbuilder.database References: <449bca0b$1@newsgroups.borland.com> <449c3030$1@newsgroups.borland.com> <449c3946$1@newsgroups.borland.com> <449d80af$1@newsgroups.borland.com> <449db611@newsgroups.borland.com> <44a023aa$1@newsgroups.borland.com> Subject: Re: ProcedureDataSet and resultSetToDataSet doesn't work Date: Tue, 27 Jun 2006 10:19:58 +0200 Lines: 175 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2869 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 X-RFC2646: Format=Flowed; Response NNTP-Posting-Host: 84.154.52.144 Message-ID: <44a0ea3c$2@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1151396412 84.154.52.144 (27 Jun 2006 01:20:12 -0700) Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news2.volia.net!newsfeed.utanet.at!reader.uucp.at!feeder02.uucp.at!newsfeed.uucp.at!news.uucp.at!newsgroups.borland.com!not-for-mail