You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by Jason Clark <jc...@21csi.com> on 2007/10/31 03:21:35 UTC

DAS configuration must specify ResultDescriptors

I'm getting the following exception when trying to implement simple DAS CRUD
operations.

Exception in thread "main" java.lang.RuntimeException: Unable to obtain
table information from JDBC. DAS configuration must specify
ResultDescriptors
	at
org.apache.tuscany.das.rdb.graphbuilder.impl.ResultMetadata.<init>(ResultMet
adata.java:81)
	at
org.apache.tuscany.das.rdb.graphbuilder.impl.GraphBuilderMetadata.<init>(Gra
phBuilderMetadata.java:69)
	at
org.apache.tuscany.das.rdb.impl.ReadCommandImpl.buildGraph(ReadCommandImpl.j
ava:295)
	at
org.apache.tuscany.das.rdb.impl.ReadCommandImpl.executeQuery(ReadCommandImpl
.java:277)
	at ContactDASTest.getContacts(ContactDASTest.java:22)
	at ContactDASTest.printContacts(ContactDASTest.java:28)
	at ContactDASTest.main(ContactDASTest.java:41)



Given the following config. I tried following the Company example and their
config.

I'm unsure what a ResultDescriptor is and why I would need one, but the
Company example does not.

As a side note, my table is all strings stored in nvarchar columns. Is that
part of the issue?

It also does not have a primary key at the moment, but I'm not sure why that
would be a problem.


<Config xmlns="http:///org.apache.tuscany.das.rdb/config.xsd"> 
    
    <!--ConnectionInfo dataSource="java:comp/env/jdbc/dastest"/-->
    
	<ConnectionInfo>
		<ConnectionProperties 
	
driverClass="com.microsoft.sqlserver.jdbc.SQLServerDriver"
			databaseURL="jdbc:sqlserver://*;databasename=*"
			userName="*"
			password="*"
			loginTimeout="600"/>
	</ConnectionInfo>
    
	<Command name="all contacts" SQL="select * from CONTACTS"
kind="Select"/>

    <Table tableName="CONTACTS">
		
	</Table>

</Config>


-Jason Clark
 







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


RE: DAS configuration must specify ResultDescriptors

Posted by Jason Clark <jc...@21csi.com>.
I'm trying both the MS driver and JTDS. The MS driver returns even less
metadata than JTDS. Shoot. I guess I'll just have to write descriptors for
everything.

-Jason
 
> -----Original Message-----
> From: Amita Vadhavkar [mailto:amita.vadhavkar@gmail.com]
> Sent: Thursday, November 01, 2007 8:39 PM
> To: tuscany-user@ws.apache.org
> Subject: Re: DAS configuration must specify ResultDescriptors
> 
> It will mostly be limitation of the driver - which one are you using? See
> some below
> links to get the driver from microsoft and the library details the use of
> result set metadata.
> 
> *
> http://www.microsoft.com/downloads/details.aspx?FamilyID=D09C1D60-A13C-
> 4479-9B91-9E8B9D835CDC&displaylang=en-
> download site
> 
> *http://msdn2.microsoft.com/hi-in/sql/Aa336346.aspx - SP2
> 
> *http://msdn2.microsoft.com/en-us/library/ms378760.aspx - driver class
> supporting all
> reqd methods
> 
> Regards,
> Amita
> 
> On 11/2/07, Jason Clark <jc...@21csi.com> wrote:
> >
> > I updated my test to output all the information from the methods you
> > listed
> > below that required support.
> >
> > For my PK column, a simple id ID, it did not list information for the
> > Column
> > Table Name or the schema name. For all other columns, only the Schema
> name
> > was not listed.
> >
> > Is this information I can correct in the database, or is it inherent to
> > the
> > database the JDBC driver is simply not supporting it?
> >
> > -Jason
> >
> > This e-mail and any files transmitted with it are intended solely for
> the
> > use of the individual or entity to whom they are addressed.  If you have
> > received this e-mail in error please notify the sender immediately and
> > delete this e-mail from you system.  This message may contain company
> > proprietary, sensitive information and is intended only for the
> individual
> > named.  Its contents may be covered under the Trade Secret Act of
> various
> > jurisdictions.  If you are not the named addressee you should not
> > disseminate, distribute or copy this e-mail. If you are not the intended
> > recipient you are notified that disclosing, copying, distributing or
> > taking
> > any action in reliance on the contents of this information is strictly
> > prohibited.
> >
> > > -----Original Message-----
> > > From: Amita Vadhavkar [mailto:amita.vadhavkar@gmail.com]
> > > Sent: Wednesday, October 31, 2007 8:34 PM
> > > To: tuscany-user@ws.apache.org
> > > Subject: Re: DAS configuration must specify ResultDescriptors
> > >
> > > TUSCANY-1465 is the JIRA which added index to the <ResultDescriptor>
> > > With that the physical order can be anything for <ResultDescriptor>
> > > as long as index is used properly. This JIRA helps in specifying
> > > result descriptor programmatically (i.e. not thru config file).
> > > See DynamicResultDescriptorTests.java and
> > > http://incubator.apache.org/tuscany/explicit-resultset-shape-
> > > definition.html
> > > .
> > > This feature is part of latest DAS release - beta2.
> > >
> > > Prior to this fix, there was no index and as you say order is what
> > matters
> > > and not name in <ResultDescriptor.>
> > >
> > > As there is a column named ID in table CONTACTs, DAS following
> > > conventions uses it as PK, now if it is really not unique in the
> > database,
> > > it can cause problems in DB->DataObject xfer. e.g. if you have 2 rows
> > > having ID=1, and do select * from contact, then, the data graph
> obtained
> > > by DAS will not be able to show both rows in its data objects.
> > >
> > > For using SQL Server 2005 express edition provided db metadata -
> > > came across this url -
> > > http://forum.java.sun.com/thread.jspa?threadID=704004&tstart=150
> > >
> > > So looks like there are some problems in the support when it comes to
> > > supporting resultsetmetadata.
> > > What needs to be working is
> > > - getTableName(idx), getSchemaName(idx), getColumnCount(),
> > > getColumnType(idx),
> > > getColumnName(idx). If all these are working, then DAS will be able to
> > use
> > > the db metadata and will not need extra specification of
> > ResultDescriptor
> > > in
> > > config file.  So, you can check if some driver for SQL Server is
> > > supporting
> > > all
> > > these APIs and if you can use it. In that case, the <ResultDecriptor>
> > can
> > > go
> > > away.
> > >
> > > Please let me know if this helps.
> > >
> > > Regards,
> > > Amita
> > >
> > > On 11/1/07, Jason Clark <jc...@21csi.com> wrote:
> > > >
> > > > As a follow up, I wrote a simple class to test this.
> > > >
> > > > Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
> > > > String conUrl = "jdbc:sqlserver://****************"
> > > > Connection con = DriverManager.getConnection (conUrl);
> > > >
> > > > try {
> > > >         Statement st = con.createStatement();
> > > >         ResultSet rs = st.executeQuery("SELECT * FROM CONTACTS");
> > > >         ResultSetMetaData md = rs.getMetaData();
> > > >         int col = md.getColumnCount();
> > > >         System.out.println("Number of Column : " + col);
> > > >         System.out.println("Columns Name: ");
> > > >         for (int i = 1; i <= col; i++) {
> > > >                 String col_name = md.getColumnName(i);
> > > >                 System.out.println(col_name);
> > > >         }
> > > > }
> > > >
> > > > This successfully returned metadata about my table.
> > > >
> > > > If I do this...
> > > >
> > > > <Command name="all contacts" SQL="select * from CONTACTS"
> > kind="Select">
> > > >
> > > > <ResultDescriptor columnName="ID" tableName="CONTACTS"
> > > > columnType="commonj.sdo.Int"/>
> > > >
> > > > <ResultDescriptor columnName="FIRST_NAME" tableName="CONTACTS"
> > > > columnType="commonj.sdo.String"/>
> > > >
> > > > <ResultDescriptor columnName="LAST_NAME" tableName="CONTACTS"
> > > > columnType="commonj.sdo.String"/>
> > > >
> > > > <ResultDescriptor columnName="MIDDLE_NAME" tableName="CONTACTS"
> > > > columnType="commonj.sdo.String"/>
> > > >
> > > > </Command>
> > > >
> > > > I can then grab those columns, but I did notice the order is
> important
> > > and
> > > > the column name has nothing to do with the actual column name, it
> just
> > > > says
> > > > that the name you query the data object with is the word FIRST_NAME.
> > It
> > > > could be monkey, it doesn't matter. Not a problem though, but I
> can't
> > > > figure
> > > > out why I need result descriptors if I ResultSet.getMetaData () in
> > fact
> > > > returns the correct information.
> > > >
> > > > Any ideas?
> > > >
> > > > Thanks.
> > > >
> > > > -Jason
> > > >
> > > > > -----Original Message-----
> > > > > From: Luciano Resende [mailto:luckbr1975@gmail.com ]
> > > > > Sent: Tuesday, October 30, 2007 6:39 PM
> > > > > To: tuscany-user@ws.apache.org
> > > > > Subject: Re: DAS configuration must specify ResultDescriptors
> > > > >
> > > > > There are some databases that does not return metadata
> information,
> > > > > and DAS need that to build the result SDO Graph.More info on
> > > > > ResultDescriptor here [1].
> > > > >
> > > > > What database are you using ?
> > > > >
> > > > > [1] http://incubator.apache.org/tuscany/explicit-resultset-shape-
> > > > > definition.html
> > > > >
> > > > > On 10/30/07, Jason Clark < jclark@21csi.com> wrote:
> > > > > > I'm getting the following exception when trying to implement
> > simple
> > > > DAS
> > > > > CRUD
> > > > > > operations.
> > > > > >
> > > > > > Exception in thread "main" java.lang.RuntimeException: Unable to
> > > > obtain
> > > > > > table information from JDBC. DAS configuration must specify
> > > > > > ResultDescriptors
> > > > > >         at
> > > > > >
> > > > >
> > > org.apache.tuscany.das.rdb.graphbuilder.impl.ResultMetadata
> > .<init>(ResultM
> > > > > et
> > > > > > adata.java:81)
> > > > > >         at
> > > > > >
> > > > > org.apache.tuscany.das.rdb.graphbuilder.impl.GraphBuilderMetadata
> > > > .<init>(G
> > > > > ra
> > > > > > phBuilderMetadata.java :69)
> > > > > >         at
> > > > > >
> > > > > org.apache.tuscany.das.rdb.impl.ReadCommandImpl.buildGraph
> > > > (ReadCommandImpl
> > > > > .j
> > > > > > ava:295)
> > > > > >         at
> > > > > >
> > > > >
> > > org.apache.tuscany.das.rdb.impl.ReadCommandImpl.executeQuery
> > (ReadCommandIm
> > > > > pl
> > > > > > .java:277)
> > > > > >         at ContactDASTest.getContacts(ContactDASTest.java:22)
> > > > > >         at ContactDASTest.printContacts(ContactDASTest.java:28)
> > > > > >         at ContactDASTest.main(ContactDASTest.java:41)
> > > > > >
> > > > > >
> > > > > >
> > > > > > Given the following config. I tried following the Company
> example
> > > and
> > > > > their
> > > > > > config.
> > > > > >
> > > > > > I'm unsure what a ResultDescriptor is and why I would need one,
> > but
> > > > the
> > > > > > Company example does not.
> > > > > >
> > > > > > As a side note, my table is all strings stored in nvarchar
> > columns.
> > > Is
> > > > > that
> > > > > > part of the issue?
> > > > > >
> > > > > > It also does not have a primary key at the moment, but I'm not
> > sure
> > > > why
> > > > > that
> > > > > > would be a problem.
> > > > > >
> > > > > >
> > > > > > <Config xmlns="http:///org.apache.tuscany.das.rdb/config.xsd">
> > > > > >
> > > > > >     <!--ConnectionInfo dataSource="java:comp/env/jdbc/dastest"/-
> ->
> > > > > >
> > > > > >         <ConnectionInfo>
> > > > > >                 <ConnectionProperties
> > > > > >
> > > > > > driverClass="com.microsoft.sqlserver.jdbc.SQLServerDriver"
> > > > > >
> > > > databaseURL="jdbc:sqlserver://*;databasename=*"
> > > > > >                         userName="*"
> > > > > >                         password="*"
> > > > > >                         loginTimeout="600"/>
> > > > > >         </ConnectionInfo>
> > > > > >
> > > > > >         <Command name="all contacts" SQL="select * from
> CONTACTS"
> > > > > > kind="Select"/>
> > > > > >
> > > > > >     <Table tableName="CONTACTS">
> > > > > >
> > > > > >         </Table>
> > > > > >
> > > > > > </Config>
> > > > > >
> > > > > >
> > > > > > -Jason Clark
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > --------------------------------------------------------------------
> > > -
> > > > > > 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://people.apache.org/%7Elresende>
> > > > > 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
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > --------------------------------------------------------------------
> -
> > > > 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
> >
> >







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


Re: DAS configuration must specify ResultDescriptors

Posted by Amita Vadhavkar <am...@gmail.com>.
It will mostly be limitation of the driver - which one are you using? See
some below
links to get the driver from microsoft and the library details the use of
result set metadata.

*
http://www.microsoft.com/downloads/details.aspx?FamilyID=D09C1D60-A13C-4479-9B91-9E8B9D835CDC&displaylang=en-
download site

*http://msdn2.microsoft.com/hi-in/sql/Aa336346.aspx - SP2

*http://msdn2.microsoft.com/en-us/library/ms378760.aspx - driver class
supporting all
reqd methods

Regards,
Amita

On 11/2/07, Jason Clark <jc...@21csi.com> wrote:
>
> I updated my test to output all the information from the methods you
> listed
> below that required support.
>
> For my PK column, a simple id ID, it did not list information for the
> Column
> Table Name or the schema name. For all other columns, only the Schema name
> was not listed.
>
> Is this information I can correct in the database, or is it inherent to
> the
> database the JDBC driver is simply not supporting it?
>
> -Jason
>
> This e-mail and any files transmitted with it are intended solely for the
> use of the individual or entity to whom they are addressed.  If you have
> received this e-mail in error please notify the sender immediately and
> delete this e-mail from you system.  This message may contain company
> proprietary, sensitive information and is intended only for the individual
> named.  Its contents may be covered under the Trade Secret Act of various
> jurisdictions.  If you are not the named addressee you should not
> disseminate, distribute or copy this e-mail. If you are not the intended
> recipient you are notified that disclosing, copying, distributing or
> taking
> any action in reliance on the contents of this information is strictly
> prohibited.
>
> > -----Original Message-----
> > From: Amita Vadhavkar [mailto:amita.vadhavkar@gmail.com]
> > Sent: Wednesday, October 31, 2007 8:34 PM
> > To: tuscany-user@ws.apache.org
> > Subject: Re: DAS configuration must specify ResultDescriptors
> >
> > TUSCANY-1465 is the JIRA which added index to the <ResultDescriptor>
> > With that the physical order can be anything for <ResultDescriptor>
> > as long as index is used properly. This JIRA helps in specifying
> > result descriptor programmatically (i.e. not thru config file).
> > See DynamicResultDescriptorTests.java and
> > http://incubator.apache.org/tuscany/explicit-resultset-shape-
> > definition.html
> > .
> > This feature is part of latest DAS release - beta2.
> >
> > Prior to this fix, there was no index and as you say order is what
> matters
> > and not name in <ResultDescriptor.>
> >
> > As there is a column named ID in table CONTACTs, DAS following
> > conventions uses it as PK, now if it is really not unique in the
> database,
> > it can cause problems in DB->DataObject xfer. e.g. if you have 2 rows
> > having ID=1, and do select * from contact, then, the data graph obtained
> > by DAS will not be able to show both rows in its data objects.
> >
> > For using SQL Server 2005 express edition provided db metadata -
> > came across this url -
> > http://forum.java.sun.com/thread.jspa?threadID=704004&tstart=150
> >
> > So looks like there are some problems in the support when it comes to
> > supporting resultsetmetadata.
> > What needs to be working is
> > - getTableName(idx), getSchemaName(idx), getColumnCount(),
> > getColumnType(idx),
> > getColumnName(idx). If all these are working, then DAS will be able to
> use
> > the db metadata and will not need extra specification of
> ResultDescriptor
> > in
> > config file.  So, you can check if some driver for SQL Server is
> > supporting
> > all
> > these APIs and if you can use it. In that case, the <ResultDecriptor>
> can
> > go
> > away.
> >
> > Please let me know if this helps.
> >
> > Regards,
> > Amita
> >
> > On 11/1/07, Jason Clark <jc...@21csi.com> wrote:
> > >
> > > As a follow up, I wrote a simple class to test this.
> > >
> > > Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
> > > String conUrl = "jdbc:sqlserver://****************"
> > > Connection con = DriverManager.getConnection (conUrl);
> > >
> > > try {
> > >         Statement st = con.createStatement();
> > >         ResultSet rs = st.executeQuery("SELECT * FROM CONTACTS");
> > >         ResultSetMetaData md = rs.getMetaData();
> > >         int col = md.getColumnCount();
> > >         System.out.println("Number of Column : " + col);
> > >         System.out.println("Columns Name: ");
> > >         for (int i = 1; i <= col; i++) {
> > >                 String col_name = md.getColumnName(i);
> > >                 System.out.println(col_name);
> > >         }
> > > }
> > >
> > > This successfully returned metadata about my table.
> > >
> > > If I do this...
> > >
> > > <Command name="all contacts" SQL="select * from CONTACTS"
> kind="Select">
> > >
> > > <ResultDescriptor columnName="ID" tableName="CONTACTS"
> > > columnType="commonj.sdo.Int"/>
> > >
> > > <ResultDescriptor columnName="FIRST_NAME" tableName="CONTACTS"
> > > columnType="commonj.sdo.String"/>
> > >
> > > <ResultDescriptor columnName="LAST_NAME" tableName="CONTACTS"
> > > columnType="commonj.sdo.String"/>
> > >
> > > <ResultDescriptor columnName="MIDDLE_NAME" tableName="CONTACTS"
> > > columnType="commonj.sdo.String"/>
> > >
> > > </Command>
> > >
> > > I can then grab those columns, but I did notice the order is important
> > and
> > > the column name has nothing to do with the actual column name, it just
> > > says
> > > that the name you query the data object with is the word FIRST_NAME.
> It
> > > could be monkey, it doesn't matter. Not a problem though, but I can't
> > > figure
> > > out why I need result descriptors if I ResultSet.getMetaData () in
> fact
> > > returns the correct information.
> > >
> > > Any ideas?
> > >
> > > Thanks.
> > >
> > > -Jason
> > >
> > > > -----Original Message-----
> > > > From: Luciano Resende [mailto:luckbr1975@gmail.com ]
> > > > Sent: Tuesday, October 30, 2007 6:39 PM
> > > > To: tuscany-user@ws.apache.org
> > > > Subject: Re: DAS configuration must specify ResultDescriptors
> > > >
> > > > There are some databases that does not return metadata information,
> > > > and DAS need that to build the result SDO Graph.More info on
> > > > ResultDescriptor here [1].
> > > >
> > > > What database are you using ?
> > > >
> > > > [1] http://incubator.apache.org/tuscany/explicit-resultset-shape-
> > > > definition.html
> > > >
> > > > On 10/30/07, Jason Clark < jclark@21csi.com> wrote:
> > > > > I'm getting the following exception when trying to implement
> simple
> > > DAS
> > > > CRUD
> > > > > operations.
> > > > >
> > > > > Exception in thread "main" java.lang.RuntimeException: Unable to
> > > obtain
> > > > > table information from JDBC. DAS configuration must specify
> > > > > ResultDescriptors
> > > > >         at
> > > > >
> > > >
> > org.apache.tuscany.das.rdb.graphbuilder.impl.ResultMetadata
> .<init>(ResultM
> > > > et
> > > > > adata.java:81)
> > > > >         at
> > > > >
> > > > org.apache.tuscany.das.rdb.graphbuilder.impl.GraphBuilderMetadata
> > > .<init>(G
> > > > ra
> > > > > phBuilderMetadata.java :69)
> > > > >         at
> > > > >
> > > > org.apache.tuscany.das.rdb.impl.ReadCommandImpl.buildGraph
> > > (ReadCommandImpl
> > > > .j
> > > > > ava:295)
> > > > >         at
> > > > >
> > > >
> > org.apache.tuscany.das.rdb.impl.ReadCommandImpl.executeQuery
> (ReadCommandIm
> > > > pl
> > > > > .java:277)
> > > > >         at ContactDASTest.getContacts(ContactDASTest.java:22)
> > > > >         at ContactDASTest.printContacts(ContactDASTest.java:28)
> > > > >         at ContactDASTest.main(ContactDASTest.java:41)
> > > > >
> > > > >
> > > > >
> > > > > Given the following config. I tried following the Company example
> > and
> > > > their
> > > > > config.
> > > > >
> > > > > I'm unsure what a ResultDescriptor is and why I would need one,
> but
> > > the
> > > > > Company example does not.
> > > > >
> > > > > As a side note, my table is all strings stored in nvarchar
> columns.
> > Is
> > > > that
> > > > > part of the issue?
> > > > >
> > > > > It also does not have a primary key at the moment, but I'm not
> sure
> > > why
> > > > that
> > > > > would be a problem.
> > > > >
> > > > >
> > > > > <Config xmlns="http:///org.apache.tuscany.das.rdb/config.xsd">
> > > > >
> > > > >     <!--ConnectionInfo dataSource="java:comp/env/jdbc/dastest"/-->
> > > > >
> > > > >         <ConnectionInfo>
> > > > >                 <ConnectionProperties
> > > > >
> > > > > driverClass="com.microsoft.sqlserver.jdbc.SQLServerDriver"
> > > > >
> > > databaseURL="jdbc:sqlserver://*;databasename=*"
> > > > >                         userName="*"
> > > > >                         password="*"
> > > > >                         loginTimeout="600"/>
> > > > >         </ConnectionInfo>
> > > > >
> > > > >         <Command name="all contacts" SQL="select * from CONTACTS"
> > > > > kind="Select"/>
> > > > >
> > > > >     <Table tableName="CONTACTS">
> > > > >
> > > > >         </Table>
> > > > >
> > > > > </Config>
> > > > >
> > > > >
> > > > > -Jason Clark
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> --------------------------------------------------------------------
> > -
> > > > > 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://people.apache.org/%7Elresende>
> > > > 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
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > 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: DAS configuration must specify ResultDescriptors

