Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDBC connections client ports

 
Filip Live
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'd like to know if it's possible to choose which ports a java application should use to open jdbc connections with db. I have a big problem with my application pooled idle connections to sapdb 7.4 blocking JNDI 1098 and 1099 ports used by a JBoss instance on the same machine.

Thanks for your help
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Outgoing it shouldn't matter - the application should just pick any free port. Its only on the remote server (i.e. the DB server) where it is important - since clients need to know which port the server is listening on. In your JDBC URL is is perfectly possible to define the port JDBC should try to connect to (check your driver docs. for examples). It is also easy to change the ports JBoss uses by default. Look in jboss-service.xml and change the ports that the JNP service uses. Of course be aware that if any of your code relies on the naming service (so all JNDI lookups you've got hardcoded) you'll break your app.
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I use 1521. May be because its oracle default listening port for TCP connections.
 
Filip Live
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unfortunately I can't change default JBoss ports. Is there a way to restrict the interval of usable free ports? I could keep JBoss ports busy until I've finished to initialize connection pool...

My server side jdbc port is ok (7210 sapdb default), I have to change client side ports which are automatically choosen.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure I understand. What is automatically trying to open 1098 and 1099 on the JBoss machine other than JBoss?
 
Filip Live
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry for my poor english, I'll try to explain that better.

SapDB server JBoss and my application run on the same machine. The initial condition is:

SapDB is running
JBoss is not running
My application is not running

I run my application, it initialize its pool of jdbc connection towards SapDb creating 30 connections. This connections have remote adress port = 7210 and local adress port on the first 30 free ports (often including 1098 1099).

Now I start JBoss and it's unable to initialize correctly because it finds out that the default ports it needs are already used.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic