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:[EMAIL PROTECTED]
> Sent: Tuesday, October 30, 2007 6:39 PM
> To: [email protected]
> 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 <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> 
> 
> --
> Luciano Resende
> Apache Tuscany Committer
> http://people.apache.org/~lresende
> http://lresende.blogspot.com/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]








---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to