Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » DTP » Making connection profile or Database programatic
Making connection profile or Database programatic [message #9554] Sat, 18 March 2006 06:58 Go to next message
Haris Peco is currently offline Haris PecoFriend
Messages: 1072
Registered: July 2009
Senior Member
Hello,
Is it possible and if yes is there some documentation or start point.
I have tried make database instance like this

Database database = new JDBCDatabase(connection);

but it fail in this code (JDBCDatabase#loadSchemas line 91)
ConnectionInfo connectionInfo =
DatabaseConnectionRegistry.getInstance().getConnectionForDat abase(this);
ConnectionFilter filter =
connectionInfo.getFilter(this.getName()+"::"+ConnectionFilter.SCHEMA_FILTER); //$NON-NLS-1$
if (filter == null) { //if schema filter is null, then get default filter
filter = connectionInfo.getFilter(ConnectionFilter.SCHEMA_FILTER);
}

maybe this is better :

ConnectionInfo connectionInfo =
DatabaseConnectionRegistry.getInstance().getConnectionForDat abase(this);
if (connectionInfo != null) {
ConnectionFilter filter =
connectionInfo.getFilter(this.getName()+"::"+ConnectionFilter.SCHEMA_FILTER); //$NON-NLS-1$
if (filter == null) { //if schema filter is null, then get default filter
filter = connectionInfo.getFilter(ConnectionFilter.SCHEMA_FILTER);
}
}
Best
Peco
Re: Making connection profile or Database programatic [message #9690 is a reply to message #9554] Fri, 24 March 2006 19:04 Go to previous messageGo to next message
Rob Cernich is currently offline Rob CernichFriend
Messages: 56
Registered: July 2009
Member
Hello Peco,

Sorry for the lack of documentation. It is one of the things we will be
working on as we move towards the Callisto release. Hopefully, the
following example will help.

The SQL model can be accessed through a connection factory associated with
connection profile you are using. You should use the connection factory
ID'd by the ConnectionInfo class.

For example,

IConnection connection =
someConnectionProfile.createConnection(ConnectionInfo.class. getName());
ConnectionInfo connectionInfo =
(ConnectionInfo)connection.getRawConnection();
Database db = connectionInfo.getDatabase();
Connection jdbcConnection = connectionInfo.getSharedConnection();

Alternately, if you wish to use the shared model associated with the
connection profile... (this assumes the connection profile is in a
"connected" state; someConnectionProfile.connect())

IManagedConnection managedConnection =
someConnectionProfile.getManagedConnection(ConnectionInfo.cl ass.getName());
IConnection connection = managedConnection.getConnection();
ConnectionInfo ....<same as above from here on>

Hope that helps you along. Please let me know if you need more
information.

Sincerely,
Rob
Re: Making connection profile or Database programatic [message #10225 is a reply to message #9690] Fri, 24 March 2006 23:52 Go to previous messageGo to next message
Haris Peco is currently offline Haris PecoFriend
Messages: 1072
Registered: July 2009
Senior Member
Rob,

I have java.sql.Connection (connected to database) and i want
make Database instance (for using sql parser in non-datatools
editor).I haven't ConnectionInfo (and i needn't it)
It work fine except part of code in my example:
datatools check if filter is null, but doesn't check if
ConnectionInfo is null.

I don't want make connection profile from existing datatools
connection profile - i have nothing except raw datatools plugin
and want use parser part only

Thanks

PS
Can datatools handle databases wich supports catalog and schema
like MS SQL and Sybase (i see getSchemas method, but don't see
getCatalogs or similar)

Rob Cernich wrote:

> Hello Peco,
>
> Sorry for the lack of documentation. It is one of the things we will be
> working on as we move towards the Callisto release. Hopefully, the
> following example will help.
>
> The SQL model can be accessed through a connection factory associated with
> connection profile you are using. You should use the connection factory
> ID'd by the ConnectionInfo class.
>
> For example,
>
> IConnection connection =
> someConnectionProfile.createConnection(ConnectionInfo.class. getName());
> ConnectionInfo connectionInfo =
> (ConnectionInfo)connection.getRawConnection();
> Database db = connectionInfo.getDatabase();
> Connection jdbcConnection = connectionInfo.getSharedConnection();
>
> Alternately, if you wish to use the shared model associated with the
> connection profile... (this assumes the connection profile is in a
> "connected" state; someConnectionProfile.connect())
>
> IManagedConnection managedConnection =
>
someConnectionProfile.getManagedConnection(ConnectionInfo.cl ass.getName());
> IConnection connection = managedConnection.getConnection();
> ConnectionInfo ....<same as above from here on>
>
> Hope that helps you along. Please let me know if you need more
> information.
>
> Sincerely,
> Rob
Re: Making connection profile or Database programatic [message #20051 is a reply to message #10225] Tue, 25 July 2006 19:48 Go to previous message
Rob Cernich is currently offline Rob CernichFriend
Messages: 56
Registered: July 2009
Member
Peco,

I've created a BZ entry for this,
https://bugs.eclipse.org/bugs/show_bug.cgi?id=151747.

Rob
Re: Making connection profile or Database programatic [message #571707 is a reply to message #9554] Fri, 24 March 2006 19:04 Go to previous message
Rob Cernich is currently offline Rob CernichFriend
Messages: 56
Registered: July 2009
Member
Hello Peco,

Sorry for the lack of documentation. It is one of the things we will be
working on as we move towards the Callisto release. Hopefully, the
following example will help.

The SQL model can be accessed through a connection factory associated with
connection profile you are using. You should use the connection factory
ID'd by the ConnectionInfo class.

For example,

IConnection connection =
someConnectionProfile.createConnection(ConnectionInfo.class. getName());
ConnectionInfo connectionInfo =
(ConnectionInfo)connection.getRawConnection();
Database db = connectionInfo.getDatabase();
Connection jdbcConnection = connectionInfo.getSharedConnection();

Alternately, if you wish to use the shared model associated with the
connection profile... (this assumes the connection profile is in a
"connected" state; someConnectionProfile.connect())

IManagedConnection managedConnection =
someConnectionProfile.getManagedConnection(ConnectionInfo.cl ass.getName());
IConnection connection = managedConnection.getConnection();
ConnectionInfo ....<same as above from here on>

Hope that helps you along. Please let me know if you need more
information.

Sincerely,
Rob
Re: Making connection profile or Database programatic [message #571770 is a reply to message #9690] Fri, 24 March 2006 23:52 Go to previous message
Haris Peco is currently offline Haris PecoFriend
Messages: 1072
Registered: July 2009
Senior Member
Rob,

I have java.sql.Connection (connected to database) and i want
make Database instance (for using sql parser in non-datatools
editor).I haven't ConnectionInfo (and i needn't it)
It work fine except part of code in my example:
datatools check if filter is null, but doesn't check if
ConnectionInfo is null.

I don't want make connection profile from existing datatools
connection profile - i have nothing except raw datatools plugin
and want use parser part only

Thanks

PS
Can datatools handle databases wich supports catalog and schema
like MS SQL and Sybase (i see getSchemas method, but don't see
getCatalogs or similar)

Rob Cernich wrote:

> Hello Peco,
>
> Sorry for the lack of documentation. It is one of the things we will be
> working on as we move towards the Callisto release. Hopefully, the
> following example will help.
>
> The SQL model can be accessed through a connection factory associated with
> connection profile you are using. You should use the connection factory
> ID'd by the ConnectionInfo class.
>
> For example,
>
> IConnection connection =
> someConnectionProfile.createConnection(ConnectionInfo.class. getName());
> ConnectionInfo connectionInfo =
> (ConnectionInfo)connection.getRawConnection();
> Database db = connectionInfo.getDatabase();
> Connection jdbcConnection = connectionInfo.getSharedConnection();
>
> Alternately, if you wish to use the shared model associated with the
> connection profile... (this assumes the connection profile is in a
> "connected" state; someConnectionProfile.connect())
>
> IManagedConnection managedConnection =
>
someConnectionProfile.getManagedConnection(ConnectionInfo.cl ass.getName());
> IConnection connection = managedConnection.getConnection();
> ConnectionInfo ....<same as above from here on>
>
> Hope that helps you along. Please let me know if you need more
> information.
>
> Sincerely,
> Rob
Re: Making connection profile or Database programatic [message #581289 is a reply to message #10225] Tue, 25 July 2006 19:48 Go to previous message
Rob Cernich is currently offline Rob CernichFriend
Messages: 56
Registered: July 2009
Member
Peco,

I've created a BZ entry for this,
https://bugs.eclipse.org/bugs/show_bug.cgi?id=151747

Rob
Previous Topic:DTP going to follow UI guidelines?
Next Topic:DTP Connectivity Features for 0.9.1 and 1.0
Goto Forum:
  


Current Time: Sat Nov 09 02:10:50 GMT 2024

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

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

Back to the top