cancel
Showing results for 
Search instead for 
Did you mean: 

Creating a datasource

Former Member
0 Kudos
197

Hi,

I am trying to create a datasource for my application.

I want the isolation level to be TRANSACTION_SERIALIZABLE in the connection. But if I set the connection to TRANSACTION_SERIALIZABLE it gives me a illegalArgument exception. If I set it to default it works any idea why ?

I am using the WAS 6.30 on windows.

thanks a lot

Padmaja Ragavendra

Accepted Solutions (0)

Answers (3)

Answers (3)

katarzyna_fecht
Employee
Employee
0 Kudos

Hi Padmaja,

please have a look at the documentation, Development Manual/Java Persistence/Locks.

Also have a look at the docu about the package

com.sap.engine.services.applocking

contained in the Documentation manual 'API reference'

and let us know if the information is not sufficient.

Again, you should stay at the default isolation level of open sql and acquire locks.

With bmp entity beans, the container does not interact between the bean and the database at all. There is no difference if you use BMP entity beans and if you send JDBC/SQLJ directly from the session bean. That's why there is no possibility to set something database related, for example about the isolation level, for BMP entity beans (there is no difference if you use BMP entity beans and if you send JDBC/SQLJ directly from the session bean)

Former Member
0 Kudos

Hi

Sorry was working on a different assignment and now am back on this.

I am looking at the info you suggested will try that out and see.

thanks a lot

Padmaja

katarzyna_fecht
Employee
Employee
0 Kudos

Hi Padmaja,

why do you need the TX_SERIALIZABLe isolation?

The right way with the Open SQL datasource is to

stay at the default isolation level - and it is the lowest one: READ_UNCOMMITED - and to lock database data on the server side using the Enqueue Server.

Remember, in general, the whole application uses the same isolation level.

Last but not least: you should not change the settings of the default data source.

Former Member
0 Kudos

Hi Katarzyna,

I am using bean managed persistence and I could not find documentation on how to use the logical locks from the enqueue server.

Most of the documents talk about container managed peristence and logical locks.

I need the isolation level to be Transaction serializable.

or atleast reapatable read.

The ejb-j2ee-engine.xml file has isolation levels for container managed beans.

How do I set these for bean managed beans?

How do I set the enqueue server isolation level to repeattable read as I understand it does not support transaction serializable

Thanks a lot for your help.

Please do let me know if you have more info on enqueue server.

thanks

Padmaja

Benny
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Padmaja,

this depends on how you do this and what you are using. If your program uses Open SQL, then this is surely expected to be part of the descriptors, which may collide with your program.

If you are more specific, I may be able to tell you more.

Regards,

Benny

Former Member
0 Kudos

Hi,

I have a Entity Bean which has Open Sql statements. I created a datasource as specified in the car rental example.

driver class = com.sap.dbtech.jdbc.DriverSapDB

driver name = SYSTEM_DRIVER

database url = jdbc:sapdb://localhost/C11?timeout=0

jdbc version = 1.x

user = sapc11db

In my code I do a lookup of the datasource

dataSource = (DataSource) ctx.lookup("jdbc/BMPEXAMPLE");

connection = _dataSource.getConnection();

when it tries to get the connection it fails.

I need the transaction isolation to be TRANSACTION_SERIALIZABLE.

So in the visual administrator-> jdbc connectors -> addtional I set the default transaction isolation

to be TRANSACTION_SERIALIZABLE.

I tried where i set the URL to be

jdbc:sapdb://localhost/C11?isolation=TRANSACTION_SERIALIZABLE&timeout=0

this did not give me any error but in the sql trace when it sets the isolationlevel it is setting it to 1.

Is there something I need to set in sapdb to get this working correctly.

thanks a lot for your help.

Please let me know if you need more details. I am very new to sapdb and the netweaver platform.

thanks

Padmaja Ragavendra

Benny
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Padmaja,

where did you get all this stuff from? I need to know to find out which versions you have from server and example. This seems to be outdated.

Regards,

Benny

Former Member
0 Kudos

Hi Benny,

I posted a reply earlier in the day but it seems like it has not been updated.

I download the WebAs 6.30 beta version evaluation copy from the sap website and installed using default configuration.

The example I looked was the car rental example available on the sap website

http://sdn.sap.com/was6_3_beta2.

I created an example which has a session bean as a front end. This creates employees, finds and deletes employees.

The session bean initiates transactions (JTA). The session bean has the business logic call the entity bean methods for creation, searching etc.

The entity bean is a BMP. It uses a datasource and opensql to store and retrieve data from the database.

I wrote this example to test how to connect to the database using BMP and transactions.

I am using UserTransactions.

For creating the datasource I looked on the website at

"Creating a DataSource with JDBC 1.x Driver (SAP Library - J2EE Technology in SAP Web Application Server) "

The datasource is needed to connect to the database. I created it from the j2ee visual administartor.

All I wanted to check was how the connection isolation levels work with BMP and JTA transactions.(javax.sql.connection)

Are they supported in 6.30 ?

If you need more info let me know.

thanks for all your help

Padmaja

Benny
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Padmaja,

as I understand right, you are <b>not</b> using sneak preview for this but downloaded it from service.sap.com?

This will not work as this had some major changes you won't find out yourself.

For one thing there is a database alias you should declare for the project. Depending on your version this only can be done by rightclicking the projrct and open a new database alias xml file (sorry, but at the moment I'm not in access on a system, so cannot look up the correct name)

More about aliases you can find in the manual under:

http://help.sap.com/sapdocu/netweaver/webas/630/helpdata/EN/11/4963a6cf52ad429b3b3b65e003f2d1/frames...

How to transport the alias with your application is under:

http://help.sap.com/sapdocu/netweaver/webas/630/helpdata/EN/fe/a3996fa314f94f8a0c3475b08636d0/frames...

ther please follow: Connectivity and Interoperability-> J2EE Connector Architecture-> Handling DataSources-> Deploying a DataSource Alias with an Application

Regards,

Benny

Former Member
0 Kudos

Hi Benny

Thanks for all the info. Your help is really appreciated.

I will try to get the alias working and let you know how that goes.

I looked at the "about tab" in my netweaver and it says sneak preview 2.0.0

Will that change things ?

Sorry about not looking up things correctly.

You have been a real help

thanks once again.

Padmaja

Former Member
0 Kudos

Hi Benny,

Here is what I tried.

Added an alias to the default datasource.

In my example now am looking up this alias for the default datasource.

When I see the default datasource's monitor I can see the connections being established.

This was with the sysDS.isolation property not set to anything.

Then I set the sysDS.isolation TRANSACTION_SERIALIZABLE.

Now my example is not working and gives a ResourceException.

Also in the Enterprise assembly I cannot add the dbpool alias connection as that feature is not available.

Do you know what the value for the sysDS.isolation should be set to?

thanks a lot for your help

Padmaja