Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » DTP » JDBCDatabase.getSchemas returns an empty list!
JDBCDatabase.getSchemas returns an empty list! [message #554464] Mon, 23 August 2010 09:44 Go to next message
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 #554663 is a reply to message #554464] Mon, 23 August 2010 22:25 Go to previous messageGo to next message
Brian Fitzpatrick is currently offline Brian Fitzpatrick
Messages: 495
Registered: July 2009
Senior Member
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 #554990 is a reply to message #554663] Wed, 25 August 2010 06:11 Go to previous message
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 #597897 is a reply to message #554464] Mon, 23 August 2010 22:25 Go to previous message
Brian Fitzpatrick is currently offline Brian Fitzpatrick
Messages: 495
Registered: July 2009
Senior Member
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 Go to previous message
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
Previous Topic:JDBCDatabase.getSchemas returns an empty list!
Next Topic:Adding child node to DSE Schema node
Goto Forum:
  


Current Time: Mon Oct 20 08:24:28 GMT 2014

Powered by FUDForum. Page generated in 0.03518 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software