Posted by Jason Clark <jc...@21csi.com>.
I updated my test to output all the information from the methods you listed
below that required support.

For my PK column, a simple id ID, it did not list information for the Column
Table Name or the schema name. For all other columns, only the Schema name
was not listed.

Is this information I can correct in the database, or is it inherent to the
database the JDBC driver is simply not supporting it?

-Jason
 
This e-mail and any files transmitted with it are intended solely for the
use of the individual or entity to whom they are addressed.  If you have
received this e-mail in error please notify the sender immediately and
delete this e-mail from you system.  This message may contain company
proprietary, sensitive information and is intended only for the individual
named.  Its contents may be covered under the Trade Secret Act of various
jurisdictions.  If you are not the named addressee you should not
disseminate, distribute or copy this e-mail. If you are not the intended
recipient you are notified that disclosing, copying, distributing or taking
any action in reliance on the contents of this information is strictly
prohibited.

> -----Original Message-----
> From: Amita Vadhavkar [mailto:amita.vadhavkar@gmail.com]
> Sent: Wednesday, October 31, 2007 8:34 PM
> To: tuscany-user@ws.apache.org
> Subject: Re: DAS configuration must specify ResultDescriptors
> 
> TUSCANY-1465 is the JIRA which added index to the <ResultDescriptor>
> With that the physical order can be anything for <ResultDescriptor>
> as long as index is used properly. This JIRA helps in specifying
> result descriptor programmatically (i.e. not thru config file).
> See DynamicResultDescriptorTests.java and
> http://incubator.apache.org/tuscany/explicit-resultset-shape-
> definition.html
> .
> This feature is part of latest DAS release - beta2.
> 
> Prior to this fix, there was no index and as you say order is what matters
> and not name in <ResultDescriptor.>
> 
> As there is a column named ID in table CONTACTs, DAS following
> conventions uses it as PK, now if it is really not unique in the database,
> it can cause problems in DB->DataObject xfer. e.g. if you have 2 rows
> having ID=1, and do select * from contact, then, the data graph obtained
> by DAS will not be able to show both rows in its data objects.
> 
> For using SQL Server 2005 express edition provided db metadata -
> came across this url -
> http://forum.java.sun.com/thread.jspa?threadID=704004&tstart=150
> 
> So looks like there are some problems in the support when it comes to
> supporting resultsetmetadata.
> What needs to be working is
> - getTableName(idx), getSchemaName(idx), getColumnCount(),
> getColumnType(idx),
> getColumnName(idx). If all these are working, then DAS will be able to use
> the db metadata and will not need extra specification of ResultDescriptor
> in
> config file.  So, you can check if some driver for SQL Server is
> supporting
> all
> these APIs and if you can use it. In that case, the <ResultDecriptor> can
> go
> away.
> 
> Please let me know if this helps.
> 
> Regards,
> Amita
> 
> On 11/1/07, Jason Clark <jc...@21csi.com> wrote:
> >
> > As a follow up, I wrote a simple class to test this.
> >
> > Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
> > String conUrl = "jdbc:sqlserver://****************"
> > Connection con = DriverManager.getConnection (conUrl);
> >
> > try {
> >         Statement st = con.createStatement();
> >         ResultSet rs = st.executeQuery("SELECT * FROM CONTACTS");
> >         ResultSetMetaData md = rs.getMetaData();
> >         int col = md.getColumnCount();
> >         System.out.println("Number of Column : " + col);
> >         System.out.println("Columns Name: ");
> >         for (int i = 1; i <= col; i++) {
> >                 String col_name = md.getColumnName(i);
> >                 System.out.println(col_name);
> >         }
> > }
> >
> > This successfully returned metadata about my table.
> >
> > If I do this...
> >
> > <Command name="all contacts" SQL="select * from CONTACTS" kind="Select">
> >
> > <ResultDescriptor columnName="ID" tableName="CONTACTS"
> > columnType="commonj.sdo.Int"/>
> >
> > <ResultDescriptor columnName="FIRST_NAME" tableName="CONTACTS"
> > columnType="commonj.sdo.String"/>
> >
> > <ResultDescriptor columnName="LAST_NAME" tableName="CONTACTS"
> > columnType="commonj.sdo.String"/>
> >
> > <ResultDescriptor columnName="MIDDLE_NAME" tableName="CONTACTS"
> > columnType="commonj.sdo.String"/>
> >
> > </Command>
> >
> > I can then grab those columns, but I did notice the order is important
> and
> > the column name has nothing to do with the actual column name, it just
> > says
> > that the name you query the data object with is the word FIRST_NAME. It
> > could be monkey, it doesn't matter. Not a problem though, but I can't
> > figure
> > out why I need result descriptors if I ResultSet.getMetaData () in fact
> > returns the correct information.
> >
> > Any ideas?
> >
> > Thanks.
> >
> > -Jason
> >
> > > -----Original Message-----
> > > From: Luciano Resende [mailto:luckbr1975@gmail.com ]
> > > Sent: Tuesday, October 30, 2007 6:39 PM
> > > To: tuscany-user@ws.apache.org
> > > Subject: Re: DAS configuration must specify ResultDescriptors
> > >
> > > There are some databases that does not return metadata information,
> > > and DAS need that to build the result SDO Graph.More info on
> > > ResultDescriptor here [1].
> > >
> > > What database are you using ?
> > >
> > > [1] http://incubator.apache.org/tuscany/explicit-resultset-shape-
> > > definition.html
> > >
> > > On 10/30/07, Jason Clark < jclark@21csi.com> wrote:
> > > > I'm getting the following exception when trying to implement simple
> > DAS
> > > CRUD
> > > > operations.
> > > >
> > > > Exception in thread "main" java.lang.RuntimeException: Unable to
> > obtain
> > > > table information from JDBC. DAS configuration must specify
> > > > ResultDescriptors
> > > >         at
> > > >
> > >
> org.apache.tuscany.das.rdb.graphbuilder.impl.ResultMetadata.<init>(ResultM
> > > et
> > > > adata.java:81)
> > > >         at
> > > >
> > > org.apache.tuscany.das.rdb.graphbuilder.impl.GraphBuilderMetadata
> > .<init>(G
> > > ra
> > > > phBuilderMetadata.java :69)
> > > >         at
> > > >
> > > org.apache.tuscany.das.rdb.impl.ReadCommandImpl.buildGraph
> > (ReadCommandImpl
> > > .j
> > > > ava:295)
> > > >         at
> > > >
> > >
> org.apache.tuscany.das.rdb.impl.ReadCommandImpl.executeQuery(ReadCommandIm
> > > pl
> > > > .java:277)
> > > >         at ContactDASTest.getContacts(ContactDASTest.java:22)
> > > >         at ContactDASTest.printContacts(ContactDASTest.java:28)
> > > >         at ContactDASTest.main(ContactDASTest.java:41)
> > > >
> > > >
> > > >
> > > > Given the following config. I tried following the Company example
> and
> > > their
> > > > config.
> > > >
> > > > I'm unsure what a ResultDescriptor is and why I would need one, but
> > the
> > > > Company example does not.
> > > >
> > > > As a side note, my table is all strings stored in nvarchar columns.
> Is
> > > that
> > > > part of the issue?
> > > >
> > > > It also does not have a primary key at the moment, but I'm not sure
> > why
> > > that
> > > > would be a problem.
> > > >
> > > >
> > > > <Config xmlns="http:///org.apache.tuscany.das.rdb/config.xsd">
> > > >
> > > >     <!--ConnectionInfo dataSource="java:comp/env/jdbc/dastest"/-->
> > > >
> > > >         <ConnectionInfo>
> > > >                 <ConnectionProperties
> > > >
> > > > driverClass="com.microsoft.sqlserver.jdbc.SQLServerDriver"
> > > >
> > databaseURL="jdbc:sqlserver://*;databasename=*"
> > > >                         userName="*"
> > > >                         password="*"
> > > >                         loginTimeout="600"/>
> > > >         </ConnectionInfo>
> > > >
> > > >         <Command name="all contacts" SQL="select * from CONTACTS"
> > > > kind="Select"/>
> > > >
> > > >     <Table tableName="CONTACTS">
> > > >
> > > >         </Table>
> > > >
> > > > </Config>
> > > >
> > > >
> > > > -Jason Clark
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > --------------------------------------------------------------------
> -
> > > > 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://people.apache.org/%7Elresende>
> > > 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
> >
> >
> >
> >
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > 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: DAS configuration must specify ResultDescriptors

