<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p><font face="Calibri">I finally solved my problem. <br>
</font></p>
<p><font face="Calibri"><font face="Calibri">The database
configuration was correct after all..<font face="Calibri">. </font>All
I had to do was clearing the cache in prod environment.</font></font></p>
<p><b><font face="Calibri">php app/console cache:clear --<font
face="Calibri">env=prod</font></font></b><br>
</p>
<br>
<div class="moz-cite-prefix">On 2017-07-03 16:21, Astrid Emde wrote:<br>
</div>
<blockquote type="cite"
cite="mid:eab3221c4c747849657b8ffbe62cdfc6@wheregroup.com">Hi,
<br>
<br>
you only referred one database, but you need one for Mapbender and
one for your database with geodata.
<br>
<br>
The configuration should look like this
<br>
<br>
doctrine:
<br>
dbal:
<br>
default_connection: default
<br>
connections:
<br>
default:
<br>
driver: %database_driver%
<br>
host: %database_host%
<br>
port: %database_port%
<br>
dbname: %database_name%
<br>
path: %database_path%
<br>
user: %database_user%
<br>
password: %database_password%
<br>
charset: UTF8
<br>
logging: %kernel.debug%
<br>
profiling: %kernel.debug%
<br>
acadb:
<br>
driver: %database2_driver%
<br>
host: %database2_host%
<br>
port: %database2_port%
<br>
dbname: %database2_name%
<br>
path: %database2_path%
<br>
user: %database2_user%
<br>
password: %database2_password%
<br>
charset: UTF8
<br>
logging: %kernel.debug%
<br>
profiling: %kernel.debug%
<br>
<br>
see
<a class="moz-txt-link-freetext" href="https://doc.mapbender3.org/en/book/database.html#using-multiple-databases">https://doc.mapbender3.org/en/book/database.html#using-multiple-databases</a><br>
<br>
Afterwards you can change the search router configuration and
refer to acadb
<br>
<br>
class: Mapbender\CoreBundle\Component\SQLSearchEngine
<br>
class_options:
<br>
connection: acadb
<br>
relation: data.aires_prot_priv
<br>
attributes:
<br>
- objectid
<br>
- code_proje
<br>
geometry_attribute: geom
<br>
form:
<br>
code_proje:
<br>
type: text
<br>
options:
<br>
required: true
<br>
compare: ilike
<br>
results:
<br>
view: table
<br>
count: true
<br>
headers:
<br>
code_proje: Name
<br>
callback:
<br>
event: click
<br>
options:
<br>
buffer: 10
<br>
minScale: null
<br>
maxScale: null
<br>
<br>
Astrid
<br>
<br>
<br>
Am 2017-07-03 19:22, schrieb Abrabacabra:
<br>
<blockquote type="cite">Thank you Astrid.
<br>
<br>
Although I am still missing something and I can't spot it...
<br>
<br>
It can find the connection, but even if the credentials and
<br>
permissions are correct, I still get the "No such table" error.
In
<br>
fact, even if I put incorrect information in parameters.yml
(such as
<br>
not wrong database driver, wrong adress, wrong port, wrong user,
wrong
<br>
password, etc), it raises the "No such table" error.
<br>
<br>
I included the links to the configuration files
<br>
CONFIG.YML: <a class="moz-txt-link-freetext" href="https://paste.debian.net/hidden/317e0f4c/">https://paste.debian.net/hidden/317e0f4c/</a>
<br>
PARAMETERS.YML: <a class="moz-txt-link-freetext" href="https://paste.debian.net/974572/">https://paste.debian.net/974572/</a>
<br>
SEARCHROUTER CONFIGURATION: <a class="moz-txt-link-freetext" href="https://paste.debian.net/974573/">https://paste.debian.net/974573/</a>
<br>
<br>
On 2017-07-03 11:46 AM, Astrid Emde wrote:
<br>
<br>
<blockquote type="cite">Hello Patrice,
<br>
<br>
Am 2017-07-01 16:15, schrieb Patrice:
<br>
<br>
<blockquote type="cite">I am trying to use the Search Router
bundle in an application, but
<br>
it
<br>
fails.
<br>
<br>
At first, it could not find the database, so I have setup
the
<br>
database
<br>
in config.yml and parameters.yml.
<br>
<br>
Now, it can't find the table to search in.
<br>
<br>
Here is the error in prod.log:
<br>
<br>
[2017-07-01 14:04:54] request.CRITICAL: Uncaught PHP
Exception
<br>
Doctrine\DBAL\DBALException: "An exception occurred while
<br>
executing
<br>
'SELECT t.objectid, t.code_proje, ST_AsGeoJSON(geom) as geom
FROM
<br>
data.aires_prot_priv t WHERE LOWER(t.code_proje) LIKE
LOWER(?)'
<br>
with
<br>
params ["%tabi%"]: SQLSTATE[HY000]: General error: 1 no
such
<br>
table:
<br>
data.aires_prot_priv" at
<br>
<br>
</blockquote>
<br>
</blockquote>
C:\ms4w\apps\mapbender3-3.0.5.3\vendor\doctrine\dbal\lib\Doctrine\DBAL\DBALException.php
<br>
<blockquote type="cite">
<blockquote type="cite">
<br>
line 91 {"exception":"[object]
<br>
(Doctrine\\DBAL\\DBALException(code:
<br>
0): An exception occurred while executing 'SELECT
t.objectid,
<br>
t.code_proje, ST_AsGeoJSON(geom) as geom FROM
data.aires_prot_priv
<br>
t
<br>
WHERE LOWER(t.code_proje) LIKE LOWER(?)' with params
<br>
[\"%tabi%\"]:\n\nSQLSTATE[HY000]: General error: 1 no such
table:
<br>
data.aires_prot_priv at
<br>
<br>
</blockquote>
<br>
</blockquote>
C:\\ms4w\\apps\\mapbender3-3.0.5.3\\vendor\\doctrine\\dbal\\lib\\Doctrine\\DBAL\\DBALException.php:91,
<br>
<blockquote type="cite">
<blockquote type="cite">
<br>
PDOException(code: HY000): SQLSTATE[HY000]: General error: 1
no
<br>
such
<br>
table: data.aires_prot_priv at
<br>
<br>
</blockquote>
<br>
</blockquote>
C:\\ms4w\\apps\\mapbender3-3.0.5.3\\vendor\\doctrine\\dbal\\lib\\Doctrine\\DBAL\\Connection.php:691)"}
<br>
<blockquote type="cite">
<blockquote type="cite">
<br>
[]
<br>
<br>
The table "aires_prot_priv" does exist in the "data" schema
and I
<br>
have
<br>
the necessary right to read from it (made the test with
pgAdmin
<br>
using
<br>
the same credentials as specified in parameters.yml).
<br>
<br>
However, as my database and schema are already filled with
the
<br>
data I
<br>
want to use, I didn't create the database and schema using
<br>
"doctrine:database:create". Is this mandatory in order to
use the
<br>
search router?
<br>
</blockquote>
<br>
No - this is not mandatory.
<br>
<br>
<blockquote type="cite">What am I missing?
<br>
</blockquote>
<br>
It looks like your database configuration is not right or your
<br>
configuration.
<br>
You should ceck this again in parameters.yml and config.yml.
<br>
<br>
<br>
</blockquote>
<a class="moz-txt-link-freetext" href="https://doc.mapbender3.org/en/book/database.html#using-multiple-databases">https://doc.mapbender3.org/en/book/database.html#using-multiple-databases</a>
<br>
<blockquote type="cite">
<br>
<br>
In the searchRouter configuration you have to use the name
that you
<br>
defined for your second database
<br>
<br>
Hope that helps
<br>
<br>
Astrid
<br>
<br>
<blockquote type="cite">_______________________________________________
<br>
Mapbender_users mailing list
<br>
<a class="moz-txt-link-abbreviated" href="mailto:Mapbender_users@lists.osgeo.org">Mapbender_users@lists.osgeo.org</a>
<br>
<a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/mapbender_users">https://lists.osgeo.org/mailman/listinfo/mapbender_users</a>
<br>
</blockquote>
</blockquote>
_______________________________________________
<br>
Mapbender_users mailing list
<br>
<a class="moz-txt-link-abbreviated" href="mailto:Mapbender_users@lists.osgeo.org">Mapbender_users@lists.osgeo.org</a>
<br>
<a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/mapbender_users">https://lists.osgeo.org/mailman/listinfo/mapbender_users</a>
<br>
</blockquote>
<br>
</blockquote>
<br>
</body>
</html>