You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by António Mota <am...@gmail.com> on 2007/06/04 23:08:36 UTC

Error with simple example

Hi again:

My first try with SDo wasn't encoraging. This very simple example

das = DASImpl.FACTORY.createDAS(getConnection());
Command readCustomers = das.createCommand("select * from PERSON");
DataObject root = readCustomers.executeQuery();

gives a error on this last line. The connection is ok because the same
sql statement works using jdbc directly.

The error is as follows:

Exception in thread "main" java.lang.AbstractMethodError:
com.microsoft.jdbc.sqlserver.SQLServerConnection.prepareStatement(Ljava/lang/String;I)Ljava/sql/PreparedStatement;
	at org.apache.tuscany.das.rdb.impl.ConnectionImpl.prepareStatement(ConnectionImpl.java:98)
	at org.apache.tuscany.das.rdb.impl.Statement.getPreparedStatement(Statement.java:199)
	at org.apache.tuscany.das.rdb.impl.Statement.executeQuery(Statement.java:53)
	at org.apache.tuscany.das.rdb.impl.ReadCommandImpl.executeQuery(ReadCommandImpl.java:61)



Help, anyone?

-- 
Melhores cumprimentos / Best regards
António Santos Mota

---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org


Re: Error with simple example

Posted by António Mota <am...@gmail.com>.
Oi Luciano, obrigado pela ajuda.

However the TM here thinks the SDO/DAS at Tuscany it's not mature
enough to use in this project (it's a big project following mil
standards) so I'm afraid it's not now that I'll have the chance to
work with it. Too bad, i really appreciate the design of SDO and i
truly believe that it'll become a standard for data access.

At least we're going to proceed with some cutting edge technology
also, RAP/OSGi/EasyBeans, if we can put that to work too...

Um abraço de Portugal (a propósito, a minha mulher é de BH).

Thanks all.





