GDS Exception. 335544421. connection rejected by remote interface - firebird

I am trying to connect to a firebird db using the jaybird jdbc driver. Firebird is running under ubuntu. I have created a simple database located under /tmp/hellofb.fdb (yeah not the best place, just for testing). I am running firebird superserver 3.0. The firebird service is up and running sudo service firbird3.0 status:
firebird3.0.service - Firebird Database Server ( SuperServer )
Loaded: loaded (/lib/systemd/system/firebird3.0.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2017-10-25 22:40:53 CEST; 25min ago
Process: 23411 ExecStart=/usr/sbin/fbguard -pidfile /run/firebird3.0/default.pid -daemon -forever (code=exited, status=0/SUCC
Main PID: 23412 (fbguard)
Tasks: 4 (limit: 4915)
CGroup: /system.slice/firebird3.0.service
├─23412 /usr/sbin/fbguard -pidfile /run/firebird3.0/default.pid -daemon -forever
└─23413 /usr/sbin/firebird
Okt 25 22:40:53 XPS-L322X systemd[1]: Starting Firebird Database Server ( SuperServer )...
Okt 25 22:40:53 XPS-L322X systemd[1]: Started Firebird Database Server ( SuperServer ).
My spring boot application.properties is given by:
spring.datasource.url:jdbc:firebirdsql://localhost:3050//tmp/hellofb.fdb
spring.datasource.driverClassName:org.firebirdsql.jdbc.FBDriver
However, when I try to connect to the database, I get the following exception:
org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544421. connection rejected by remote interface
I have tried all possible permutations given by the jaybird FAQ, I am running out of options. Any help would be greatly appreciated!
Note: I tried to connect to the databse using flamerobin and everything works just fine

Given you haven't provided the information I asked for in the comments, I have to guess you are using Firebird 3 with Jaybird 2.2.x based on the described behavior.
The error connection rejected by remote interface can also occur under other conditions than described below.
Possible cause: wire protocol encryption required
Firebird 3 introduces a number of new security features that are enabled by default, but are not supported by Jaybird 2.2. To allow Jaybird 2.2 to connect to Firebird 3 you need to relax some of those settings.
To allow Jaybird 2.2.x to connect, you need to change the following settings in firebird.conf (and restart Firebird after changing the setting):
Relax the WireCrypt setting from its default of Required to Enabled:
WireCrypt = Enabled
Enable support for the legacy authentication protocol:
AuthServer = Srp, Legacy_Auth
You then need to make sure the user you want to use for connecting to Firebird is created with the legacy usermanager by enabling support for the legacy usermanager:
UserManager = Srp, Legacy_UserManager
Restart Firebird to apply these settings, and then - in Flamerobin - with a SYSDBA account (or user with role RDB$ADMIN), create the required user:
CREATE USER youruser PASSWORD 'yourpasw' USING PLUGIN Legacy_UserManager
Alternatively you could upgrade to Jaybird 3.0.4 or higher, which supports the Srp authentication protocol and wire protocol encryption.
These settings are described in more detail on our wiki in article Jaybird and Firebird 3. This information was absent from our FAQ, I have now added it under connection rejected by remote interface (335544421).
Possible cause: no user name or password
With Jaybird 3 or higher and Firebird 3 or higher, this error can be the result of not providing a username or password. The absence of a user name or password causes Jaybird to not try any authentication plugin. This results in Firebird rejecting the connection attempt as at least one authentication attempt should be done.

Related

AWS RDS Postgres 11 database Connected to pgAdmin 4

Question
What extra do I get if I fix this and get access to the admin database? (MyDataBaseName normal database works perfectly well)
Do I even need to fix this to use this postgres database for a Django 3.0 project?
Done -> ERROR
I have created a free tear AWS RDS Postgres 11 database.
I allowed external connections at creation and have successfully configured the inbound rules.
Than I have connected to pgAdmin (right click on server groups/create/server)
Than I got 3 database:
MyDataBaseName how I have named my database
postgesql that is auto generated
rdsadmin this is also auto generated,
I have problem with this one that it doesn't opens,
it has a rex x at the database icon
if i click on it it gives the following ERROR message
INTERNAL SERVER ERROR
FATAL: SomeConfigFileName.conf rejects connection for host "host.ip.adders.actully.with.numbers", user "myPersonalUsername", database "rdsadmin", SSL on
FATAL: SomeConfigFileName.conf rejects connection for host "host.ip.adders.actully.with.numbers", user "myPersonalUsername", database "rdsadmin", SSL off
"rdsadmin" is used for internal purposes by AWS. There should be no need to "fix" this.
The only things you are missing is things you aren't allowed to do anyway, and indeed not needing to deal with them yourself is what you are paying Amazon for.
Django shouldn't care. If it demands access to this database, that would be a bug in Django (or a configuration error)

Is it possible to backup Firebird DB when using SuperServer on Windows Server 2016?

When I execute Firebird 3.0.x backup command:
c:\Db>"C:\Program Files\Firebird\Firebird_3_0\gbak.exe" -b c:\Db\Db1.fdb c:\Db\Db1_backup.fbk -garbage_collect -transportable -verify -user SYSDBA -pas PASSWORD
Error 1 happend:
gbak: ERROR:I/O error during "CreateFile (open)" operation for file "C:\DB\DB1.FDB"
gbak: ERROR: Error while trying to open file
gbak: ERROR: The process cannot access the file because it is being used by another process.
gbak:Exiting before completion due to errors
Example 2 with TCP/INET/localhost/remote protocols:
c:\Db>"c:\Program Files\Firebird\Firebird_3_0\gbak.exe" -backup inet://c:\Db\Db1.fdb d:\_Backups\Db1_20180702_230546.fbk -garbage_collect -transportable -verify -skip_data SOMETAB_TO_SKIP -user SYSDBA -password PASSWORD123
Error 2 happend:
gbak: ERROR:Your user name and password are not defined. Ask your database administrator to set up a Firebird login.
First of all ... to be honest I am not sure when this started or why. I did not look at my server maybe 3 months but today my backup disk broke down so I had to. I just saw this error first time today and I lived in conviction that my backup works. But I had Firebird 2.5 before.
The question is: is this specific only for Firebird 3 SuperServer on Windows? And there is no way how to backup Firebird 3 SuperServer database when is used by FB server?
Tested and failed on Firebird server 3.0.2 and 3.0.3 on Windows Server 2016.
Firebird is running as a service
Nothing is changed in firebird.config except:
WireCompression = true
RemoteServicePort = 1234
CpuAffinityMask = 8
ServerMode = Super or SuperClassic (when I testing it)
When I execute first command on SuperClassic it works.
When I execute first command on SuperServer 2.5.x it works.
Ok, so I finally figured out where is the issue. Here is the explanation:
My password is wrong!
BUT!
When I use SuperClassic I can use WRONG password and Firebird allows access to the database. (as local user)
When I use SuperServer I can use WRONG password and Firebird allows access to the database WHEN I am the FIRST connection! (as local user with and also without remote protocols)
When I use SuperServer and I use WRONG password Firebird denied access to the database WHEN I am the second (and more) connection! (local also remote user)
With only remote protocols you can not access database with wrong password.
(By remote protocols I mean this.)
This are the reasons of the differences in behavior and why I did not see using of WRONG password. Thanks to everybody who tried to help me.

Firebird ADO.NET provider 5.0.5.0 to Firebird 3.0 can not connect except sysdba

I am trying connect to firebird 3.0 throught latest version of ADO.NET provider 5.0.5.0 from my simple test .net application. When i used sysdba user connection is made OK, but if i used other user then connection failed with classic FBException :
Your user name and password are not defined. Ask your database administrator to set up a Firebird login.
"initial catalog=c:\\Database\\Data.fdb;data source=localhost;user id=sysdba;password=sysPass;port number=3050" = OK
"initial catalog=c:\\Database\\Data.fdb;data source=localhost;user id=michal;password=micPass;port number=3050" = failed
But if i am trying connect throught IBExpert or isql , then connection is made OK and i can get data from tables.
Previously i used Firebird 2.1 and then i upgraded to Firebird 3.0 superclassic and get ADO.NET provieder from nuget.Actually i do not need SRP ecryption so I disabled WireCrypt etc. and use Legacy authentication (Firebird 3.0 release notes page 117). Then i created my new user via IBExpert (sysdba was created during installation firebird server).
I do not need migrate users from previous firebird version so I skiped Upgrading a v.2.x Security Database steps.
It is strange that i can connect myUser via IBExpert or isql, but not via ADO.NET provider.
It seems to me unlikely that ADO.NET provider has bug of this type (everyone needed connect via user), so I guess that i have some bad configuration.
I had some bad configurations and I need set correctly:
In firebird.conf, there has to be: WireCrypt = Enabled (not disabled)
Create user account older way (in my case via IBExpert)
The password have to max. length 8 chars (previously you can have more chars and Firebird is omit)

c3p0 pool cannot establish a connection. How to debug this?

I have a Tomcat and PostgreSQL installed on a server. I'm having a connection problem trying to connect from my servlet to PostgreSQL database using c3p0 pool.
I can reach DB if I'm running Tomcat locally on my laptop. Also I can connect from server to DB using psql (i.e. command line sql utility). But when I'm trying to deploy my servlet to server and establish a connection I'm getting the following error:
java.sql.SQLException: Connections could not be acquired from the underlying database!
com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:106)
...
com.mchange.v2.resourcepool.CannotAcquireResourceException: A ResourcePool could not acquire a resource from its primary factory or source.
com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(BasicResourcePool.java:1319)
com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:557)
com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:477)
What should I check to locate a problem? It should be a trivial issue but may be due to 4 a.m. I'm missing something :) Thanks in advance!
PS: Connection from all network interfaces are allowed to database. PostgreSQL JDBC driver and c3p0 pool are distributed in WAR. Tomcat configuration is very default. JNDI is not used.
You need to check a few things:
java.policy which tomcat is using
(e.g.
/etc/tomcat5.5/policy.d/02debian.policy)
db server settings (e.g.
/etc/postgresql/pg_hba.conf)
try connecting without pool first as
in my case c3p0 was hiding important information from me
Adding to #Alexey's answer, I had this issue with Tomcat and PostgreSQL 9.4. In my case, the md5 authentication method in postgres was causing the issue.
If you are using Windows server or RHEL server, make sure you update the authentication method in pg_hba.conf file. Modify it to trust and restart postgresql.

