Skip to main content

XML examples for DataSet API

7 replies [Last post]
Anonymous

Hi,

Are there any examples of jdnc XML markup for the DataSet API (eg:
something like the JDNC markup tutorial except using a JDBC datasource
instead of a tab-delimited file)?

Thanks

Steve Hannah

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net
For additional commands, e-mail: jdnc-help@jdnc.dev.java.net

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Steve Hannah

On 25-Mar-05, at 1:24 AM, Patrick Wright wrote:

> Steve
>
> What is your working scenario?
>
>

At this point I'm just trying to get a feel for what I would need to do
to create a database application using markup. Here's a simple case:

1) I want to display the contents of a single table from a mysql
database. The parameters for this table are as follows:
DB_HOST: myhost.com
DB_NAME: mydb
DB_USERNAME: username
DB_PASSWORD: password
DB_TABLENAME: weather

The columns of the weather table are:
cityname: VARCHAR
temperature: DECIMAL(4,2)
lastupdated: datetime

How would i display this table with
a) embedding the connection information into the jdnc page.
b) using a more secure authentication method, like having the user log
in in the application.

Basically any example using a JDBC connection would help out a lot ---
just to see how it would work.

Thanks for your time.

Steve Hannah

>
> If you use markup for this, you could specify just the metadata +
> query, then expect the user to log in manually from the application;
> or you might be using a generic login for non-protected data.
>
> Also, do you want to map one or multiple result sets? Do you need
> inter-table relations? Selection management?
>
> Depending on how much you want to include in the markup, there would
> be different markup mapping needed. My guess is to start we could map
> metadata (read from a schema), and SQLDataProvider (for driver and
> query).
>
> Right now, not knowing exactly how the markup stuff works, but
> browsing around, it doesn't look like there is a mapping for the
> DataSet API from JDNC markup; seems like we could create one by
> bouncing off of some of the existing mappins--but some
> scenarios/use-cases would be good to guide us.
>
> Any markup specialists on the list want to comment on, in general,
> what is needed?
>
>
> Patrick
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net
> For additional commands, e-mail: jdnc-help@jdnc.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net
For additional commands, e-mail: jdnc-help@jdnc.dev.java.net

Patrick Wright

Hi Steve

We need to take this step by step. The markup is not currently mapped
for DataSet, so we'd need to figure out what needs to be added, and
then how to do it. It should be a matter (in theory) of adding a
mapping file for the new markup. hahahaha! Sure.

OK. So, you download this markup file. First, do you want to connect
to your database from your client, or do you want to host a mysql
server listening over http?

If you want to query right from your client, you'll need to include
the mysql driver in your package, and then we'll need to construct a
JDBCDataConnection using that driver, with a SQLDataProvider to wrap
it for the query.

The JDBCDataConnection can be instantiated with a blank user and
password; it won't connect until we issue the setConnected(). If you
want to prompt your user for login, you can do that, then set the user
name and password, then connect.

The SQLDataProvider also needs the table name you're querying against,
with no where clause. There's a constructor for that.

We also need the DataSet metadata, which in this case has your column
names. The default operation of the SQLDataProvider is to query for
all columns, then to only read those in the metadata (there's a TODO
on TableCommand to only pull columns in metadata, ignore that for
now).

So, we have something like
DataSet
DataTable
tablename=weather
columns=city, temperature, lastupdated
DataProvider=SQLDataProvider
DataConnection=JDBCDataConnection
driver={mysql driver name}
url={database url for mysql driver}

Before we figure out the ungodly xmlschemamess necessary to map this,
do you have a running example using the classes as listed that works?
Once you have that, we can try to swap in one piece at a time in the
markup.

I may well have missed something...

Patrick

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net
For additional commands, e-mail: jdnc-help@jdnc.dev.java.net

Patrick Wright

Steve

Are you looking for docs on the XML schema for DataSet, or on how to
specify a DataSet as a component in the JDNC markup?

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net
For additional commands, e-mail: jdnc-help@jdnc.dev.java.net

Steve Hannah

How to specify a DataSet as a component in the JDNC markup.

for example, the JDNC markup tutorial shows the following tags to
display a table based on a tab-delimited (data/weather.txt) file:


xmlns="http://www.jdesktop.org/2004/05/jdnc">


How would I modify this to have the table load data from a JDBC source?

Thanks and Best regards

Steve Hannah
On 24-Mar-05, at 9:52 AM, Patrick Wright wrote:

> Steve
>
> Are you looking for docs on the XML schema for DataSet, or on how to
> specify a DataSet as a component in the JDNC markup?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net
> For additional commands, e-mail: jdnc-help@jdnc.dev.java.net
>
[att1.dat]

Patrick Wright

Steve

What is your working scenario?

There are a few different items you need to specify to get a complete
JDBC result set (or more than one)
- driver
- connection parameters (minus login)
- login
- query
- metadata

If you use markup for this, you could specify just the metadata +
query, then expect the user to log in manually from the application;
or you might be using a generic login for non-protected data.

Also, do you want to map one or multiple result sets? Do you need
inter-table relations? Selection management?

Depending on how much you want to include in the markup, there would
be different markup mapping needed. My guess is to start we could map
metadata (read from a schema), and SQLDataProvider (for driver and
query).

Right now, not knowing exactly how the markup stuff works, but
browsing around, it doesn't look like there is a mapping for the
DataSet API from JDNC markup; seems like we could create one by
bouncing off of some of the existing mappins--but some
scenarios/use-cases would be good to guide us.

Any markup specialists on the list want to comment on, in general,
what is needed?

Patrick

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net
For additional commands, e-mail: jdnc-help@jdnc.dev.java.net

Richard Bair

>Right now, not knowing exactly how the markup stuff works, but
>browsing around, it doesn't look like there is a mapping for the
>DataSet API from JDNC markup; seems like we could create one by
>bouncing off of some of the existing mappins--but some
>scenarios/use-cases would be good to guide us.

Right now the schema file describing the dataset is an entirely different
file from the markup. Personally, I think it might be better to simply put a
link in the JDNC markup referencing the schema file, instead of embedding
it. I haven't played around much with our markup, but I suspect it should be
trivial to read that link and create a DataSet instance when realizing the
markup.

Richard

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net
For additional commands, e-mail: jdnc-help@jdnc.dev.java.net

Patrick Wright

Richard

I think that's half of it. The other half which I read from Steve's
question is--for a text file, you can just specify the file name, and
it gets loaded into a tabular data model. There's currently no way to
load a DataSet from a query specified in markup--at least, that's how
I understood the question. Waiting to hear what Steve's use cases are.

-Patrick

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net
For additional commands, e-mail: jdnc-help@jdnc.dev.java.net