Posted by Amita Vadhavkar <am...@gmail.com>.
TUSCANY-1465 is the JIRA which added index to the <ResultDescriptor>
With that the physical order can be anything for <ResultDescriptor>
as long as index is used properly. This JIRA helps in specifying
result descriptor programmatically (i.e. not thru config file).
See DynamicResultDescriptorTests.java and
http://incubator.apache.org/tuscany/explicit-resultset-shape-definition.html
.
This feature is part of latest DAS release - beta2.

Prior to this fix, there was no index and as you say order is what matters
and not name in <ResultDescriptor.>

As there is a column named ID in table CONTACTs, DAS following
conventions uses it as PK, now if it is really not unique in the database,
it can cause problems in DB->DataObject xfer. e.g. if you have 2 rows
having ID=1, and do select * from contact, then, the data graph obtained
by DAS will not be able to show both rows in its data objects.

For using SQL Server 2005 express edition provided db metadata -
came across this url -
http://forum.java.sun.com/thread.jspa?threadID=704004&tstart=150

So looks like there are some problems in the support when it comes to
supporting resultsetmetadata.
What needs to be working is
- getTableName(idx), getSchemaName(idx), getColumnCount(),
getColumnType(idx),
getColumnName(idx). If all these are working, then DAS will be able to use
the db metadata and will not need extra specification of ResultDescriptor in
config file.  So, you can check if some driver for SQL Server is supporting
all
these APIs and if you can use it. In that case, the <ResultDecriptor> can go
away.

Please let me know if this helps.

Regards,
Amita

