cancel
Showing results for 
Search instead for 
Did you mean: 

getting table column constraints with odbc

Former Member
0 Kudos

Hi,

I already asked this question recently on stackoverflow (http://stackoverflow.com/questions/14012537/odbcdataadapter-fillschema-calculates-wrong-maxlength-va...) but without much success, and think it might possibly be a (known?) problem with the MaxDB ODBC driver.

I want to access my MaxDB using ODBC using the 64 bit unicode SAP MaxDB driver (version 7.08.02.28, SDBODBCW.DLL). While accessing data seems to work fine (I can perform all CRUD operations), I do have a problem when I want to create an XSD schema file for a database table using .Net DataSets.

The coding looks as follows:

DataSet ds = new DataSet();
Connection con = new OdbcConnection(connectionString);
string tablename = "sometable";
...
OdbcDataAdapter adapter = new OdbcDataAdapter("select * from " + tablename, con);
adapter
.FillSchema(ds, SchemaType.Source);
adapter
.Fill(ds,tablename);
ds
.WriteXmlSchema(tablename+".xsd");

and compiles and runs without any complaint, but in the resulting xsd file the maxLength values for the items are about half of the actual size of the corresponding columns, that is, if I have a UNICODE char(15) field in the database, the corresponding tag in the xsd looks as follows:

<xs:maxLength value="7" />

The wrong value is already present in the DataSet. Is this possibly a known issue? Since I'm new to ODBC and .Net DataSets I'm having difficulties to figure out where to start an analysis of this problem, any hints for this would also be higly appreciated.

Thanks in advance and kind regards (and merry XMas 😉

Thomas

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello Thomas,

could you please post the table definition with the code attributes. You can use

the commandline tool sqlcli for this

>sqlcli -d <dbname> -u <username>,<password> \dc <tablename>

Kind regards,

Burkhard