Debug SQL queries in SQuirrel-sql - jdbc

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.

Related

PowerBI Desktop: intermittent ORA-03113 errors

I am connecting to oracle 12 in Oracle cloud, from PowerBI Desktop windows server 2016.
Oracle client is installed and TNS file configured.
Oracle is hosted by a vendor so my only access is to directly query the database.
In powerBI, when using an oracle connection, i get ORA-03113 errors about 50% of the time when refreshing data. There is no discernible pattern to the appearance of the error.
If i connect via a System ODBC connection set up in windows, I dont get any issues or errors, although the data load is a bit slower.
I would appreciate ideas on what may be causing this issue or what to check to help get more information.
I'm afraid your issue needs some deeper analysis as ORA-03113 might have various reasons, but typically it means that the 'oracle' executable has terminated unexpectedly once there was an existing connection. You should try to isolate the SQL command that is executing when the error occurs. It can be done either by checking the trace files on the server or by using SQL*Net trace if you don't have access to the server. If a statement can be isolated which consistently raises the ORA-3113 error, then it can be further analysed (like execution plan, triggers, etc), or maybe the best to raise an SR so Oracle Support can work on the issue. If you have access to Oracle Support you can find more information about ORA-03113 troubleshooting in MOS Doc ID 1506805.1. Let me know if I can help you any further.

How to replicate existing OracleRDB ODBC connection in Oracle's SQL Developer application?

I am new to Oracle database in general, but I'm attempting to get Oracle's SQL Developer running on a workstation that has pre-configured System DSNs created for an OracleRDB database. I've confirmed the ODBC connections are working because I can use MS Access to connect and link to the tables. The "test" options within ODBC also succeed. Now I am trying to get a similar connection created using SQL Developer so I can see the column types and write queries in a more useful editor.
Here's what I have available when examining the ODBC connection properties:
Now I'm trying to create a duplicate connection in SQL Developer, but I'm at a loss for why things don't work. I first tried using the default SQL Developer installation, but couldn't get things working. Then I discovered there's an OracleRDB extension available, so I installed that, but I keep getting this error when attempting to use similar values:
As I stated, these ODBC connections were pre-configured on the workstation I'm using, so I don't know anything more than what is provided by the Oracle ODBC driver window.
Is there something obvious I'm not seeing or doing to replicate this connection in SQL Developer? Or perhaps something else I can do to debug this to learn more?
UPDATE
On the advice of one answer I'm trying to make the connection with JDBC, but having a hard time understanding what I'm doing wrong. Here's another screenshot with the connection parameters I have available, but with the server and database names changed:
With these values (the port came from my tnsnames.ora file), if I try to make a JDBC connection I keep getting the following error from SQL Developer:
One final attempt I did was to use the proper values in the Oracle RDB tab, and when I use them and click 'test' the Testing Connection dialog just spins and never seems to return:
So I apologize for the long post here, but I'm struggling because there's just something I am really not understanding about how this all works. I appreciate everyone who took the time to read this question.
Oracle SQL Developer is a Java Application. You'll need to get the JDBC Driver for RDB.
Once you have that, in the SQL Developer preferences, find the Third Party JDBC section, and then use that to add an entry and point to the JAR for what you just installed.
Step by step instructions here.
Working connection string for RDB Thin Driver:
RDB_DB_CONN_STR = "jdbc:rdbThin://node.myplace.com:1707/";
where node.myplace.com is the name of the OpenVMS node hosting the RDB Thin Driver, 1707 is the port number assigned to the RDB Thin Driver.

SQL Syntax error while trying WSO2 CEP getting started sample

Am new to W2 CEP and trying to run the samples given in the Wso2 CEP documentation. I was actually following the getting started guide and almost through with all the steps without any issues. But stuck with the last but one step while creating a personalized dash board.
Am using Oracle database as my datasource and I was able to refer the datasource created in CEP while creating the dashboard and the connection is validated successfully. But when I enter my sql "select * from delivered_orders" and upon running it gives me an error of "You have an error in your SQL syntax". In the console I can see a corresponding ORA error "java.sql.SQLException: ORA-00933: SQL command not properly ended"
The sql statement as you have seen is a very basic statement to have any syntax errors. Am not sure whats wrong with my setup, any help regarding this would be great.
I have read couple of other titles from stack overflow on this which suggest I should not use composite primary keys which was bug with WSO2 CEP. I tried that but still no good.
Additional Details : 0ct 3'rd
I tried the same sample with MySql and it works like a charm. And thanks for Colinr for the ticket, I see the documentation updated. But still I have issues while connecting with Oracle.
Your command may be missing a terminator ';'
If that solves your issue, I'll try to get the document updated.

oracle - Schemas issues when migration from discoverer to OBIEE

I'm working on migrating some reports from Oracle Discoverer to OBIEE. I've already exported the layouts from discoverer to OBIEE. I have all I need in the OBIEE Admin tool now, but when I try to perform this operation:
I got this message:
I've read in many forums that this is because of the query (enter link description here) but I've executed the query in SQL Developer and all is fine.
Any idea?
Thanks,
I can see from the icon on your object that it is an Opaque View that your trying to run View Data on.
This is probably because of a syntax issue in your opaque view. Make sure the code in the opaque view doesn't end with a semi-colon or slash, that will cause problems. Try eliminating any blank lines, if there are any. However, without knowing exactly the syntax of the code it's impossible to say exactly what the cause is.
It's also possible that there is a connection script attached to the connection pool you are using to View Data, running on connection or before execution with bad syntax.
Otherwise have a look in the Admin Tool log to see if there's more information about what is causing the error. It will usually contain more detailed information than is passed back through the GUI.

Monitor and change SQL queries with SQL Server 2000

I have a database upgrade tool that is misbehaving. I would like to catch one of the queries it sends to the database and change it before it is executed.
The tool connects via ODBC.
The tool and the SQL Server are on the same Windows 2003 Server box.
Any ideas?
EDIT: (More info)
When the tool runs it dies on step 12 out of 100. It issues some bad SQL intended to create a view. I need to suppress the error message or correct the SQL before it is executed. I can't just create the view because the first thing it does it drop the view. Even then it would error because the view would already exist.
Certainly - use the SQL Profiler to intercept and record the query.
Very useful little tool that...

Resources