On 11/1/07, Jason Clark <jc...@21csi.com> wrote:
>
> As a follow up, I wrote a simple class to test this.
>
> Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
> String conUrl = "jdbc:sqlserver://****************"
> Connection con = DriverManager.getConnection (conUrl);
>
> try {
>         Statement st = con.createStatement();
>         ResultSet rs = st.executeQuery("SELECT * FROM CONTACTS");
>         ResultSetMetaData md = rs.getMetaData();
>         int col = md.getColumnCount();
>         System.out.println("Number of Column : " + col);
>         System.out.println("Columns Name: ");
>         for (int i = 1; i <= col; i++) {
>                 String col_name = md.getColumnName(i);
>                 System.out.println(col_name);
>         }
> }
>
> This successfully returned metadata about my table.
>
> If I do this...
>
> <Command name="all contacts" SQL="select * from CONTACTS" kind="Select">
>
> <ResultDescriptor columnName="ID" tableName="CONTACTS"
> columnType="commonj.sdo.Int"/>
>
> <ResultDescriptor columnName="FIRST_NAME" tableName="CONTACTS"
> columnType="commonj.sdo.String"/>
>
> <ResultDescriptor columnName="LAST_NAME" tableName="CONTACTS"
> columnType="commonj.sdo.String"/>
>
> <ResultDescriptor columnName="MIDDLE_NAME" tableName="CONTACTS"
> columnType="commonj.sdo.String"/>
>
> </Command>
>
> I can then grab those columns, but I did notice the order is important and
> the column name has nothing to do with the actual column name, it just
> says
> that the name you query the data object with is the word FIRST_NAME. It
> could be monkey, it doesn't matter. Not a problem though, but I can't
> figure
> out why I need result descriptors if I ResultSet.getMetaData () in fact
> returns the correct information.
>
> Any ideas?
>
> Thanks.
>
> -Jason
>
> > -----Original Message-----
> > From: Luciano Resende [mailto:luckbr1975@gmail.com ]
> > Sent: Tuesday, October 30, 2007 6:39 PM
> > To: tuscany-user@ws.apache.org
> > Subject: Re: DAS configuration must specify ResultDescriptors
> >
> > There are some databases that does not return metadata information,
> > and DAS need that to build the result SDO Graph.More info on
> > ResultDescriptor here [1].
> >
> > What database are you using ?
> >
> > [1] http://incubator.apache.org/tuscany/explicit-resultset-shape-
> > definition.html
> >
> > On 10/30/07, Jason Clark < jclark@21csi.com> wrote:
> > > I'm getting the following exception when trying to implement simple
> DAS
> > CRUD
> > > operations.
> > >
> > > Exception in thread "main" java.lang.RuntimeException: Unable to
> obtain
> > > table information from JDBC. DAS configuration must specify
> > > ResultDescriptors
> > >         at
> > >
> > org.apache.tuscany.das.rdb.graphbuilder.impl.ResultMetadata.<init>(ResultM
> > et
> > > adata.java:81)
> > >         at
> > >
> > org.apache.tuscany.das.rdb.graphbuilder.impl.GraphBuilderMetadata
> .<init>(G
> > ra
> > > phBuilderMetadata.java :69)
> > >         at
> > >
> > org.apache.tuscany.das.rdb.impl.ReadCommandImpl.buildGraph
> (ReadCommandImpl
> > .j
> > > ava:295)
> > >         at
> > >
> > org.apache.tuscany.das.rdb.impl.ReadCommandImpl.executeQuery(ReadCommandIm
> > pl
> > > .java:277)
> > >         at ContactDASTest.getContacts(ContactDASTest.java:22)
> > >         at ContactDASTest.printContacts(ContactDASTest.java:28)
> > >         at ContactDASTest.main(ContactDASTest.java:41)
> > >
> > >
> > >
> > > Given the following config. I tried following the Company example and
> > their
> > > config.
> > >
> > > I'm unsure what a ResultDescriptor is and why I would need one, but
> the
> > > Company example does not.
> > >
> > > As a side note, my table is all strings stored in nvarchar columns. Is
> > that
> > > part of the issue?
> > >
> > > It also does not have a primary key at the moment, but I'm not sure
> why
> > that
> > > would be a problem.
> > >
> > >
> > > <Config xmlns="http:///org.apache.tuscany.das.rdb/config.xsd">
> > >
> > >     <!--ConnectionInfo dataSource="java:comp/env/jdbc/dastest"/-->
> > >
> > >         <ConnectionInfo>
> > >                 <ConnectionProperties
> > >
> > > driverClass="com.microsoft.sqlserver.jdbc.SQLServerDriver"
> > >
> databaseURL="jdbc:sqlserver://*;databasename=*"
> > >                         userName="*"
> > >                         password="*"
> > >                         loginTimeout="600"/>
> > >         </ConnectionInfo>
> > >
> > >         <Command name="all contacts" SQL="select * from CONTACTS"
> > > kind="Select"/>
> > >
> > >     <Table tableName="CONTACTS">
> > >
> > >         </Table>
> > >
> > > </Config>
> > >
> > >
> > > -Jason Clark
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > 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://people.apache.org/%7Elresende>
> > 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
>
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-user-help@ws.apache.org
>
>

RE: DAS configuration must specify ResultDescriptors

Posted by Jason Clark <jc...@21csi.com>.
It does have a Primary Key. That was the first problem we had, so we updated
the database. It works now, but only if we specify ResultDescriptors.

-Jason
 
This e-mail and any files transmitted with it are intended solely for the
use of the individual or entity to whom they are addressed.  If you have
received this e-mail in error please notify the sender immediately and
delete this e-mail from you system.  This message may contain company
proprietary, sensitive information and is intended only for the individual
named.  Its contents may be covered under the Trade Secret Act of various
jurisdictions.  If you are not the named addressee you should not
disseminate, distribute or copy this e-mail. If you are not the intended
recipient you are notified that disclosing, copying, distributing or taking
any action in reliance on the contents of this information is strictly
prohibited.

> -----Original Message-----
> From: Amita Vadhavkar [mailto:amita.vadhavkar@gmail.com]
> Sent: Tuesday, October 30, 2007 7:47 PM
> To: tuscany-user@ws.apache.org
> Subject: Re: DAS configuration must specify ResultDescriptors
> 
> Also, please see if the table can have a logical Primary Key. DAS can
> identify unique DB records and thus unique Data Objects
> only based on Primary Key. One can be specified in the DAS Config <Table>
> section. If it is not specified but the table has a column
> id (ignore case), it is considered as PK by some basic convention that DAS
> follows.  Without a PK (either from table column name
> as ID or from DAS config), DAS query will not be able to give correct
> results and will throw exception about missing PK.
> 
> Regards,
> Amita
> 
> On 10/31/07, Luciano Resende <lu...@gmail.com> wrote:
> >
> > There are some databases that does not return metadata information,
> > and DAS need that to build the result SDO Graph.More info on
> > ResultDescriptor here [1].
> >
> > What database are you using ?
> >
> > [1]
> > http://incubator.apache.org/tuscany/explicit-resultset-shape-
> definition.html
> >
> > On 10/30/07, Jason Clark <jc...@21csi.com> wrote:
> > > I'm getting the following exception when trying to implement simple
> DAS
> > CRUD
> > > operations.
> > >
> > > Exception in thread "main" java.lang.RuntimeException: Unable to
> obtain
> > > table information from JDBC. DAS configuration must specify
> > > ResultDescriptors
> > >         at
> > > org.apache.tuscany.das.rdb.graphbuilder.impl.ResultMetadata
> > .<init>(ResultMet
> > > adata.java:81)
> > >         at
> > > org.apache.tuscany.das.rdb.graphbuilder.impl.GraphBuilderMetadata
> > .<init>(Gra
> > > phBuilderMetadata.java:69)
> > >         at
> > > org.apache.tuscany.das.rdb.impl.ReadCommandImpl.buildGraph(
> > ReadCommandImpl.j
> > > ava:295)
> > >         at
> > > org.apache.tuscany.das.rdb.impl.ReadCommandImpl.executeQuery
> > (ReadCommandImpl
> > > .java:277)
> > >         at ContactDASTest.getContacts(ContactDASTest.java:22)
> > >         at ContactDASTest.printContacts(ContactDASTest.java:28)
> > >         at ContactDASTest.main(ContactDASTest.java:41)
> > >
> > >
> > >
> > > Given the following config. I tried following the Company example and
> > their
> > > config.
> > >
> > > I'm unsure what a ResultDescriptor is and why I would need one, but
> the
> > > Company example does not.
> > >
> > > As a side note, my table is all strings stored in nvarchar columns. Is
> > that
> > > part of the issue?
> > >
> > > It also does not have a primary key at the moment, but I'm not sure
> why
> > that
> > > would be a problem.
> > >
> > >
> > > <Config xmlns="http:///org.apache.tuscany.das.rdb/config.xsd">
> > >
> > >     <!--ConnectionInfo dataSource="java:comp/env/jdbc/dastest"/-->
> > >
> > >         <ConnectionInfo>
> > >                 <ConnectionProperties
> > >
> > > driverClass="com.microsoft.sqlserver.jdbc.SQLServerDriver"
> > >
> databaseURL="jdbc:sqlserver://*;databasename=*"
> > >                         userName="*"
> > >                         password="*"
> > >                         loginTimeout="600"/>
> > >         </ConnectionInfo>
> > >
> > >         <Command name="all contacts" SQL="select * from CONTACTS"
> > > kind="Select"/>
> > >
> > >     <Table tableName="CONTACTS">
> > >
> > >         </Table>
> > >
> > > </Config>
> > >
> > >
> > > -Jason Clark
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > 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
> >
> >







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