2007/6/5, Luciano Resende <lu...@gmail.com>:
> Hey Antonio
>
>    Let me try to give you some help, and also point you to more DAS
> documentation.
>    DAS User guide is available at [1] and a test case that exercise
> some similar things to what you want to do is available at [2]
>
>    So, if you set the proper XPath index to [1], does it help ? If you
> think the problem is with the meta data (I don't have a MS SQL Server
> to try), maybe you could try looking at
> testSimulateFullOuterJoinRelationshipModification at the followign
> test case [3] and the DAS config used on the test case, where
> necessary metadata information is defined [4]. More information on
> resultset shape definition available at [5]
>
>    Please let me know if this helps, if you have any more details that
> could help identify the iissue please let me know.
>
> [1] http://incubator.apache.org/tuscany/rdb-das-user-guide.html
> [2] https://svn.apache.org/repos/asf/incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CrudWithChangeHistory.java
> [3] https://svn.apache.org/repos/asf/incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/RelationshipTests.java
> [4] https://svn.apache.org/repos/asf/incubator/tuscany/java/das/rdb/src/test/resources/companyMappingWithResultDescriptor.xml
> [5] http://incubator.apache.org/tuscany/explicit-resultset-shape-definition.html
>
> On 6/5/07, António Mota <am...@gmail.com> wrote:
> > I also try the examples using a config.xml file
> > (http://incubator.apache.org/tuscany/starting-with-das.html) but i get
> >
> >  Feature 'Command' not found.
> >
> > or
> >
> >  Feature 'Table' not found.
> >
> > if i remove the Commands...
> >
> >
> > 2007/6/5, António Mota <am...@gmail.com>:
> > > Hi Frank:
> > >
> > > Thanks for your help here. However, besides that error that i
> > > corrected, the problem still arises. I look into
> > >
> > > ((Property)root.getType().getProperties().get(0)).getName()
> > >
> > > and that returns a empty string "".
> > >
> > > But there is no problem with the DB, because a simple test
> > >
> > >               PreparedStatement sql =
> > > connection.prepareStatement("select * from PERSON");
> > >               ResultSet rst = sql.executeQuery();
> > >
> > > return the correct result in rst.
> > >
> > > Can you give me some more pointers? I'm using now jTDS to connect to a
> > > SQLServer, could be a problem of the driver not returning Metadata? I
> > > used also the MS jdbc drivers but that caused another problem, the
> > > first i described. I'm going to try with Sybase as soon as i can
> > > because the production bd will be sysbase, but shouldn't this work
> > > with any db?
> > >
> > > I have until the end of the day to prove my point in favor of Tuscany,
> > > as tomorrow we must choose the technology, so any help will be greatly
> > > apreciated.
> > >
> > > Many thanks.
> > >
> > >
> > >
> > > 2007/6/5, Frank Budinsky <fr...@ca.ibm.com>:
> > > > One thing that's certainly wrong is "Person[0]" because an XPath index
> > > > must be >= 1. See section 12 of the SDO spec:
> > > > http://osoa.org/download/attachments/36/Java-SDO-Spec-v2.1.0-FINAL.pdf?version=1
> > > >
> > > > Note that the code that you said returned what you want is using a
> > > > property number (i.e., 0):
> > > >
> > > > > List l = (List)root.getList(0);
> > > >
> > > > To see what the name of this property (number 0) is you can call:
> > > > ((Property)root.getType().getProperties().get(0)).getName();
> > > >
> > > > Whatever name that returns is the name of the property you should be able
> > > > to use in the getDataObject() call: "Person" or "PERSON" or whatever, in
> > > > your example.
> > > >
> > > > I'd suggest looking at the SDO spec, or some of the examples, to get a
> > > > better understanding of how SDO works.
> > > >
> > > > Frank.
> > > >
> > > >
> > > > "António Mota" <am...@gmail.com> wrote on 06/04/2007 06:55:03 PM:
> > > >
> > > > > One last note. If i test with
> > > > >
> > > > >       List l = (List)root.getList(0);
> > > > >       DataObject d = (DataObject)l.get(0);
> > > > >       String name = d.get(0);
> > > > >
> > > > > returns the correct value, what i expected that
> > > > >
> > > > >       DataObject cust = root.getDataObject("Person[0]");
> > > > >       String name = cust.getString("LASTNAME");
> > > > >
> > > > > will return.
> > > > >
> > > > > Is the problem with the jTDS driver not returning Metadata?
> > > > >
> > > > > I don't know what to do now...
> > > > >
> > > > >
> > > > >
> > > > > 2007/6/4, António Mota <am...@gmail.com>:
> > > > > > Hi:
> > > > > >
> > > > > > It seems this error was a "feature" of MS sqlserver driver... I
> > > > > > changed it to jTDS and it works now. BUT...
> > > > > >
> > > > > > now i hav a error on the following line (typical...)
> > > > > >
> > > > > > DataObject root = readCustomers.executeQuery();       ---> now works
> > > > > > DataObject cust = root.getDataObject("PERSON[0]");  ----> gives
> > > > > error!!!!!!!!!!!
> > > > > >
> > > > > > and the error is
> > > > > >
> > > > > > Class 'DataGraphRoot' does not have a feature named 'PERSON'
> > > > > >
> > > > > > If i try
> > > > > >
> > > > > > DataObject cust = root.getDataObject(0);
> > > > > >
> > > > > > gives
> > > > > >
> > > > > > org.eclipse.emf.ecore.util.EcoreEList$Dynamic cannot be cast to
> > > > > > commonj.sdo.DataObject
> > > > > >
> > > > > > With
> > > > > >
> > > > > > DataObject cust = root.getDataObject(1);
> > > > > >
> > > > > > i got
> > > > > >
> > > > > > java.lang.IndexOutOfBoundsException
> > > > > >
> > > > > >
> > > > > > So what's wrong now?
> > > > > >
> > > > > > For a simple test case this is working great :(
> > > > > >
> > > > > > Thanks all.
> > > > > >
> > > > > > 2007/6/4, António Mota <am...@gmail.com>:
> > > > > > > Hi again:
> > > > > > >
> > > > > > > My first try with SDo wasn't encoraging. This very simple example
> > > > > > >
> > > > > > > das = DASImpl.FACTORY.createDAS(getConnection());
> > > > > > > Command readCustomers = das.createCommand("select * from PERSON");
> > > > > > > DataObject root = readCustomers.executeQuery();
> > > > > > >
> > > > > > > gives a error on this last line. The connection is ok because the
> > > > same
> > > > > > > sql statement works using jdbc directly.
> > > > > > >
> > > > > > > The error is as follows:
> > > > > > >
> > > > > > > Exception in thread "main" java.lang.AbstractMethodError:
> > > > > > > com.microsoft.jdbc.sqlserver.SQLServerConnection.
> > > > > prepareStatement(Ljava/lang/String;I)Ljava/sql/PreparedStatement;
> > > > > > >         at org.apache.tuscany.das.rdb.impl.ConnectionImpl.
> > > > > prepareStatement(ConnectionImpl.java:98)
> > > > > > >         at org.apache.tuscany.das.rdb.impl.Statement.
> > > > > getPreparedStatement(Statement.java:199)
> > > > > > >         at org.apache.tuscany.das.rdb.impl.Statement.
> > > > > executeQuery(Statement.java:53)
> > > > > > >         at org.apache.tuscany.das.rdb.impl.ReadCommandImpl.
> > > > > executeQuery(ReadCommandImpl.java:61)
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > Help, anyone?
> > > > > > >
> > > > > > > --
> > > > > > > Melhores cumprimentos / Best regards
> > > > > > > António Santos Mota
> > > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > Melhores cumprimentos / Best regards
> > > > > > António Santos Mota
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Melhores cumprimentos / Best regards
> > > > > António Santos Mota
> > > > >
> > > > > ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> > > > > For additional commands, e-mail: tuscany-user-help@ws.apache.org
> > > > >
> > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> > > > For additional commands, e-mail: tuscany-user-help@ws.apache.org
> > > >
> > > >
> > >
> > >
> > > --
> > > Melhores cumprimentos / Best regards
> > > António Santos Mota
> > >
> >
> >
> > --
> > Melhores cumprimentos / Best regards
> > António Santos Mota
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: tuscany-user-help@ws.apache.org
> >
> >
>
>
> --
> Luciano Resende
> Apache Tuscany Committer
> http://people.apache.org/~lresende
> http://lresende.blogspot.com/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-user-help@ws.apache.org
>
>


-- 
Melhores cumprimentos / Best regards
António Santos Mota

---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org


Re: Error with simple example

Posted by Luciano Resende <lu...@gmail.com>.
Hey Antonio

   Let me try to give you some help, and also point you to more DAS
documentation.
   DAS User guide is available at [1] and a test case that exercise
some similar things to what you want to do is available at [2]

   So, if you set the proper XPath index to [1], does it help ? If you
think the problem is with the meta data (I don't have a MS SQL Server
to try), maybe you could try looking at
testSimulateFullOuterJoinRelationshipModification at the followign
test case [3] and the DAS config used on the test case, where
necessary metadata information is defined [4]. More information on
resultset shape definition available at [5]

   Please let me know if this helps, if you have any more details that
could help identify the iissue please let me know.

[1] http://incubator.apache.org/tuscany/rdb-das-user-guide.html
[2] https://svn.apache.org/repos/asf/incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CrudWithChangeHistory.java
[3] https://svn.apache.org/repos/asf/incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/RelationshipTests.java
[4] https://svn.apache.org/repos/asf/incubator/tuscany/java/das/rdb/src/test/resources/companyMappingWithResultDescriptor.xml
[5] http://incubator.apache.org/tuscany/explicit-resultset-shape-definition.html

On 6/5/07, António Mota <am...@gmail.com> wrote:
> I also try the examples using a config.xml file
> (http://incubator.apache.org/tuscany/starting-with-das.html) but i get
>
>  Feature 'Command' not found.
>
> or
>
>  Feature 'Table' not found.
>
> if i remove the Commands...
>
>
> 2007/6/5, António Mota <am...@gmail.com>:
> > Hi Frank:
> >
> > Thanks for your help here. However, besides that error that i
> > corrected, the problem still arises. I look into
> >
> > ((Property)root.getType().getProperties().get(0)).getName()
> >
> > and that returns a empty string "".
> >
> > But there is no problem with the DB, because a simple test
> >
> >               PreparedStatement sql =
> > connection.prepareStatement("select * from PERSON");
> >               ResultSet rst = sql.executeQuery();
> >
> > return the correct result in rst.
> >
> > Can you give me some more pointers? I'm using now jTDS to connect to a
> > SQLServer, could be a problem of the driver not returning Metadata? I
> > used also the MS jdbc drivers but that caused another problem, the
> > first i described. I'm going to try with Sybase as soon as i can
> > because the production bd will be sysbase, but shouldn't this work
> > with any db?
> >
> > I have until the end of the day to prove my point in favor of Tuscany,
> > as tomorrow we must choose the technology, so any help will be greatly
> > apreciated.
> >
> > Many thanks.
> >
> >
> >
> > 2007/6/5, Frank Budinsky <fr...@ca.ibm.com>:
> > > One thing that's certainly wrong is "Person[0]" because an XPath index
> > > must be >= 1. See section 12 of the SDO spec:
> > > http://osoa.org/download/attachments/36/Java-SDO-Spec-v2.1.0-FINAL.pdf?version=1
> > >
> > > Note that the code that you said returned what you want is using a
> > > property number (i.e., 0):
> > >
> > > > List l = (List)root.getList(0);
> > >
> > > To see what the name of this property (number 0) is you can call:
> > > ((Property)root.getType().getProperties().get(0)).getName();
> > >
> > > Whatever name that returns is the name of the property you should be able
> > > to use in the getDataObject() call: "Person" or "PERSON" or whatever, in
> > > your example.
> > >
> > > I'd suggest looking at the SDO spec, or some of the examples, to get a
> > > better understanding of how SDO works.
> > >
> > > Frank.
> > >
> > >
> > > "António Mota" <am...@gmail.com> wrote on 06/04/2007 06:55:03 PM:
> > >
> > > > One last note. If i test with
> > > >
> > > >       List l = (List)root.getList(0);
> > > >       DataObject d = (DataObject)l.get(0);
> > > >       String name = d.get(0);
> > > >
> > > > returns the correct value, what i expected that
> > > >
> > > >       DataObject cust = root.getDataObject("Person[0]");
> > > >       String name = cust.getString("LASTNAME");
> > > >
> > > > will return.
> > > >
> > > > Is the problem with the jTDS driver not returning Metadata?
> > > >
> > > > I don't know what to do now...
> > > >
> > > >
> > > >
> > > > 2007/6/4, António Mota <am...@gmail.com>:
> > > > > Hi:
> > > > >
> > > > > It seems this error was a "feature" of MS sqlserver driver... I
> > > > > changed it to jTDS and it works now. BUT...
> > > > >
> > > > > now i hav a error on the following line (typical...)
> > > > >
> > > > > DataObject root = readCustomers.executeQuery();       ---> now works
> > > > > DataObject cust = root.getDataObject("PERSON[0]");  ----> gives
> > > > error!!!!!!!!!!!
> > > > >
> > > > > and the error is
> > > > >
> > > > > Class 'DataGraphRoot' does not have a feature named 'PERSON'
> > > > >
> > > > > If i try
> > > > >
> > > > > DataObject cust = root.getDataObject(0);
> > > > >
> > > > > gives
> > > > >
> > > > > org.eclipse.emf.ecore.util.EcoreEList$Dynamic cannot be cast to
> > > > > commonj.sdo.DataObject
> > > > >
> > > > > With
> > > > >
> > > > > DataObject cust = root.getDataObject(1);
> > > > >
> > > > > i got
> > > > >
> > > > > java.lang.IndexOutOfBoundsException
> > > > >
> > > > >
> > > > > So what's wrong now?
> > > > >
> > > > > For a simple test case this is working great :(
> > > > >
> > > > > Thanks all.
> > > > >
> > > > > 2007/6/4, António Mota <am...@gmail.com>:
> > > > > > Hi again:
> > > > > >
> > > > > > My first try with SDo wasn't encoraging. This very simple example
> > > > > >
> > > > > > das = DASImpl.FACTORY.createDAS(getConnection());
> > > > > > Command readCustomers = das.createCommand("select * from PERSON");
> > > > > > DataObject root = readCustomers.executeQuery();
> > > > > >
> > > > > > gives a error on this last line. The connection is ok because the
> > > same
> > > > > > sql statement works using jdbc directly.
> > > > > >
> > > > > > The error is as follows:
> > > > > >
> > > > > > Exception in thread "main" java.lang.AbstractMethodError:
> > > > > > com.microsoft.jdbc.sqlserver.SQLServerConnection.
> > > > prepareStatement(Ljava/lang/String;I)Ljava/sql/PreparedStatement;
> > > > > >         at org.apache.tuscany.das.rdb.impl.ConnectionImpl.
> > > > prepareStatement(ConnectionImpl.java:98)
> > > > > >         at org.apache.tuscany.das.rdb.impl.Statement.
> > > > getPreparedStatement(Statement.java:199)
> > > > > >         at org.apache.tuscany.das.rdb.impl.Statement.
> > > > executeQuery(Statement.java:53)
> > > > > >         at org.apache.tuscany.das.rdb.impl.ReadCommandImpl.
> > > > executeQuery(ReadCommandImpl.java:61)
> > > > > >
> > > > > >
> > > > > >
> > > > > > Help, anyone?
> > > > > >
> > > > > > --
> > > > > > Melhores cumprimentos / Best regards
> > > > > > António Santos Mota
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Melhores cumprimentos / Best regards
> > > > > António Santos Mota
> > > > >
> > > >
> > > >
> > > > --
> > > > Melhores cumprimentos / Best regards
> > > > António Santos Mota
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> > > > For additional commands, e-mail: tuscany-user-help@ws.apache.org
> > > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> > > For additional commands, e-mail: tuscany-user-help@ws.apache.org
> > >
> > >
> >
> >
> > --
> > Melhores cumprimentos / Best regards
> > António Santos Mota
> >
>
>
> --
> Melhores cumprimentos / Best regards
> António Santos Mota
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-user-help@ws.apache.org
>
>


-- 
Luciano Resende
Apache Tuscany Committer
http://people.apache.org/~lresende
http://lresende.blogspot.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org


Re: Error with simple example

Posted by António Mota <am...@gmail.com>.
I also try the examples using a config.xml file
(http://incubator.apache.org/tuscany/starting-with-das.html) but i get

 Feature 'Command' not found.

or

 Feature 'Table' not found.

if i remove the Commands...


2007/6/5, António Mota <am...@gmail.com>:
> Hi Frank:
>
> Thanks for your help here. However, besides that error that i
> corrected, the problem still arises. I look into
>
> ((Property)root.getType().getProperties().get(0)).getName()
>
> and that returns a empty string "".
>
> But there is no problem with the DB, because a simple test
>
>               PreparedStatement sql =
> connection.prepareStatement("select * from PERSON");
>               ResultSet rst = sql.executeQuery();
>
> return the correct result in rst.
>
> Can you give me some more pointers? I'm using now jTDS to connect to a
> SQLServer, could be a problem of the driver not returning Metadata? I
> used also the MS jdbc drivers but that caused another problem, the
> first i described. I'm going to try with Sybase as soon as i can
> because the production bd will be sysbase, but shouldn't this work
> with any db?
>
> I have until the end of the day to prove my point in favor of Tuscany,
> as tomorrow we must choose the technology, so any help will be greatly
> apreciated.
>
> Many thanks.
>
>
>
> 2007/6/5, Frank Budinsky <fr...@ca.ibm.com>:
> > One thing that's certainly wrong is "Person[0]" because an XPath index
> > must be >= 1. See section 12 of the SDO spec:
> > http://osoa.org/download/attachments/36/Java-SDO-Spec-v2.1.0-FINAL.pdf?version=1
> >
> > Note that the code that you said returned what you want is using a
> > property number (i.e., 0):
> >
> > > List l = (List)root.getList(0);
> >
> > To see what the name of this property (number 0) is you can call:
> > ((Property)root.getType().getProperties().get(0)).getName();
> >
> > Whatever name that returns is the name of the property you should be able
> > to use in the getDataObject() call: "Person" or "PERSON" or whatever, in
> > your example.
> >
> > I'd suggest looking at the SDO spec, or some of the examples, to get a
> > better understanding of how SDO works.
> >
> > Frank.
> >
> >
> > "António Mota" <am...@gmail.com> wrote on 06/04/2007 06:55:03 PM:
> >
> > > One last note. If i test with
> > >
> > >       List l = (List)root.getList(0);
> > >       DataObject d = (DataObject)l.get(0);
> > >       String name = d.get(0);
> > >
> > > returns the correct value, what i expected that
> > >
> > >       DataObject cust = root.getDataObject("Person[0]");
> > >       String name = cust.getString("LASTNAME");
> > >
> > > will return.
> > >
> > > Is the problem with the jTDS driver not returning Metadata?
> > >
> > > I don't know what to do now...
> > >
> > >
> > >
> > > 2007/6/4, António Mota <am...@gmail.com>:
> > > > Hi:
> > > >
> > > > It seems this error was a "feature" of MS sqlserver driver... I
> > > > changed it to jTDS and it works now. BUT...
> > > >
> > > > now i hav a error on the following line (typical...)
> > > >
> > > > DataObject root = readCustomers.executeQuery();       ---> now works
> > > > DataObject cust = root.getDataObject("PERSON[0]");  ----> gives
> > > error!!!!!!!!!!!
> > > >
> > > > and the error is
> > > >
> > > > Class 'DataGraphRoot' does not have a feature named 'PERSON'
> > > >
> > > > If i try
> > > >
> > > > DataObject cust = root.getDataObject(0);
> > > >
> > > > gives
> > > >
> > > > org.eclipse.emf.ecore.util.EcoreEList$Dynamic cannot be cast to
> > > > commonj.sdo.DataObject
> > > >
> > > > With
> > > >
> > > > DataObject cust = root.getDataObject(1);
> > > >
> > > > i got
> > > >
> > > > java.lang.IndexOutOfBoundsException
> > > >
> > > >
> > > > So what's wrong now?
> > > >
> > > > For a simple test case this is working great :(
> > > >
> > > > Thanks all.
> > > >
> > > > 2007/6/4, António Mota <am...@gmail.com>:
> > > > > Hi again:
> > > > >
> > > > > My first try with SDo wasn't encoraging. This very simple example
> > > > >
> > > > > das = DASImpl.FACTORY.createDAS(getConnection());
> > > > > Command readCustomers = das.createCommand("select * from PERSON");
> > > > > DataObject root = readCustomers.executeQuery();
> > > > >
> > > > > gives a error on this last line. The connection is ok because the
> > same
> > > > > sql statement works using jdbc directly.
> > > > >
> > > > > The error is as follows:
> > > > >
> > > > > Exception in thread "main" java.lang.AbstractMethodError:
> > > > > com.microsoft.jdbc.sqlserver.SQLServerConnection.
> > > prepareStatement(Ljava/lang/String;I)Ljava/sql/PreparedStatement;
> > > > >         at org.apache.tuscany.das.rdb.impl.ConnectionImpl.
> > > prepareStatement(ConnectionImpl.java:98)
> > > > >         at org.apache.tuscany.das.rdb.impl.Statement.
> > > getPreparedStatement(Statement.java:199)
> > > > >         at org.apache.tuscany.das.rdb.impl.Statement.
> > > executeQuery(Statement.java:53)
> > > > >         at org.apache.tuscany.das.rdb.impl.ReadCommandImpl.
> > > executeQuery(ReadCommandImpl.java:61)
> > > > >
> > > > >
> > > > >
> > > > > Help, anyone?
> > > > >
> > > > > --
> > > > > Melhores cumprimentos / Best regards
> > > > > António Santos Mota
> > > > >
> > > >
> > > >
> > > > --
> > > > Melhores cumprimentos / Best regards
> > > > António Santos Mota
> > > >
> > >
> > >
> > > --
> > > Melhores cumprimentos / Best regards
> > > António Santos Mota
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> > > For additional commands, e-mail: tuscany-user-help@ws.apache.org
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: tuscany-user-help@ws.apache.org
> >
> >
>
>
> --
> Melhores cumprimentos / Best regards
> António Santos Mota
>


-- 
Melhores cumprimentos / Best regards
António Santos Mota

---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org


Re: Error with simple example

Posted by António Mota <am...@gmail.com>.
Hi Frank:

Thanks for your help here. However, besides that error that i
corrected, the problem still arises. I look into

((Property)root.getType().getProperties().get(0)).getName()

and that returns a empty string "".

But there is no problem with the DB, because a simple test

              PreparedStatement sql =
connection.prepareStatement("select * from PERSON");
              ResultSet rst = sql.executeQuery();

return the correct result in rst.

Can you give me some more pointers? I'm using now jTDS to connect to a
SQLServer, could be a problem of the driver not returning Metadata? I
used also the MS jdbc drivers but that caused another problem, the
first i described. I'm going to try with Sybase as soon as i can
because the production bd will be sysbase, but shouldn't this work
with any db?

I have until the end of the day to prove my point in favor of Tuscany,
as tomorrow we must choose the technology, so any help will be greatly
apreciated.

Many thanks.



2007/6/5, Frank Budinsky <fr...@ca.ibm.com>:
> One thing that's certainly wrong is "Person[0]" because an XPath index
> must be >= 1. See section 12 of the SDO spec:
> http://osoa.org/download/attachments/36/Java-SDO-Spec-v2.1.0-FINAL.pdf?version=1
>
> Note that the code that you said returned what you want is using a
> property number (i.e., 0):
>
> > List l = (List)root.getList(0);
>
> To see what the name of this property (number 0) is you can call:
> ((Property)root.getType().getProperties().get(0)).getName();
>
> Whatever name that returns is the name of the property you should be able
> to use in the getDataObject() call: "Person" or "PERSON" or whatever, in
> your example.
>
> I'd suggest looking at the SDO spec, or some of the examples, to get a
> better understanding of how SDO works.
>
> Frank.
>
>
> "António Mota" <am...@gmail.com> wrote on 06/04/2007 06:55:03 PM:
>
> > One last note. If i test with
> >
> >       List l = (List)root.getList(0);
> >       DataObject d = (DataObject)l.get(0);
> >       String name = d.get(0);
> >
> > returns the correct value, what i expected that
> >
> >       DataObject cust = root.getDataObject("Person[0]");
> >       String name = cust.getString("LASTNAME");
> >
> > will return.
> >
> > Is the problem with the jTDS driver not returning Metadata?
> >
> > I don't know what to do now...
> >
> >
> >
> > 2007/6/4, António Mota <am...@gmail.com>:
> > > Hi:
> > >
> > > It seems this error was a "feature" of MS sqlserver driver... I
> > > changed it to jTDS and it works now. BUT...
> > >
> > > now i hav a error on the following line (typical...)
> > >
> > > DataObject root = readCustomers.executeQuery();       ---> now works
> > > DataObject cust = root.getDataObject("PERSON[0]");  ----> gives
> > error!!!!!!!!!!!
> > >
> > > and the error is
> > >
> > > Class 'DataGraphRoot' does not have a feature named 'PERSON'
> > >
> > > If i try
> > >
> > > DataObject cust = root.getDataObject(0);
> > >
> > > gives
> > >
> > > org.eclipse.emf.ecore.util.EcoreEList$Dynamic cannot be cast to
> > > commonj.sdo.DataObject
> > >
> > > With
> > >
> > > DataObject cust = root.getDataObject(1);
> > >
> > > i got
> > >
> > > java.lang.IndexOutOfBoundsException
> > >
> > >
> > > So what's wrong now?
> > >
> > > For a simple test case this is working great :(
> > >
> > > Thanks all.
> > >
> > > 2007/6/4, António Mota <am...@gmail.com>:
> > > > Hi again:
> > > >
> > > > My first try with SDo wasn't encoraging. This very simple example
> > > >
> > > > das = DASImpl.FACTORY.createDAS(getConnection());
> > > > Command readCustomers = das.createCommand("select * from PERSON");
> > > > DataObject root = readCustomers.executeQuery();
> > > >
> > > > gives a error on this last line. The connection is ok because the
> same
> > > > sql statement works using jdbc directly.
> > > >
> > > > The error is as follows:
> > > >
> > > > Exception in thread "main" java.lang.AbstractMethodError:
> > > > com.microsoft.jdbc.sqlserver.SQLServerConnection.
> > prepareStatement(Ljava/lang/String;I)Ljava/sql/PreparedStatement;
> > > >         at org.apache.tuscany.das.rdb.impl.ConnectionImpl.
> > prepareStatement(ConnectionImpl.java:98)
> > > >         at org.apache.tuscany.das.rdb.impl.Statement.
> > getPreparedStatement(Statement.java:199)
> > > >         at org.apache.tuscany.das.rdb.impl.Statement.
> > executeQuery(Statement.java:53)
> > > >         at org.apache.tuscany.das.rdb.impl.ReadCommandImpl.
> > executeQuery(ReadCommandImpl.java:61)
> > > >
> > > >
> > > >
> > > > Help, anyone?
> > > >
> > > > --
> > > > Melhores cumprimentos / Best regards
> > > > António Santos Mota
> > > >
> > >
> > >
> > > --
> > > Melhores cumprimentos / Best regards
> > > António Santos Mota
> > >
> >
> >
> > --
> > Melhores cumprimentos / Best regards
> > António Santos Mota
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: tuscany-user-help@ws.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-user-help@ws.apache.org
>
>


-- 
Melhores cumprimentos / Best regards
António Santos Mota

---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org


Re: Error with simple example

Posted by Frank Budinsky <fr...@ca.ibm.com>.
One thing that's certainly wrong is "Person[0]" because an XPath index 
must be >= 1. See section 12 of the SDO spec: 
http://osoa.org/download/attachments/36/Java-SDO-Spec-v2.1.0-FINAL.pdf?version=1

Note that the code that you said returned what you want is using a 
property number (i.e., 0):

> List l = (List)root.getList(0);

To see what the name of this property (number 0) is you can call: 
((Property)root.getType().getProperties().get(0)).getName();

Whatever name that returns is the name of the property you should be able 
to use in the getDataObject() call: "Person" or "PERSON" or whatever, in 
your example.

I'd suggest looking at the SDO spec, or some of the examples, to get a 
better understanding of how SDO works.

Frank.


"António Mota" <am...@gmail.com> wrote on 06/04/2007 06:55:03 PM:

> One last note. If i test with
> 
>       List l = (List)root.getList(0);
>       DataObject d = (DataObject)l.get(0);
>       String name = d.get(0);
> 
> returns the correct value, what i expected that
> 
>       DataObject cust = root.getDataObject("Person[0]");
>       String name = cust.getString("LASTNAME");
> 
> will return.
> 
> Is the problem with the jTDS driver not returning Metadata?
> 
> I don't know what to do now...
> 
> 
> 
> 2007/6/4, António Mota <am...@gmail.com>:
> > Hi:
> >
> > It seems this error was a "feature" of MS sqlserver driver... I
> > changed it to jTDS and it works now. BUT...
> >
> > now i hav a error on the following line (typical...)
> >
> > DataObject root = readCustomers.executeQuery();       ---> now works
> > DataObject cust = root.getDataObject("PERSON[0]");  ----> gives 
> error!!!!!!!!!!!
> >
> > and the error is
> >
> > Class 'DataGraphRoot' does not have a feature named 'PERSON'
> >
> > If i try
> >
> > DataObject cust = root.getDataObject(0);
> >
> > gives
> >
> > org.eclipse.emf.ecore.util.EcoreEList$Dynamic cannot be cast to
> > commonj.sdo.DataObject
> >
> > With
> >
> > DataObject cust = root.getDataObject(1);
> >
> > i got
> >
> > java.lang.IndexOutOfBoundsException
> >
> >
> > So what's wrong now?
> >
> > For a simple test case this is working great :(
> >
> > Thanks all.
> >
> > 2007/6/4, António Mota <am...@gmail.com>:
> > > Hi again:
> > >
> > > My first try with SDo wasn't encoraging. This very simple example
> > >
> > > das = DASImpl.FACTORY.createDAS(getConnection());
> > > Command readCustomers = das.createCommand("select * from PERSON");
> > > DataObject root = readCustomers.executeQuery();
> > >
> > > gives a error on this last line. The connection is ok because the 
same
> > > sql statement works using jdbc directly.
> > >
> > > The error is as follows:
> > >
> > > Exception in thread "main" java.lang.AbstractMethodError:
> > > com.microsoft.jdbc.sqlserver.SQLServerConnection.
> prepareStatement(Ljava/lang/String;I)Ljava/sql/PreparedStatement;
> > >         at org.apache.tuscany.das.rdb.impl.ConnectionImpl.
> prepareStatement(ConnectionImpl.java:98)
> > >         at org.apache.tuscany.das.rdb.impl.Statement.
> getPreparedStatement(Statement.java:199)
> > >         at org.apache.tuscany.das.rdb.impl.Statement.
> executeQuery(Statement.java:53)
> > >         at org.apache.tuscany.das.rdb.impl.ReadCommandImpl.
> executeQuery(ReadCommandImpl.java:61)
> > >
> > >
> > >
> > > Help, anyone?
> > >
> > > --
> > > Melhores cumprimentos / Best regards
> > > António Santos Mota
> > >
> >
> >
> > --
> > Melhores cumprimentos / Best regards
> > António Santos Mota
> >
> 
> 
> -- 
> Melhores cumprimentos / Best regards
> António Santos Mota
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-user-help@ws.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org


Re: Error with simple example

Posted by António Mota <am...@gmail.com>.
One last note. If i test with

		List l = (List)root.getList(0);
		DataObject d = (DataObject)l.get(0);
		String name = d.get(0);

returns the correct value, what i expected that

		DataObject cust = root.getDataObject("Person[0]");
		String name = cust.getString("LASTNAME");

will return.

Is the problem with the jTDS driver not returning Metadata?

I don't know what to do now...



2007/6/4, António Mota <am...@gmail.com>:
> Hi:
>
> It seems this error was a "feature" of MS sqlserver driver... I
> changed it to jTDS and it works now. BUT...
>
> now i hav a error on the following line (typical...)
>
> DataObject root = readCustomers.executeQuery();       ---> now works
> DataObject cust = root.getDataObject("PERSON[0]");  ----> gives error!!!!!!!!!!!
>
> and the error is
>
> Class 'DataGraphRoot' does not have a feature named 'PERSON'
>
> If i try
>
> DataObject cust = root.getDataObject(0);
>
> gives
>
> org.eclipse.emf.ecore.util.EcoreEList$Dynamic cannot be cast to
> commonj.sdo.DataObject
>
> With
>
> DataObject cust = root.getDataObject(1);
>
> i got
>
> java.lang.IndexOutOfBoundsException
>
>
> So what's wrong now?
>
> For a simple test case this is working great :(
>
> Thanks all.
>
> 2007/6/4, António Mota <am...@gmail.com>:
> > Hi again:
> >
> > My first try with SDo wasn't encoraging. This very simple example
> >
> > das = DASImpl.FACTORY.createDAS(getConnection());
> > Command readCustomers = das.createCommand("select * from PERSON");
> > DataObject root = readCustomers.executeQuery();
> >
> > gives a error on this last line. The connection is ok because the same
> > sql statement works using jdbc directly.
> >
> > The error is as follows:
> >
> > Exception in thread "main" java.lang.AbstractMethodError:
> > com.microsoft.jdbc.sqlserver.SQLServerConnection.prepareStatement(Ljava/lang/String;I)Ljava/sql/PreparedStatement;
> >         at org.apache.tuscany.das.rdb.impl.ConnectionImpl.prepareStatement(ConnectionImpl.java:98)
> >         at org.apache.tuscany.das.rdb.impl.Statement.getPreparedStatement(Statement.java:199)
> >         at org.apache.tuscany.das.rdb.impl.Statement.executeQuery(Statement.java:53)
> >         at org.apache.tuscany.das.rdb.impl.ReadCommandImpl.executeQuery(ReadCommandImpl.java:61)
> >
> >
> >
> > Help, anyone?
> >
> > --
> > Melhores cumprimentos / Best regards
> > António Santos Mota
> >
>
>
> --
> Melhores cumprimentos / Best regards
> António Santos Mota
>


-- 
Melhores cumprimentos / Best regards
António Santos Mota

---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org


Re: Error with simple example

Posted by António Mota <am...@gmail.com>.
Hi:

It seems this error was a "feature" of MS sqlserver driver... I
changed it to jTDS and it works now. BUT...

now i hav a error on the following line (typical...)

DataObject root = readCustomers.executeQuery();       ---> now works
DataObject cust = root.getDataObject("PERSON[0]");  ----> gives error!!!!!!!!!!!

and the error is

Class 'DataGraphRoot' does not have a feature named 'PERSON'

If i try

DataObject cust = root.getDataObject(0);

gives

org.eclipse.emf.ecore.util.EcoreEList$Dynamic cannot be cast to
commonj.sdo.DataObject

With

DataObject cust = root.getDataObject(1);

i got

java.lang.IndexOutOfBoundsException


So what's wrong now?

For a simple test case this is working great :(

Thanks all.

2007/6/4, António Mota <am...@gmail.com>:
> Hi again:
>
> My first try with SDo wasn't encoraging. This very simple example
>
> das = DASImpl.FACTORY.createDAS(getConnection());
> Command readCustomers = das.createCommand("select * from PERSON");
> DataObject root = readCustomers.executeQuery();
>
> gives a error on this last line. The connection is ok because the same
> sql statement works using jdbc directly.
>
> The error is as follows:
>
> Exception in thread "main" java.lang.AbstractMethodError:
> com.microsoft.jdbc.sqlserver.SQLServerConnection.prepareStatement(Ljava/lang/String;I)Ljava/sql/PreparedStatement;
>         at org.apache.tuscany.das.rdb.impl.ConnectionImpl.prepareStatement(ConnectionImpl.java:98)
>         at org.apache.tuscany.das.rdb.impl.Statement.getPreparedStatement(Statement.java:199)
>         at org.apache.tuscany.das.rdb.impl.Statement.executeQuery(Statement.java:53)
>         at org.apache.tuscany.das.rdb.impl.ReadCommandImpl.executeQuery(ReadCommandImpl.java:61)
>
>
>
> Help, anyone?
>
> --
> Melhores cumprimentos / Best regards
> António Santos Mota
>


-- 
Melhores cumprimentos / Best regards
António Santos Mota

---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org