JDBCDatabase.getSchemas returns an empty list! [message #554464] |
Mon, 23 August 2010 09:44 |
Eclipse User |
|
|
|
Originally posted by: hillner.informatik.uni-leipzig.de
Hi all,
my problem is that I need to create an instance of any Database object
(f.i. a JDBCDatabase) for further usage.
F.i. I need to fetch all schemas from the database (and exactly this is
the problem).
Currently I'm creating the database as follows:
DB2SimpleDataSource source = new DB2SimpleDataSource();
source.setServerName(server);
source.setDriverType(4);
source.setPortNumber(port);
source.setDatabaseName(dbName);
source.setUser(userName);
source.setPassword(password);
try {
Connection connection = source.getConnection();
database = new JDBCDatabase(connection);
} catch (SQLException e) {
e.printStackTrace();
}
I can work with the connection without problems but when I try to use
the database (f.i. to get the schemas) it seems that the object wasn't
properly initialized. Since this is an EMF object, I thought there must
be a factory class anywhere to create a database object but I didn't
find one.
Thanks,
Stanley
|
|
|
|
Re: JDBCDatabase.getSchemas returns an empty list! [message #554990 is a reply to message #554663] |
Wed, 25 August 2010 06:11 |
Eclipse User |
|
|
|
Originally posted by: hillner.informatik.uni-leipzig.de
Hello,
thanks a lot, I didn't see this method and wondered why there is no
utility or anything else to retrieve a database object for a connection.
Bye,
Stanley
Am 8/24/2010 12:25 AM, schrieb Brian Fitzpatrick:
> Hi Stanley...
>
> Take a look at the last question in this FAQ:
> http://wiki.eclipse.org/DTP_FAQ
>
> It provides an example of how to get the Database object. There's a
> mappping in the ConnectionInfo from a connection profile to a database
> object (there's a level of abstraction in place).
>
> Using the details from your data source, you should be able to create a
> transient connection profile (another FAQ at that link) to get the
> connection profile, connect to the profile, and get the database object
> out.
>
> HTH
>
> --Fitz
>
> Stanley Hillner wrote:
>> Hi all,
>>
>> my problem is that I need to create an instance of any Database object
>> (f.i. a JDBCDatabase) for further usage.
>> F.i. I need to fetch all schemas from the database (and exactly this
>> is the problem).
>>
>> Currently I'm creating the database as follows:
>>
>> DB2SimpleDataSource source = new DB2SimpleDataSource();
>> source.setServerName(server);
>> source.setDriverType(4);
>> source.setPortNumber(port);
>> source.setDatabaseName(dbName);
>> source.setUser(userName);
>> source.setPassword(password);
>> try {
>> Connection connection = source.getConnection();
>> database = new JDBCDatabase(connection);
>> } catch (SQLException e) {
>> e.printStackTrace();
>> }
>>
>> I can work with the connection without problems but when I try to use
>> the database (f.i. to get the schemas) it seems that the object wasn't
>> properly initialized. Since this is an EMF object, I thought there
>> must be a factory class anywhere to create a database object but I
>> didn't find one.
>>
>> Thanks,
>> Stanley
|
|
|
|
Re: JDBCDatabase.getSchemas returns an empty list! [message #597905 is a reply to message #554663] |
Wed, 25 August 2010 06:11 |
Eclipse User |
|
|
|
Originally posted by: hillner.informatik.uni-leipzig.de
Hello,
thanks a lot, I didn't see this method and wondered why there is no
utility or anything else to retrieve a database object for a connection.
Bye,
Stanley
Am 8/24/2010 12:25 AM, schrieb Brian Fitzpatrick:
> Hi Stanley...
>
> Take a look at the last question in this FAQ:
> http://wiki.eclipse.org/DTP_FAQ
>
> It provides an example of how to get the Database object. There's a
> mappping in the ConnectionInfo from a connection profile to a database
> object (there's a level of abstraction in place).
>
> Using the details from your data source, you should be able to create a
> transient connection profile (another FAQ at that link) to get the
> connection profile, connect to the profile, and get the database object
> out.
>
> HTH
>
> --Fitz
>
> Stanley Hillner wrote:
>> Hi all,
>>
>> my problem is that I need to create an instance of any Database object
>> (f.i. a JDBCDatabase) for further usage.
>> F.i. I need to fetch all schemas from the database (and exactly this
>> is the problem).
>>
>> Currently I'm creating the database as follows:
>>
>> DB2SimpleDataSource source = new DB2SimpleDataSource();
>> source.setServerName(server);
>> source.setDriverType(4);
>> source.setPortNumber(port);
>> source.setDatabaseName(dbName);
>> source.setUser(userName);
>> source.setPassword(password);
>> try {
>> Connection connection = source.getConnection();
>> database = new JDBCDatabase(connection);
>> } catch (SQLException e) {
>> e.printStackTrace();
>> }
>>
>> I can work with the connection without problems but when I try to use
>> the database (f.i. to get the schemas) it seems that the object wasn't
>> properly initialized. Since this is an EMF object, I thought there
>> must be a factory class anywhere to create a database object but I
>> didn't find one.
>>
>> Thanks,
>> Stanley
|
|
|
Powered by
FUDForum. Page generated in 0.03299 seconds