Re: DAS configuration must specify ResultDescriptors

Posted by Amita Vadhavkar <am...@gmail.com>.
Also, please see if the table can have a logical Primary Key. DAS can
identify unique DB records and thus unique Data Objects
only based on Primary Key. One can be specified in the DAS Config <Table>
section. If it is not specified but the table has a column
id (ignore case), it is considered as PK by some basic convention that DAS
follows.  Without a PK (either from table column name
as ID or from DAS config), DAS query will not be able to give correct
results and will throw exception about missing PK.

Regards,
Amita

On 10/31/07, Luciano Resende <lu...@gmail.com> wrote:
>
> There are some databases that does not return metadata information,
> and DAS need that to build the result SDO Graph.More info on
> ResultDescriptor here [1].
>
> What database are you using ?
>
> [1]
> http://incubator.apache.org/tuscany/explicit-resultset-shape-definition.html
>
> On 10/30/07, Jason Clark <jc...@21csi.com> wrote:
> > I'm getting the following exception when trying to implement simple DAS
> CRUD
> > operations.
> >
> > Exception in thread "main" java.lang.RuntimeException: Unable to obtain
> > table information from JDBC. DAS configuration must specify
> > ResultDescriptors
> >         at
> > org.apache.tuscany.das.rdb.graphbuilder.impl.ResultMetadata
> .<init>(ResultMet
> > adata.java:81)
> >         at
> > org.apache.tuscany.das.rdb.graphbuilder.impl.GraphBuilderMetadata
> .<init>(Gra
> > phBuilderMetadata.java:69)
> >         at
> > org.apache.tuscany.das.rdb.impl.ReadCommandImpl.buildGraph(
> ReadCommandImpl.j
> > ava:295)
> >         at
> > org.apache.tuscany.das.rdb.impl.ReadCommandImpl.executeQuery
> (ReadCommandImpl
> > .java:277)
> >         at ContactDASTest.getContacts(ContactDASTest.java:22)
> >         at ContactDASTest.printContacts(ContactDASTest.java:28)
> >         at ContactDASTest.main(ContactDASTest.java:41)
> >
> >
> >
> > Given the following config. I tried following the Company example and
> their
> > config.
> >
> > I'm unsure what a ResultDescriptor is and why I would need one, but the
> > Company example does not.
> >
> > As a side note, my table is all strings stored in nvarchar columns. Is
> that
> > part of the issue?
> >
> > It also does not have a primary key at the moment, but I'm not sure why
> that
> > would be a problem.
> >
> >
> > <Config xmlns="http:///org.apache.tuscany.das.rdb/config.xsd">
> >
> >     <!--ConnectionInfo dataSource="java:comp/env/jdbc/dastest"/-->
> >
> >         <ConnectionInfo>
> >                 <ConnectionProperties
> >
> > driverClass="com.microsoft.sqlserver.jdbc.SQLServerDriver"
> >                         databaseURL="jdbc:sqlserver://*;databasename=*"
> >                         userName="*"
> >                         password="*"
> >                         loginTimeout="600"/>
> >         </ConnectionInfo>
> >
> >         <Command name="all contacts" SQL="select * from CONTACTS"
> > kind="Select"/>
> >
> >     <Table tableName="CONTACTS">
> >
> >         </Table>
> >
> > </Config>
> >
> >
> > -Jason Clark
> >
> >
> >
> >
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > 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: DAS configuration must specify ResultDescriptors

Posted by Jason Clark <jc...@21csi.com>.
I am currently connected to SQL Server 2005 express edition.

-Jason
 
> -----Original Message-----
> From: Luciano Resende [mailto:luckbr1975@gmail.com]
> Sent: Tuesday, October 30, 2007 6:39 PM
> To: tuscany-user@ws.apache.org
> Subject: Re: DAS configuration must specify ResultDescriptors
> 
> There are some databases that does not return metadata information,
> and DAS need that to build the result SDO Graph.More info on
> ResultDescriptor here [1].
> 
> What database are you using ?
> 
> [1] http://incubator.apache.org/tuscany/explicit-resultset-shape-
> definition.html
> 
> On 10/30/07, Jason Clark <jc...@21csi.com> wrote:
> > I'm getting the following exception when trying to implement simple DAS
> CRUD
> > operations.
> >
> > Exception in thread "main" java.lang.RuntimeException: Unable to obtain
> > table information from JDBC. DAS configuration must specify
> > ResultDescriptors
> >         at
> >
> org.apache.tuscany.das.rdb.graphbuilder.impl.ResultMetadata.<init>(ResultM
> et
> > adata.java:81)
> >         at
> >
> org.apache.tuscany.das.rdb.graphbuilder.impl.GraphBuilderMetadata.<init>(G
> ra
> > phBuilderMetadata.java:69)
> >         at
> >
> org.apache.tuscany.das.rdb.impl.ReadCommandImpl.buildGraph(ReadCommandImpl
> .j
> > ava:295)
> >         at
> >
> org.apache.tuscany.das.rdb.impl.ReadCommandImpl.executeQuery(ReadCommandIm
> pl
> > .java:277)
> >         at ContactDASTest.getContacts(ContactDASTest.java:22)
> >         at ContactDASTest.printContacts(ContactDASTest.java:28)
> >         at ContactDASTest.main(ContactDASTest.java:41)
> >
> >
> >
> > Given the following config. I tried following the Company example and
> their
> > config.
> >
> > I'm unsure what a ResultDescriptor is and why I would need one, but the
> > Company example does not.
> >
> > As a side note, my table is all strings stored in nvarchar columns. Is
> that
> > part of the issue?
> >
> > It also does not have a primary key at the moment, but I'm not sure why
> that
> > would be a problem.
> >
> >
> > <Config xmlns="http:///org.apache.tuscany.das.rdb/config.xsd">
> >
> >     <!--ConnectionInfo dataSource="java:comp/env/jdbc/dastest"/-->
> >
> >         <ConnectionInfo>
> >                 <ConnectionProperties
> >
> > driverClass="com.microsoft.sqlserver.jdbc.SQLServerDriver"
> >                         databaseURL="jdbc:sqlserver://*;databasename=*"
> >                         userName="*"
> >                         password="*"
> >                         loginTimeout="600"/>
> >         </ConnectionInfo>
> >
> >         <Command name="all contacts" SQL="select * from CONTACTS"
> > kind="Select"/>
> >
> >     <Table tableName="CONTACTS">
> >
> >         </Table>
> >
> > </Config>
> >
> >
> > -Jason Clark
> >
> >
> >
> >
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > 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








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


RE: DAS configuration must specify ResultDescriptors

Posted by Jason Clark <jc...@21csi.com>.
As a follow up, I wrote a simple class to test this.

Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
String conUrl = "jdbc:sqlserver://****************"
Connection con = DriverManager.getConnection(conUrl);
            
