Forums Register Login

JDBC connections client ports

+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
I use 1521. May be because its oracle default listening port for TCP connections.
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
Not sure I understand. What is automatically trying to open 1098 and 1099 on the JBoss machine other than JBoss?
+Pie Number of slices to send: Send
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.
It's a tiny ad. At least, that's what she said.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 7479 times.
Similar Threads
Running Tomcat without port number
Clarification - firewall
FTP Client MultiThread
Applet with JDBC
stay resident in memory
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 07:12:58.