Can I use DriverManager getConnectionurlusernamepassword

Hi all,

  1. Can I use the following piece of JAVA code to create JDBC connection in webMethods. We are trying to create connections and perform other insert operations without using webMethods JDBC Adapter. If yes, what are the advantages and disadvantages???

try
{
Class.forName(“com.microsoft.sqlserver.jdbc.SQLServerDriver”);

}catch(ClassNotFoundException cfe)
{
System.out.println( "class not found "+cfe );
}

String url = "jdbc:sqlserver://localhost:1433;databaseName=MYWEBMETHODS;

Connection connection = DriverManager.getConnection(url,username,password);

  1. Can I bind JDBC Adapter connection created using webMethods Admin to a JNDI name…The main purpose is to the existing code…we will reading all the values from abc.properties file…

In abc.properties file registry.datasource=db2/abc (This is the JNDI name which we should bind to our JDBC Connection Pool (in webMethods)…

InitialContext initialcontext = new InitialContext();
String dataSourceName getTokenFromabcProperties(“registry.datasource”).trim();
logger.debug(“DatasourceName is :” + dataSourceName);
DataSource datasource = (DataSource)initialcontext.lookup(dataSourceName);
logger.debug(“Got datasource! Trying connection.”);
conn = datasource.getConnection();
logger.debug(“Got connection from datasource.”);

am curious what goal you are looking to achieve in doing it this way?

Are there specific performance issues you’re looking to overcome? Some functionality not supported by the jdbc adapter?

Hi,

This is due to total ignorance of my project implementers…Thay just somehow want to include webMethods in the project…you can follow the thread…

[url=“wmusers.com”]wmusers.com

Thanks
Kevin

Any thoughts…???

Hi all,

I can say we cannot use JDBCAdapterConnection Name = JNDI Name…I did a test and it didn’t worked…can any one tell me how JDBC Adapter maintaines connection pool information etc???

If we use the code given below…it will not maintain connection pools information…its rather a direct call to JDBC which is not advisable…I was wondering is their a way to use webMethods JDBC Connection pool (created by webMethods, when we create JDBC Adapter Connection) in java code (not webMethods provided JAVA API).

Thanks
Kevin

try
{
Class.forName(“com.microsoft.sqlserver.jdbc.SQLServerDriver”);

}catch(ClassNotFoundException cfe)
{
System.out.println( "class not found "+cfe );
}

String url = "jdbc:sqlserver://localhost:1433;databaseName=MYWEBMETHODS;

Connection connection = DriverManager.getConnection(url,username,password);

Kevin,
Look at the commons-dbcp package which utilizes the commons-pool package. This is all open source and java based (as per your requirement)

[url=“Pool – Overview”]http://jakarta.apache.org/commons/pool/[/url]
[url=“DBCP – Overview”]http://jakarta.apache.org/commons/dbcp/[/url]

I have used this as part of one of the projects I undertook wherein I had to rely on my own connection pooling (irrespective of webMethods)

HTH,
Saurabh

WmDB allows the creation of “data sources” and even the use of your own driver. I have used this a number of times. Unfortunatly I have had to use the data sources indirectly from my Java classes through invoking webMethods services. Layers upon layers.
I need to quickly adapt a set of servlets that use JNDI managed DataSource objects. It is probably futile to expect I can make a simple adaption. I cannot quickly set-up JBoss (it seems to kill LDAP for authentication and users/group mgt in my installation). I cannot quickly upgrade to IS 6.5 or 6.1 - I am stuck with 6.0.1 and WmTomcat.

Neil,

How can we create Data Source(Connetion pool) using wmDB package ?.

Kevin,

Any solution you got for this problem.

I too am facing the same problem.I need to execute a set of direct SQL statements(the set may contain insert/update statements to multiple tables). There is no such kind of service in JDBC Adapter.which support batch insertion of direct SQL statements into multiple tables.

Sourabh,

I too am thinking of using our own connection pools.As you said you implemented this how was the performance and all.Is it OK?

Thanks a lot guys
-Kiran

As far as I can tell it is not possible. If the WmDB package uses the DataSource interface I cannot tell. It is not exposed either way.
I solved my problem by not using WmDB at all.
We use i-net Opta2000 driver here. I wrapped the PoolManager that comes with this driver API. Knocked up a service to maintain a config file to simplify post deployment data source configuration. Not so neat but such is life.

Performance will be OK. This application will be low use - 1/2 users 1-2 times a week.