try {
	Statement st = con.createStatement();
	ResultSet rs = st.executeQuery("SELECT * FROM CONTACTS");
	ResultSetMetaData md = rs.getMetaData();
	int col = md.getColumnCount();
	System.out.println("Number of Column : " + col);
	System.out.println("Columns Name: ");
	for (int i = 1; i <= col; i++) {
		String col_name = md.getColumnName(i);
		System.out.println(col_name);
	}
}

This successfully returned metadata about my table.

If I do this...

<Command name="all contacts" SQL="select * from CONTACTS" kind="Select">

<ResultDescriptor columnName="ID" tableName="CONTACTS"
columnType="commonj.sdo.Int"/>

<ResultDescriptor columnName="FIRST_NAME" tableName="CONTACTS"
columnType="commonj.sdo.String"/>

<ResultDescriptor columnName="LAST_NAME" tableName="CONTACTS"
columnType="commonj.sdo.String"/>

<ResultDescriptor columnName="MIDDLE_NAME" tableName="CONTACTS"
columnType="commonj.sdo.String"/>

</Command>

I can then grab those columns, but I did notice the order is important and
the column name has nothing to do with the actual column name, it just says
that the name you query the data object with is the word FIRST_NAME. It
could be monkey, it doesn't matter. Not a problem though, but I can't figure
out why I need result descriptors if I ResultSet.getMetaData() in fact
returns the correct information.

Any ideas?

Thanks.

-Jason
 
> -----Original Message-----
> From: Luciano Resende [mailto:luckbr1975@gmail.com]
> Sent: Tuesday, October 30, 2007 6:39 PM
> To: tuscany-user@ws.apache.org
> Subject: Re: DAS configuration must specify ResultDescriptors
> 
> There are some databases that does not return metadata information,
> and DAS need that to build the result SDO Graph.More info on
> ResultDescriptor here [1].
> 
> What database are you using ?
> 
> [1] http://incubator.apache.org/tuscany/explicit-resultset-shape-
> definition.html
> 
> On 10/30/07, Jason Clark <jc...@21csi.com> wrote:
> > I'm getting the following exception when trying to implement simple DAS
> CRUD
> > operations.
> >
> > Exception in thread "main" java.lang.RuntimeException: Unable to obtain
> > table information from JDBC. DAS configuration must specify
> > ResultDescriptors
> >         at
> >
> org.apache.tuscany.das.rdb.graphbuilder.impl.ResultMetadata.<init>(ResultM
> et
> > adata.java:81)
> >         at
> >
> org.apache.tuscany.das.rdb.graphbuilder.impl.GraphBuilderMetadata.<init>(G
> ra
> > phBuilderMetadata.java:69)
> >         at
> >
> org.apache.tuscany.das.rdb.impl.ReadCommandImpl.buildGraph(ReadCommandImpl
> .j
> > ava:295)
> >         at
> >
> org.apache.tuscany.das.rdb.impl.ReadCommandImpl.executeQuery(ReadCommandIm
> pl
> > .java:277)
> >         at ContactDASTest.getContacts(ContactDASTest.java:22)
> >         at ContactDASTest.printContacts(ContactDASTest.java:28)
> >         at ContactDASTest.main(ContactDASTest.java:41)
> >
> >
> >
> > Given the following config. I tried following the Company example and
> their
> > config.
> >
> > I'm unsure what a ResultDescriptor is and why I would need one, but the
> > Company example does not.
> >
> > As a side note, my table is all strings stored in nvarchar columns. Is
> that
> > part of the issue?
> >
> > It also does not have a primary key at the moment, but I'm not sure why
> that
> > would be a problem.
> >
> >
> > <Config xmlns="http:///org.apache.tuscany.das.rdb/config.xsd">
> >
> >     <!--ConnectionInfo dataSource="java:comp/env/jdbc/dastest"/-->
> >
> >         <ConnectionInfo>
> >                 <ConnectionProperties
> >
> > driverClass="com.microsoft.sqlserver.jdbc.SQLServerDriver"
> >                         databaseURL="jdbc:sqlserver://*;databasename=*"
> >                         userName="*"
> >                         password="*"
> >                         loginTimeout="600"/>
> >         </ConnectionInfo>
> >
> >         <Command name="all contacts" SQL="select * from CONTACTS"
> > kind="Select"/>
> >
> >     <Table tableName="CONTACTS">
> >
> >         </Table>
> >
> > </Config>
> >
> >
> > -Jason Clark
> >
> >
> >
> >
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > 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








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


Re: DAS configuration must specify ResultDescriptors

Posted by Luciano Resende <lu...@gmail.com>.
There are some databases that does not return metadata information,
and DAS need that to build the result SDO Graph.More info on
ResultDescriptor here [1].

What database are you using ?

[1] http://incubator.apache.org/tuscany/explicit-resultset-shape-definition.html

On 10/30/07, Jason Clark <jc...@21csi.com> wrote:
> I'm getting the following exception when trying to implement simple DAS CRUD
> operations.
>
> Exception in thread "main" java.lang.RuntimeException: Unable to obtain
> table information from JDBC. DAS configuration must specify
> ResultDescriptors
>         at
> org.apache.tuscany.das.rdb.graphbuilder.impl.ResultMetadata.<init>(ResultMet
> adata.java:81)
>         at
> org.apache.tuscany.das.rdb.graphbuilder.impl.GraphBuilderMetadata.<init>(Gra
> phBuilderMetadata.java:69)
>         at
> org.apache.tuscany.das.rdb.impl.ReadCommandImpl.buildGraph(ReadCommandImpl.j
> ava:295)
>         at
> org.apache.tuscany.das.rdb.impl.ReadCommandImpl.executeQuery(ReadCommandImpl
> .java:277)
>         at ContactDASTest.getContacts(ContactDASTest.java:22)
>         at ContactDASTest.printContacts(ContactDASTest.java:28)
>         at ContactDASTest.main(ContactDASTest.java:41)
>
>
>
> Given the following config. I tried following the Company example and their
> config.
>
> I'm unsure what a ResultDescriptor is and why I would need one, but the
> Company example does not.
>
> As a side note, my table is all strings stored in nvarchar columns. Is that
> part of the issue?
>
> It also does not have a primary key at the moment, but I'm not sure why that
> would be a problem.
>
>
> <Config xmlns="http:///org.apache.tuscany.das.rdb/config.xsd">
>
>     <!--ConnectionInfo dataSource="java:comp/env/jdbc/dastest"/-->
>
>         <ConnectionInfo>
>                 <ConnectionProperties
>
> driverClass="com.microsoft.sqlserver.jdbc.SQLServerDriver"
>                         databaseURL="jdbc:sqlserver://*;databasename=*"
>                         userName="*"
>                         password="*"
>                         loginTimeout="600"/>
>         </ConnectionInfo>
>
>         <Command name="all contacts" SQL="select * from CONTACTS"
> kind="Select"/>
>
>     <Table tableName="CONTACTS">
>
>         </Table>
>
> </Config>
>
>
> -Jason Clark
>
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> 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