Subject | Re: [Firebird-Java] java 1.5: Slow connection to Database |
---|---|
Author | Steven Jardine |
Post date | 2005-06-17T03:45:20Z |
>>Because of this bug:Here is a patch for the 1.5.5 release:
>>http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5092063
>>
>>the 1.5 release of java runtime takes 4-5 seconds to connect to the
>>database.
>>I am looking for a workaround in java (not editing the hosts file or
>>something else), that can be compiled under 1.4 and doesn't have this
>>waiting problem if run under 1.5
>>
>>
>>
>>
>It looks like changing the socket constructor to: new
>Socket(InetAddress.getByName(dbai.getServer()), dbai.getPort()); should
>fix the problem. The InetAddress.getByName call disables any reverse
>DNS lookup.
>
>Would you let me know if this fixes the problem? I couldn't reproduce
>the problem on my machine.
>
>
Index: src/main/org/firebirdsql/jgds/GDS_Impl.java
===================================================================
RCS file:
/cvsroot/firebird/client-java/src/main/org/firebirdsql/jgds/Attic/GDS_Impl.java,v
retrieving revision 1.47.2.2
diff -u -r1.47.2.2 GDS_Impl.java
--- src/main/org/firebirdsql/jgds/GDS_Impl.java 10 Oct 2004 12:32:15
-0000 1.47.2.2
+++ src/main/org/firebirdsql/jgds/GDS_Impl.java 17 Jun 2005 03:39:38
-0000
@@ -1639,7 +1639,7 @@
try {
try {
- db.socket = new Socket(dbai.getServer(), dbai.getPort());
+ db.socket = new
Socket(InetAddress.getByName(dbai.getServer()), dbai.getPort());
db.socket.setTcpNoDelay(true);
if (socketBufferSize != -1) {