cancel
Showing results for 
Search instead for 
Did you mean: 

How to create DB Connection Pool

Former Member
0 Kudos

Hi,

My database schema is lying in oracle database. I want to create the connection pool for the same and want to use the connection pool in my application.

Can anyone please tell how to create DB connection pool in WebAS and reference the same in any portal/j2ee component???

Regards,

Chandra

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

you may configure the connection pooling within the SAP Visual Administrator. Within the JDBC Connector Service you can specify DataSources and configure the connection pool for every DataSource separately.

If you need further technical information the SAP persistence FAQ could be helpful https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/2351eb90-0201-0010-d297-f46....

Regards,

Mark

Answers (1)

Answers (1)

Former Member
0 Kudos

Thanks a lot Mark for the info.

Actually I had created data source using visual administrator->JDBC Connector. But the problem is connection obtained from this data source can reference only the tables which are created through java dictionary.

This connection can not reference any table which has been created directly using DDL statements through toad or any other database client.

The schema which I want to refer from my application is not created through java dictionary. How to create connection pool for this?

Please let me know for any clarifications.

Regards,

Chandra

Former Member
0 Kudos

Hi,

On the JDBC Connector panel you have the option of setting the DataSource alias, here you will have to create an alias for the DataSource and refer to it in the code as 'jdbc/<alias>'.

This can be reference from both the portal and j2ee.

This can raise a question on the SSO aspects though.

Regards,

S.Divakar

former_member441228
Active Participant
0 Kudos

Look for something called 'vendor connection' if do have the OpenSQL/engine/jdic dependent datasource; for example,

try:

OpenSQLDataSource datasource;

//..get the datasource;

datasource.setConnectionType(

OpenSQLDataSource.CONN_TYPE_VENDOR_SQL);

java.sql.Connection con = datasource.getConnection();

This way you end up with a "native" connection to the database that the WebAS schema is installed on.

Former Member
0 Kudos

Hi all,

Thanks for your reply.

Following is the complete description of my problem.

1. I am using the following code to get the data source.

javax.naming.InitialContext ctx = new InitialContext();

javax.sql.DataSource ds = (javax.sql.DataSource)ctx.lookup("jdbc/SAPPRTDB");

java.sql.Connection con = ds.getConnection();

2. With this connection, I can query/insert/update only those tables which are created through java dictionary. But not the tables which are created directly using toad or SQL Plus. Reason behind not using java dictionary for my tables are, my schema is seperate from portal/j2ee schema and I couldn't find a way to deploy the dictionary to my schema. All the tables in dictionary always get created in default j2ee schema. Moreover it is not possible to specify foreign key relationship in dictionary tables.

3. As suggested by you (Helmut), I tried following

com.sap.sql.connect.OpenSQLDataSource ds = (com.sap.sql.connect.OpenSQLDataSource)ctx.lookup("jdbc/SAPPRTDB");

java.sql.Connection con = ds.getConnection();

But it is giving class cast exception. I checked the exact class for the data source. It is com.sap.engine.services.dbpool.cci.ConnectionFactoryImpl.

Please help.

Please let me know for any clarifications.

Former Member
0 Kudos

Hi,

"My database schema is lying in oracle database"

have you put your data into the WebAS database instance??

if you have a seperate Oracle instance holding your schema then you will have to create a new datasource pointing to your oracle instance. you will have to create a new alias to this datasource and use it for fetching your data.

As per my understanding the java dictionary tables are created in the WebAS database schema itself.

Regards,

S.Divakar

Former Member
0 Kudos

Thanks for your response.

My schema is in the same database instance.

Actually creating the data source and getting the connection part is absolutely fine. As mentioned above, I am able to query/insert/update the tables which are created through java dictionary but not other tables. In simple terms, I am looking for a connection which can query/insert/update tables which are created in normal fashion (like from SQL Plus).

Former Member
0 Kudos

Thanks all for your kind help.

I was able to resolve this problem.

As mentioned by Helmut, connection has to be a vendor connection or a native connection to access the tables which are not created through java dictionary.

It is possible to specify the connection type for a data source through visual admin. Follow the below link for more details.

http://help.sap.com/saphelp_webas630/helpdata/en/45/ef362dc57b1e46aa6f445ec6247103/content.htm

Former Member
0 Kudos

Hello all,

I have the same problem in my application. Im creating entity services using the netweaver development studio (with the composite application services perspective) but using an external oracle database. This kind of perspective automatically creates the dictionary project. Is it possible to generate the ddls from this dictionary project and create a database schema in my external database and get the data from it ? In order to access the external database, I've created a datasource reference (and an alias) in the visual administrator. But how do I tell my application to access this datasource ?

Ive tried to put the application name in my datasource definition, but I get this error:

Path to object does not exist at carpool, the whole lookup name is localejbs/sap.com/carpool/EmployeeService

This application is the example in the article "Creating a Local Entity Service with Maintenance UI".

Thanks in advance.

Helder Ribeiro