Jaybird driver and Socks proxy

38 views
Skip to first unread message

Alexander Cherepanov

unread,
Jan 13, 2022, 4:49:31 AM1/13/22
to firebird-java
Hello. SOCKS proxy fine works on Jaybird 2.2.15, but almost didn't work on 4.0.5.
We use socks connections sometimes for client support (starting app on developer machine and connect to remote Firebird server over SOCKS proxy). 
Query connections are works on 4.0.5, but very slow. Also we use Firebird event system, that also fine works over SOCKS on 2.2.15 and didn't work on 4.0.5. 
Maybe we just did something wrong with 4.0.5 driver?

Mark Rotteveel

unread,
Jan 13, 2022, 5:28:14 AM1/13/22
to firebi...@googlegroups.com
What Firebird version are you using? How do you make your connection?
There are a lot of changes between Jaybird 2.2.15 and Jaybird 4.0.5 (the
entire low level implementation was rewritten with Jaybird 3.0), however
the socket connect itself hasn't changed a lot, so I don't see how that
could have an effect.

Unfortunately, I have no knowledge about SOCKS proxies, so I can't
really be of help with that.

Mark

Alexander Cherepanov

unread,
Jan 13, 2022, 6:02:53 AM1/13/22
to firebird-java
Firebird server 2.5 (LI-V6.3.7.27050).

Connections made like this:
TransactionParameterBuffer tpb = new TransactionParameterBufferImpl();
tpb.addArgument(TransactionParameterBuffer.WRITE);
tpb.addArgument(TransactionParameterBuffer.WAIT);
tpb.addArgument(TransactionParameterBuffer.LOCK_TIMEOUT, 5);
tpb.addArgument(TransactionParameterBuffer.REC_VERSION);
tpb.addArgument(TransactionParameterBuffer.READ_COMMITTED);
String connectionLine = "jdbc:firebirdsql:" + host + "/" + port + ":" + database;
Properties props = new Properties();
props.setProperty("user", username);
props.setProperty("password", password);
props.setProperty("encoding", "UTF8");
firebirdConnection = (FirebirdConnection) DriverManager.getConnection(connectionLine, props);
firebirdConnection.setTransactionParameters(tpb);
firebirdConnection.setAutoCommit(true);

By the way, Jaybird 3.0.12 tested and work good. 

четверг, 13 января 2022 г. в 15:28:14 UTC+5, ma...@lawinegevaar.nl:

Mark Rotteveel

unread,
Jan 13, 2022, 6:53:47 AM1/13/22
to firebi...@googlegroups.com
On 2022-01-13 12:02, Alexander Cherepanov wrote:
> Firebird server 2.5 (LI-V6.3.7.27050).
>
> Connections made like this:
> TransactionParameterBuffer tpb = new TransactionParameterBufferImpl();
>
> tpb.addArgument(TransactionParameterBuffer.WRITE);
> tpb.addArgument(TransactionParameterBuffer.WAIT);
> tpb.addArgument(TransactionParameterBuffer.LOCK_TIMEOUT, 5);
> tpb.addArgument(TransactionParameterBuffer.REC_VERSION);
> tpb.addArgument(TransactionParameterBuffer.READ_COMMITTED);
> String connectionLine = "jdbc:firebirdsql:" + host + "/" + port + ":"
> + database;
> Properties props = new Properties();
> props.setProperty("user", username);
> props.setProperty("password", password);
> props.setProperty("encoding", "UTF8");
> firebirdConnection = (FirebirdConnection)
> DriverManager.getConnection(connectionLine, props);
> firebirdConnection.setTransactionParameters(tpb);
> firebirdConnection.setAutoCommit(true);
>
> By the way, Jaybird 3.0.12 tested and work good.

I'll see what the differences are between 3.0 and 4.0 in this regard,
but I can't recall significant changes to connection logic, but this
might take a few days.

Mark

Alexander Cherepanov

unread,
Jan 13, 2022, 7:46:16 AM1/13/22
to firebird-java
Sorry, my mistake. Version 3.0.12 also didn't work over SOCKS. Only 2.2.15 work.

четверг, 13 января 2022 г. в 16:53:47 UTC+5, ma...@lawinegevaar.nl:

Mark Rotteveel

unread,
Jan 15, 2022, 3:21:09 AM1/15/22
to firebi...@googlegroups.com
Without a detailed reproduction recipe, or specifically pointing out
what I need to solve in the Jaybird code, I don't think I can help you.
As far as I'm aware SOCKS proxies should be transparent to the Java
code, and the Socket initialization for the main connection is so
similar between Jaybird 2.2.15 and 4.0.5, I don't think that can cause a
difference.

The event connection handling was significantly rewritten with Jaybird
3.0 from using a plain Socket to using a SocketChannel, and changed from
using the InetAddress of the socket of the main connection to using the
hostname of the connection configuration. Potentially, this could
explain problems with events, but I'm stumped as to what that would be.

Mark
--
Mark Rotteveel

Alexander Cherepanov

unread,
Jan 15, 2022, 4:09:12 AM1/15/22
to firebird-java
I will try to write detailed description next days.


суббота, 15 января 2022 г. в 13:21:09 UTC+5, ma...@lawinegevaar.nl:

Alexander Cherepanov

unread,
Jan 24, 2022, 5:27:35 AM1/24/22
to firebird-java
We have a remote Firebird server (192.168.0.10 for example),  based in NAT and firewalled by Linux (external IP is 1.2.3.4 for example)
From my developer machine i create SSH session to remote Linux server with dynamic port forwarding (SOCKS proxy):
    ssh -D 4010 us...@1.2.3.4

After created SOCKS proxy i have opened 'localhost:localport' where 'localport' i was set with SSH tunnel settings.
In my Java application i configure global SOCKS parameters like this:
    System.setProperty("socksProxyHost", "localhost");
    System.setProperty("socksProxyPort", "4010");
where 'socksProxyHost' is 'localhost' and 'socksProxyPort' is local port linked to remote SOCKS port.

Also application is configured to connect to Firebird server, like it is in my network (for example, 192.168.0.10:3050)
Local SOCKS port transmit in both directions all requests, sended between remote Firebird server and my local application, include Firebird server event system connection.

суббота, 15 января 2022 г. в 14:09:12 UTC+5, Alexander Cherepanov:
Reply all
Reply to author
Forward
0 new messages