Migrate from JavaDB to PostgreSQL and cant access database any longer

I have an application on Glassfish v2 ( on Mac OS 10.5.8 and Java 1.6 ) that uses JavaDB and Toplinks that comes with the Glassfish bundle. Everything works fine.
I have installed PostgreSQL 8.4 and the JDBC v4 driver. Both Glassfish and Postgres server run on localhost. From Netbeans, I create a connection to a database on the Postgres server, and it works fine, I can manually create and delete tables.
I create a connection pool, resource and persistence unit for this connection to the Posgres server. When I deploy I have the following error :
ADM1041:Sent the event to instance:
[ResourceDeployEvent -- reference-added jdbc/jdbc/MyDatasource]
CORE5004: Resource Deployed: [jdbc:jdbc/MyDatasource].
TopLink, version: Oracle TopLink Essentials - 2.1 (Build b60e-fcs (12/23/2008))
Server: unknown
RAR5038:Unexpected exception while creating resource for pool MyConnectionPool.
Exception : Connection could not be allocated because:
FATAL: database "null" does not exist
I read that with Postgres 8.4, localhost request are accepted by default, so I haven't changed anything in postgres.conf.
I am missing something, but I cant see what.
Thanks in advance for any hint.
Tart
First ensure that MacOSX/GlassFish really uses the specified Java version (test with: java -version). Then try the following:
asadmin create-jdbc-connection-pool
--datasourceclassname org.postgresql.ds.PGSimpleDataSource
--restype javax.sql.DataSource --property portNumber=5432:password=secret:user=postgres:serverName=localhost:databaseName=postgres
test-pool
and
asadmin create-jdbc-resource --connectionpoolid test-pool jdbc/Postgres
remember to change the username, password, server, port and database to reflect your setup. Then test the datasource using:
asadmin ping-connection-pool test-pool
if this does not work then you have miss-configured your data source.
I don't know the stack, but it sounds like you haven't specified the database name in the connection. See http://jdbc.postgresql.org/documentation/84/connect.html for a list of parameters you can/should set on the connection.