Skip to main content

Accessing Data Sources in SBB's

2 replies [Last post]
luis_teixeira
Offline
Joined: 2005-04-04

I have a question that I hope is not too philosophical :) Is it possible and/or legitimate to access a database resource directly from an SBB without involving resource adaptors for such? For example I have a MySQL database that I wish to access from an SBB component. With regular java classes I would use a JDBC connector wich I would use to pass queries and to put and retrieve information.

Thanks,

Luis Teixeira

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
leondo
Offline
Joined: 2005-01-18

Yes, you can access datasource directly from a SBB.

For example:
try {
String s = "java:/PostgresqlLocal";
InitialContext initialcontext = new InitialContext();

PG = (DataSource) initialcontext.lookup(s);
connection = PG.getConnection();
} catch (Exception exception1) {
exception1.printStackTrace();
}

ivelin
Offline
Joined: 2003-07-13

I will respond to the philosophical side of the question. JDBC is typically with response time in seconds. SLEE transactions are expected to complete within 100ms. Hence it is generally undesireable to use JDBC directly from SBBs.

So the question is how to add J2EE type of functionality without breaking the SLEE expecations. This a best practices discussion.

One option seems to be recommending the usage of profiles for storing persistent data. The SLEE implementations have a good chance of optimizing performance of profile tables.

Another option could be specialized RAs, which take SLEE events and spawn JDBC type of requests asyncronously. When results are available, they'd send back an event to the inquiering SBB. This pattern matches well the SIP protocol semantics.

Other ideas?

Ivelin