Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Does Spring Batch work with only the users with "root" access?  RSS feed

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Guys,

Need one help.
can anybody tell me how I can make spring batch work. Currently it is using BasicDataSource and as I see this class doesnot have any setter for schema.
As a result the spring batch doesnot work.

The batch works just fine with user having root access.


Please please please help.

Thanks in advance.
Regards
Ashish
 
Rancher
Posts: 2759
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Generally, you put the database schema name in the JDBC url. However, this changes from database to database. Some databases assign a default schema to each user, and if you don't provide the schema in the JDBC url, it will use the default schema

Can you post your Basic data source parameters and some details about which schema you are trying to connect to?
 
Aashish Sawant
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jayesh,

Thanks for your reply.

I am using Oracle11g and it doesnot seem to accept the schema name for the datasource.

My application uses the BasicDataSource which does not accept the schema. Its as bellow.



Although I have found another way to resolve the issue. I used the ComboPooledDataSource. So instead of setting a schema I am setting a string to alter session every time a connection is issued.



This works for me now.

Anyways it would be helpful to have experts opinion on this move. You can even suggest another approach as well.
I am just concerned that for every connection it issues alter session query. I hope that doesnot hit the performance going forward.

Please suggest.

Regards,
Ashish
 
Jayesh A Lalwani
Rancher
Posts: 2759
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
preferredTestQuery is the wrong way to do it. I don't think C3PO guarantees that preferredTestQuery will run time everytime you borrow a connection from the pool.

Can you post the actual JDBC URL and the driver class? You just gave the placeholders, not the actual JDBC url. Your spring configuration imports a property file that contains batch.jdbc.url. I need that URL.
 
Aashish Sawant
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jayesh,

Please see the below details that you asked for.
batch.jdbc.driver=oracle.jdbc.driver.OracleDriver
batch.jdbc.url=jdbc:oracle:thin:@<DB_SERVER_IP>:1521:<SID>


Regards,
Ashish
 
Jayesh A Lalwani
Rancher
Posts: 2759
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ahh .. Oracle. In oracle, each database user has it's own schema. You will have to set the user field and the corresponding password.
 
Aashish Sawant
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you so much Jayesh.


Regards,

Ashish.
 
crispy bacon. crispy tiny ad:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!