How to log SQL query in GeoServer?
I've tried to raise the logging level, but failed to log the SQL query.
I'm using Oracle 12c datastore.
It's painful to guess the cause of the error without the query statement that is generated by GeoServer.
As I mentioned in my comment to the OP, the VERBOSE_LOGGING profile provides detail that includes the SQL queries that GeoServer is running. The following links provide some added detail about logging in GeoServer.
Global Settings
Advanced Logging Config
Related
I am doing POC for Apache Zeppelin for reporting purpose. I created a JDBC Interpreter to connect Oracle database. This way our user can execute queries and generate reports. Currently they have to login through toad to fetch data/report every day. We must restrict that.
But problem is, they can also execute update/delete queries. I want our user to run the Select queries and not any DML queries or Inserts.
Is there a way to restrict it? I expected some setting in configuration,
I tried to look on their documentation but couldn't find any clue.
I'm trying to replicate several schemas in a Oracle database to a PostgresSQL database.
When the DMS task is started with Full load, ongoing replication type the task fails after sometimes while the tables are in the Before Load status. This is the error I'm getting when the task fails
Last Error Task error notification received from subtask 0, thread 0 [reptask/replicationtask.c:2673] [1022301]
Oracle CDC stopped; Error executing source loop; Stream component failed at subtask 0,
component st_0_LBI2ND3ZI65BF6DQQYK4ITPYAY ; Stream component 'st_0_LBI2ND3ZI65BF6DQQYK4ITPYAY'
terminated [reptask/replicationtask.c:2680] [1022301] Stop Reason FATAL_ERROR Error Level FATAL
However when the same tables are added to a task with Full Load type it works without any issue. The error occurs only when trying to run the task for replicating ongoing changes.
I tried searching for this error but couldn't find a exact reason. I have configured the endpoints properly and both source and target endpoints have the required permissions for replicating changes. How can I get this resolved?
For the replication to work properly you need to enable SUPPLEMENTAL LOGGING across all the required tables in your source DB
So this can be due to multiple reasons. Although the basic cause remains the same, DMS is not able to read the logs in your oracle database and it times out.
Before proceeding forward I assume you have followed all steps mentioned in aws documentation for CDC setup here.
As mentioned in above answer the Supplemental logging should be enabled on
database level as well as for all columns and primary keys at table level ex:
ALTER DATABASE ADD SUPPLEMENTAL LOG DATA (PRIMARY KEY) COLUMNS; ALTER
TABLE schema_name.table_name ADD SUPPLEMENTAL LOG DATA (ALL) COLUMNS;
ALTER table PCUSER.PC_POLICY ADD SUPPLEMENTAL LOG DATA (PRIMARY KEY)
COLUMNS;
The log retention period should be enough so that CDC ke read the logs before deleted. Here is the troubleshooting link for this issue on aws docs.
The DMS user that you are using should have read/write/alter access for all the schemas you are trying to read from. In my case it happened several times, that afer adding new tables to the schema I got this error again as the user I was using did not have the access to read newly added tables.
Also it depends on, what are you using to mine the logs. If it is LogMiner the setup is quite simple, for binary there are few extra commands you need to execute. Which are mentioned in the setup documentation.
Login to the database using the same user, you are using on DMS and check if the redo logs exists at-
SELECT * FROM V$ARCHIVED_LOG;
Also check for the DEST_ID, highlighted in the above screenshot. As far as I read the default value is 0 on DMS. You can check this for your database and add set it in the extra connection attributes-
archivedLogDestId=1;
Check if there are multiple DEST_ID's for your logs, for example if you see the DEST_ID as 1, as in above screenshot, confirm using-
SELECT * FROM V$ARCHIVED_LOG WHERE dest_id NOT IN (1)
This should return nothing, but if this return records, copy those extra
DEST_ID's and paste them in below connection attribute-
additionalArchivedLogDestId=[0,2,3, ...,n]
Finally if this doesn't work, enable detailed debug logging, here how you can . In our case the logminer and thus the DMS user did not have the access to read the redo logs.
Few extra connection attributes that I used may help you for logminer-
addSupplementalLogging=Y;useLogminerReader=Y;archivedLogDestId=1;additionalArchivedLogDestId=[0,2,3];ignoreTxnCtxValidityCheck=false;cdcTimeout=1200
We have a very large SQL statement in our WSO2 DSS service which is executing a query against an Oracle database. With some parameters the query works. With others it fails and the Oracle error indicates there is a missing right ")" in the SQL statement. How can we see the actual SQL being sent to Oracle when the DSS executes. We've tried enabling DEBUG on any relevant looking logger and no luck.
You need to turn debug level in you DSS/Configure/Logging for
org.wso2.carbon.dataservices.core.description.query.SQLQuery
Then in Monitor/System Logs - you can see queries that was called and it's exceptions.
You can use log4jdbc to log every jdbc query that goes from DSS to Oracle. Here is a tutorial you can follow.
I am using Jaspersoft iReport Designer 5.0.0 and bqjdbc-0.1.jar (a BigQuery JDBC Driver) and I want to associate a query to a new report.
I currently have some problems when creating a new report with a query that has the keywords 'count' or 'as'. If I don't put these keywords my query works correctly.
What I find strange is that my problematic query will work if I select "Execute Command..." from my database connection in the Services window.
I also had the same problem with Jasper 4.8. I am not sure if the problem is with the BigQuery driver or with Jasper.
The error that I get when I try to associate the query to a new report is the following:
Message:
net.sf.jasperreports.engine.JRException: General problem: null
Check username and password; is the DBMS active ?!
Level: SEVERE
Stack Trace:
General problem: null Check username and password; is the DBMS active ?!
com.jaspersoft.ireport.designer.data.fieldsproviders.SQLFieldsProvider.getFields(SQLFieldsProvider.java:172)
com.jaspersoft.ireport.designer.connection.JDBCConnection.readFields(JDBCConnection.java:472)
com.jaspersoft.ireport.designer.wizards.ConnectionSelectionWizardPanel.validate(ConnectionSelectionWi zardPanel.java:146)
org.openide.WizardDescriptor$7.run(WizardDescriptor.java:1357)
org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:572)
org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:997)
This is interesting, could you give us an example of your query?
For me it seems that iReport wants to read something that isn't there.
The bigger problem is, that our logger doesn't really likes the iReport, but if you could check your log that would be a big help for us. For more information about the logging:
http://code.google.com/p/starschema-bigquery-jdbc/wiki/Logger
In the current 0.1 version we don't do anything with the query, just pass it to BigQuery. So if your query runs fine on the BigQuery Browser Tool, it should run fine with the Driver too.
Also, we don't really check stackoverflow, so please post your problems here, since we can answer your questions faster, over there:
http://code.google.com/p/starschema-bigquery-jdbc/issues/entry
How do I go about debugging a SQL statement in SQuirrel-sql?
I keep getting "unhelpful" errors like:
Error: [SQL0104] Token , was not valid. Valid tokens: ) OR.
SQLState: 42601
ErrorCode: -104
I would love to be able to see the line number where I made the error, or some other way of guiding me to where the problem is.
I am working with the JDBC driver on a IBMi DB2 database.
You can add the "errors=full" property for more detailed error messages although it will still require some interpretation to locate the precise syntax issue.
See the IBM Toolbox for Java JDBC properties for more information.
As Tracy mentioned if you want interactive syntax checking you will have to use one of the native SQL interfaces such as the green screen Start SQL Interactive Session (STRSQL) command or the IBM i Access Run SQL scripts tool.
For such errors where the problem isn't obvious, I like to copy and paste the SQL into the AS/400's green screen interactive SQL tool. (I'm assuming your database server is an AS/400 based on your tag and the mention of IBMi DB2.) The command is STRSQL. When there's an error, it will put your cursor right where the problem is. Or, more specifically, where it thinks the problem is. It does require green screen access to the AS/400.