[prev in list] [next in list] [prev in thread] [next in thread]
List: hsql-user
Subject: [hsql-user] A workaround for two bugs.
From: Edwin Babadaglian <edwinb () panix ! com>
Date: 2000-05-03 3:49:35
[Download RAW message or body]
Hello all.
This is my first post here and I'm very thankful for HSQL, which I
happily started running on my RedHat 6.1 system.
I've encountered two bugs, for which I provide a quick workaround at the
end of this post. Both of them occur in
"jdbcConnection.reconnectHSQL()".
The first involves the inability to connect to HSQL, running in server
mode, from a client across the network. A connection attempt yields:
"java.sql.SQLException: Connection refused: no further information".
The second, which was also referred to in message 3579535 by Lance
Riedel, involves the iniability to connect to HSQL, again in server
mode, while listening on a port other than the default (9001). A
connection attempt yields: "java.sql.SQLException: Connection is broken:
unknown protocol: localhost".
I'm curious about the need of a URL object here, but I removed it in
favor of a direct Socket approach. Please pass on any comments or
reactions.
Here's my changes:
private void reconnectHSQL() throws SQLException {
try {
/* Since the trouble lies in this block, I took it out ...
*
* URL url=new URL("http","localhost",DEFAULT_HSQL_PORT,"");
* url=new URL(url,sConnect);
* sSocket=new Socket(url.getHost(),url.getPort());
*/
/* ... and put in this one ...
StringTokenizer st = new StringTokenizer( sConnect, ":" );
String host = st.hasMoreTokens() ? st.nextToken() : "";
int port = st.hasMoreTokens() ? Integer.parseInt( st.nextToken() )
: DEFAULT_HSQL_PORT;
sSocket = new Socket( host, port );
/* ... and left the rest alone. */
sSocket.setTcpNoDelay(true);
dOutput=new DataOutputStream(
new BufferedOutputStream(sSocket.getOutputStream()));
dInput=new DataInputStream(
new BufferedInputStream(sSocket.getInputStream()));
dOutput.writeUTF(sUser);
dOutput.writeUTF(sPassword);
dOutput.flush();
} catch(Exception e) {
throw Trace.error(Trace.CONNECTION_IS_BROKEN,e.getMessage());
}
}
Thanks.
Edwin
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic