Comments (6)
When I use firebird database as second database (first is sqlite) and connect with this code:
from django.db import connections
cursor = connections['firebird_db'].cursor()
I get:
DatabaseError at /test/
('Error while connecting to database:\n- SQLCODE: -902\n- Unable to complete network request to host "test.testdomain.com".\n- Failed to establish a connection.', -902, 335544721)
I also get the same when I use firebird database as default database and execute
python manage.py migrate
Then I tried to use fdb alone (same fdb install on same virtualenv and inside same django view):
con = fdb.connect(dsn='test.testdomain.com/18006:DBtest', user='user', password='*******')
cur = con.cursor()
cur.execute("SELECT * FROM TESTTABLE")
And it worked, I connected to database successfully. So the question is - why django-firebird can't connect? It uses the same fdb driver.
from django-firebird.
Hi rivf,
I can't reproduce this error into my environment. All I can see quickly is you're not using the default port.
-902 335544721 is a network_error
Please try:
con = fdb.connect(dsn='test.testdomain.com:DBtest', user='user', password='*******', port=18006)
from django-firebird.
Please try:
con = fdb.connect(dsn='test.testdomain.com:DBtest', user='user', password='*******', port=18006)
not working, but exactly the same error (last time it was produced not by fdb, but by django-firebird):
DatabaseError at /test/
('Error while connecting to database:\n- SQLCODE: -902\n- Unable to complete network request to host "test.testdomain.com".\n- Failed to establish a connection.', -902, 335544721)
but this works fine:
con = fdb.connect(dsn='test.testdomain.com/18006:DBtest', user='user', password='*******')
Any ideas? Btw, I can't change port to default in this particular case.
from django-firebird.
I've solved the problem.
DATABASES = {
'default': {
'ENGINE' : 'firebird',
'NAME' : 'DBtest', # Path to database or db alias
'USER' : 'user', # Your db user
'PASSWORD' : '*****', # db user password
'HOST' : 'test.testdomain.com', # Your host machine
'PORT' : '18006', # If is empty, use default 3050
}
}
Above code is not working
DATABASES = {
'default': {
'ENGINE' : 'firebird',
'NAME' : 'DBtest', # Path to database or db alias
'USER' : 'user', # Your db user
'PASSWORD' : '*****', # db user password
'HOST' : 'test.testdomain.com/18006', # Your host machine
#'PORT' : '18006', # If is empty, use default 3050
}
}
Works!
So you should fix your manual, add something about host/port setting.
from django-firebird.
With a settings like this:
DATABASES = {
'default': {
'ENGINE' : 'firebird',
'NAME' : 'DBtest', # Path to database or db alias
'USER' : 'SYSDBA', # Your db user
'PASSWORD' : 'masterkey', # db user password
'HOST' : '127.0.0.1', # Your host machine
'PORT' : '3050', # If is empty, use default 3050
}
}
Try this from a shell (./manage.py shell)
from django.db import connection
connection.get_connection_params()
It must returns, for example something like
{'dsn': '127.0.0.1:DBtest', 'charset': 'ISO8859_1', 'user': 'SYSDBA', 'password': 'masterkey', 'port': '3050'}
Now,
import fdb
from django.db import connection
params = connection.get_connection_params()
conn = fdb.connect(**params)
It should work too.
from django-firebird.
With your example database code
from django.db import connection
connection.get_connection_params()
returns:
{'dsn': '127.0.0.1:DBtest', 'password': 'masterkey', 'charset': 'UTF8', 'port': '3050', 'user': 'SYSDBA'}
DATABASES = {
'default': {
'ENGINE' : 'firebird',
'NAME' : 'DBtest', # Path to database or db alias
'USER' : 'user', # Your db user
'PASSWORD' : '*****', # db user password
'HOST' : 'test.testdomain.com/18006', # Your host machine
#'PORT' : '18006', # If is empty, use default 3050
}
}
returns:
{'dsn': 'test.testdomain.com:DBtest/18006', 'password': '*****', 'charset': 'UTF8', 'user': 'user'}
And it works for this non default port.
What you suggest is not working. Please try to use your backend with non-default port. I think it's bug.
So again: when I use
'HOST' : 'test.testdomain.com
,
and
'PORT' : '18006',
It can't connect to the database.
'HOST' : 'test.testdomain.com/18006',
With this host line and port line commented or deleted connects successfully.
Also I need to add that the database is 2.5.1, not 2.5.2, but I don't think it's important.
from django-firebird.
Related Issues (20)
- Django 3 support HOT 11
- Support firebird dialect 1. HOT 1
- TypeError at operations.convert_decimalfield_value HOT 2
- BinaryField() does not save like stream HOT 2
- add support for firebird 3 / python 3 driver HOT 1
- Does the lib work on windows? HOT 1
- Error al conectar firebird + django 3.2.6.0 HOT 7
- Django 3.2 and firebird 3 error connection HOT 1
- 'float' object has no attribute 'quantize' HOT 1
- Django 4 and Firebird 4 support HOT 1
- Time to rename django-firebird python package HOT 2
- Error on django3 with BOOL fields HOT 1
- KeyError: 'deferrable' HOT 2
- CREATE PROCEDURE DJANGO_SITE_RS failed
- TypeError: convert_booleanfield_value() missing 1 required positional argument: 'context' HOT 1
- django migration already exists
- Column unknown tablename.RDB$DB_KEY
- Time for a name change? HOT 1
- virtualenv can't be populated from requirements.txt, asgiref version conflict, upath just won't build (python 3.12, Ubuntu 23.10)
- Tests don't run
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-firebird.