dbunit and sybase

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

dbunit and sybase

mmistroni
hi all,
 i m trying to figure out how to use dbunit for sybase..
currently,  at work, we are connecting to a  datasource like this
jdbc:xx:locahost:port

and in the code, whenever we have to do jbdc calls (even for tests),
we specify the datbase name
currently we are testing using jdbcTEmplate for inserting data, but i
want to move everything to dbunit

the only problem, we are connecting to 3 different databases (in
sybase's term, we use 3 differetn schemas)
and i want to avoid to hardcode anything

i tried to connect to url   jdbc:xx:host:port, but if i do this sybase
will connect me to a default database for
the user i m using to login (which is only one of the three to which
we are connecting to)


i was wondering if there's anyone there on thelist which is in the
same situation, and how is he/she connecting
to the db with dbunit..?

anyone could help?

thanks an dregards
 marco

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user
Reply | Threaded
Open this post in threaded view
|

Re: dbunit and sybase

John Hurst-2
I generally control the specifics of the database connection (URL,
user, password) using system properties. Then e.g. from Ant I can
override the properties when I run a test suite either with -D options
or by putting them in build.local.properties.

Will that work for you?

John Hurst

Wellington, New Zealand


On Nov 11, 2007 2:43 AM, Marco Mistroni <[hidden email]> wrote:

> hi all,
>  i m trying to figure out how to use dbunit for sybase..
> currently,  at work, we are connecting to a  datasource like this
> jdbc:xx:locahost:port
>
> and in the code, whenever we have to do jbdc calls (even for tests),
> we specify the datbase name
> currently we are testing using jdbcTEmplate for inserting data, but i
> want to move everything to dbunit
>
> the only problem, we are connecting to 3 different databases (in
> sybase's term, we use 3 differetn schemas)
> and i want to avoid to hardcode anything
>
> i tried to connect to url   jdbc:xx:host:port, but if i do this sybase
> will connect me to a default database for
> the user i m using to login (which is only one of the three to which
> we are connecting to)
>
>
> i was wondering if there's anyone there on thelist which is in the
> same situation, and how is he/she connecting
> to the db with dbunit..?
>
> anyone could help?
>
> thanks an dregards
>  marco
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems?  Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> dbunit-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/dbunit-user
>

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user
Reply | Threaded
Open this post in threaded view
|

Re: dbunit and sybase

mmistroni
John,
 the problem is that we are connecting to 3 different databases at the
same time.
we have properties (As name of dbs are different in different hosts),
but this does
not save me from the fact that within our tests we need tobe able to connect to
3 different 'schemas'  (as sybase called them)

so, my setup is that i havfe a db running at    myhost:port,  under which i have
- db1
- db2
- db3

i want to create a base DbUnitTest file, but the connection is screwing me up..
best idea that came to my mind was to have, in my DbUnit test a method like this

public abstract getXmlSources(String xmlSourceDataPath, String dbName)

so that in my dbunit test i can insert data in the proper database.
I am using spring and a DriverManagerDataSource, i was hoping to
configure only one
DriverManagerDataSource and be able, somehow, to insert data in 3
different 'sybase db', but that looks unlikely..
so i'd have to resort to instantiate (for now) connection myself some how..

thanks for your feedback and regards
 Marco




On Nov 10, 2007 8:32 PM, John Hurst <[hidden email]> wrote:

> I generally control the specifics of the database connection (URL,
> user, password) using system properties. Then e.g. from Ant I can
> override the properties when I run a test suite either with -D options
> or by putting them in build.local.properties.
>
> Will that work for you?
>
> John Hurst
>
> Wellington, New Zealand
>
>
>
> On Nov 11, 2007 2:43 AM, Marco Mistroni <[hidden email]> wrote:
> > hi all,
> >  i m trying to figure out how to use dbunit for sybase..
> > currently,  at work, we are connecting to a  datasource like this
> > jdbc:xx:locahost:port
> >
> > and in the code, whenever we have to do jbdc calls (even for tests),
> > we specify the datbase name
> > currently we are testing using jdbcTEmplate for inserting data, but i
> > want to move everything to dbunit
> >
> > the only problem, we are connecting to 3 different databases (in
> > sybase's term, we use 3 differetn schemas)
> > and i want to avoid to hardcode anything
> >
> > i tried to connect to url   jdbc:xx:host:port, but if i do this sybase
> > will connect me to a default database for
> > the user i m using to login (which is only one of the three to which
> > we are connecting to)
> >
> >
> > i was wondering if there's anyone there on thelist which is in the
> > same situation, and how is he/she connecting
> > to the db with dbunit..?
> >
> > anyone could help?
> >
> > thanks an dregards
> >  marco
> >
> > -------------------------------------------------------------------------
> > This SF.net email is sponsored by: Splunk Inc.
> > Still grepping through log files to find problems?  Stop.
> > Now Search log events and configuration files using AJAX and a browser.
> > Download your FREE copy of Splunk now >> http://get.splunk.com/
> > _______________________________________________
> > dbunit-user mailing list
> > [hidden email]
> > https://lists.sourceforge.net/lists/listinfo/dbunit-user
> >
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems?  Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> dbunit-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/dbunit-user
>

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user
Reply | Threaded
Open this post in threaded view
|

Re: dbunit and sybase

John Hurst-2
Hi,

If the three different databases are different "versions" of the
database, e.g. developer1, developer2, developer3, where you are using
only one in a single test run, then you would use a single DataSource
and configure it via at runtime via properties (or something).

If the three different databases have different tables and data and
are required at the same time for a single integration test, I think
you will need three different DataSources. (Wouldn't your production
code need three different DataSources for this anyway???) You should
still be able to use DbUnit for this, although probably not via a
supplied base class. Instead you'll need to write some code to hook up
DbUnit to each DB in turn for operations such as CLEAN_INSERT and so
forth.

John Hurst
Wellington, New Zealand

On Nov 11, 2007 1:42 PM, Marco Mistroni <[hidden email]> wrote:

> John,
>  the problem is that we are connecting to 3 different databases at the
> same time.
> we have properties (As name of dbs are different in different hosts),
> but this does
> not save me from the fact that within our tests we need tobe able to connect to
> 3 different 'schemas'  (as sybase called them)
>
> so, my setup is that i havfe a db running at    myhost:port,  under which i have
> - db1
> - db2
> - db3
>
> i want to create a base DbUnitTest file, but the connection is screwing me up..
> best idea that came to my mind was to have, in my DbUnit test a method like this
>
> public abstract getXmlSources(String xmlSourceDataPath, String dbName)
>
> so that in my dbunit test i can insert data in the proper database.
> I am using spring and a DriverManagerDataSource, i was hoping to
> configure only one
> DriverManagerDataSource and be able, somehow, to insert data in 3
> different 'sybase db', but that looks unlikely..
> so i'd have to resort to instantiate (for now) connection myself some how..
>
> thanks for your feedback and regards
>  Marco
>
>
>
>
>
> On Nov 10, 2007 8:32 PM, John Hurst <[hidden email]> wrote:
> > I generally control the specifics of the database connection (URL,
> > user, password) using system properties. Then e.g. from Ant I can
> > override the properties when I run a test suite either with -D options
> > or by putting them in build.local.properties.
> >
> > Will that work for you?
> >
> > John Hurst
> >
> > Wellington, New Zealand
> >
> >
> >
> > On Nov 11, 2007 2:43 AM, Marco Mistroni <[hidden email]> wrote:
> > > hi all,
> > >  i m trying to figure out how to use dbunit for sybase..
> > > currently,  at work, we are connecting to a  datasource like this
> > > jdbc:xx:locahost:port
> > >
> > > and in the code, whenever we have to do jbdc calls (even for tests),
> > > we specify the datbase name
> > > currently we are testing using jdbcTEmplate for inserting data, but i
> > > want to move everything to dbunit
> > >
> > > the only problem, we are connecting to 3 different databases (in
> > > sybase's term, we use 3 differetn schemas)
> > > and i want to avoid to hardcode anything
> > >
> > > i tried to connect to url   jdbc:xx:host:port, but if i do this sybase
> > > will connect me to a default database for
> > > the user i m using to login (which is only one of the three to which
> > > we are connecting to)
> > >
> > >
> > > i was wondering if there's anyone there on thelist which is in the
> > > same situation, and how is he/she connecting
> > > to the db with dbunit..?
> > >
> > > anyone could help?
> > >
> > > thanks an dregards
> > >  marco
> > >
> > > -------------------------------------------------------------------------
> > > This SF.net email is sponsored by: Splunk Inc.
> > > Still grepping through log files to find problems?  Stop.
> > > Now Search log events and configuration files using AJAX and a browser.
> > > Download your FREE copy of Splunk now >> http://get.splunk.com/
> > > _______________________________________________
> > > dbunit-user mailing list
> > > [hidden email]
> > > https://lists.sourceforge.net/lists/listinfo/dbunit-user
> > >
> >
> > -------------------------------------------------------------------------
> > This SF.net email is sponsored by: Splunk Inc.
> > Still grepping through log files to find problems?  Stop.
> > Now Search log events and configuration files using AJAX and a browser.
> > Download your FREE copy of Splunk now >> http://get.splunk.com/
> > _______________________________________________
> > dbunit-user mailing list
> > [hidden email]
> > https://lists.sourceforge.net/lists/listinfo/dbunit-user
> >
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems?  Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> dbunit-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/dbunit-user
>

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user