Squirrel SQL Exception Logging - sql

I am developing a JDBC driver which is a wrapper for a web service. My unit tests work fine and I can write my own Java code that uses the driver to do useful things.
When I plug it into Squirrel SQL it is able to connect and get its initial batch of metadata (properties, schemas/catalogs, etc), but a simple SELECT query does not work. I receive an InvocationTargetException. This means a reflective call failed inside the method or constructor being invoked: this exception always wraps another exception which shows what really failed.
However, the error window in Squirrel SQL simply shows the exception name: no wrapped exception/cause, no stack trace. The log in my user directory contains no information regarding what happened.
Looking through the global properties and connection properties, I have not found any settings that would increase logging. I am using Squirrel SQL version 3.5.3 on Java 7 64-bit, Windows 7 64-bit.
How can I get Squirrel SQL to provide more information to help me find the cause of this error? I do not care if it outputs to the log file or the error window, just so I have something to go by.

The easiest way to change the log level is to edit the log4j.properties file. This file is in the same folder as the batch file that starts SquirrelSQL.
Simply change the line
log4j.rootLogger=info, SquirrelAppender
to
log4j.rootLogger = debug, SquirrelAppender

Related

Talend tCreateTable error: NullPointerException

Trying to create a table in a local instance of SQL Server Mgmt Studio using Talend with the ultimate goal of setting up a direct Salesforce-SSMS connection for ETL.
I've managed to load the data from SFDC into SSMS, but only by first manually creating the tables, manually mapping the schema in a tMap, and then running my job.
I'd like to now create the tables in SSMS with a tCreateTable component, and then use the AutoMap feature to map fields.
However, I'm getting a Null Pointer Exception error that makes no sense to me. Debugging line 370 shows that my dbSchema_tCreateTable_1 object is null, but I don't understand why. I've defined it from repository. Below are some pics of my setup:
Sample Schema
Error Message and Job Design
Line 370 and suspect in Red
I know my db connection is good because I've already pushed data to existing tables, but for the life of me (and 2 of my java engineers) I can't figure this out. I've got 5 days of experience with Talend so apologies if I'm making a dumb mistake. Any help would be appreciated!
edit: Component view of tCreateTable
edit 2: Component view of tFixedFlowInput
edit 3: Component view of tMSSqlOutput
edit 4: tMSSqlConnection
On first job (provided on Error Message and Job Design) NPE occur because of connection still not created (is null) when tCreateTable tried to call null.executeStatement()
You can modify your first job put tMsSQLConnection -> OnSubjobOK -> tCreateTable
OR remove connection element at all and set connection parameters to tCreateTable.
If it doesn't help, answer please on following questions:
Share please exception stacktrace and error message occurs when you use second job (connection -> tFixedFlowInput - tMSSQLOutput)
What version of studio (Open Studio or enterprise and version) have you used?
If it is not the latest (6.5.1) could you upgrade it?
If it is, could you export your job and share it? (i.e. on talend bug tracker)
P.S. You can try to debug job by yourself, select Run Job -> Debug Run -> Java Debug
Using eclipse debug view you can find out why the NPE occur.

SQLCODE=-514 SQLSTATE=26501 occurred when I fnished the rebind operator

I want to make sure the new procedure valid, insteading of the DB2 always query by the cache pool, I have to rebind the database (db2rbind command). And then I deploy the application on WebSphere. BUT, when I login to the application, the error occurs:
The cursor "SQL_CURSN200C4" is not in a prepared state..SQLCODE=-514 SQLSTATE=26501,DRIVER=3.65.97
further more, the most weird thing is that the error just occurred only once. It will not never occur after this time, and the application runs very well. I'm so curious about how it occurs and the reason why it only occurs only once.
ps: my DB2 version is 10.1 Enterprise Server Edition.
and the sql which the error stack point to is very simple just like:
select * from table where 1=1 and field_name="123" with ur
Unless you configure otherwise (statementCacheSize=0) or manually use setPoolable(false) in your application, WebSphere Application Server data sources cache and reuse PreparedStatements. A rebind can cause statements in the cache to become invalid. Fortunately, WebSphere Application Server has built-in knowledge of the -514 error code and will purge the bad statement from the cache in response to an occurrence of this error, so that the invalidated prepared statement does not continue to be reused and cause additional errors to the application. You might be running into this situation, which could explain how the error occurs just once after the rebind.

What does plpy.notice(msg) do?

Is it just a plain print to screen? if it is why not simply use simple console print command?
I've looked it up and there isn't much information about it. Even in the official PostgreSQL guide there isn't information about it other than the fact it exists.
Is it preferred to use plpy module because that way the information to be printed won't be logged in PostgreSQL log file?
The PL/Python plpy.notice(msg) method and its cousins, plpy.debug(msg), plpy.log(msg), plpy.info(msg), plpy.warning(msg), plpy.error(msg), and plpy.fatal(msg) are used to generate messages using PostgreSQL's logging capabilities. The error and fatal variants also raise an exception which can be used to abort the current SQL transaction. plpy.notice(msg) is equivalent to the PL/PgSQL command RAISE NOTICE msg.
According to the PostgreSQL 9.4 documentation http://www.postgresql.org/docs/9.4/static/plpython-util.html, the destination of log messages at various levels can be controlled via database configuration variables. For example, you can specify that you only want messages of at least WARNING level to be dispatched to the client, but anything from NOTICE and above to be logged to the server log. This has been the case at least back to PostgreSQL 8.0.

pro*c dll fail when called from different clients

I'm experiencing a weird behavior from a DLL function I have written to access an Oracle DB via Pro*C; specifically, it works fine when I call it from MQL4, and instead crashes at a specific line when called from a C client.
Crash reason says "Unhandled exception at 0x61428C74 (oranls11.dll) in GAClient.exe: 0xC0000005: Access violation writing location 0x00E368EC."
I'm using Visual Studio 2010 on Windows 8 64bit, though the development environment is set to build 32-bit DLL.
After several days debugging, I have reached the following conclusions:
- The crash occurs when EXEC SQL FETCH is called. Cursor opens fine.
- All parameters passed to the DLL function reach the crash point with exactly the same values, as I could gather from a series of fprintf() commands. This is also (and especially) true for the variable used to fetch into.
- Oracle Session Trace files are virtually identical, apparently showing Fetch, too, was successful
- Both clients (MT4.exe and GAClient.exe) are executed from command prompt, with the same set of environment variables (PATH, ORACLE_HOME, etc.)
I'm not even sure which code fragments would be useful to post at this stage; if someone has any idea where to start fixing this, I'd be more than happy to share.

Problems running vb.net program on superuser-type user

I have written a program in vb.net for in house use that connects to a Progress OpenEdge database. Now I'm having a really weird runtime problem.
I have a .exe file that runs on my local C: drive, the C: drive of the servers, from a certain network Location (but not other places on the network) just fine on at least two regular users. The problem is that when I submit it to my IT manager for review she gives it back and says it wont even run; on looking at the error, it seems to fail on the very first select query (which happens before the form finishes loading) Specifically, it ultimately boils down to the error below:
System.Data.Odbc.OdbcException: ERROR [HY000] [DataDirect][ODBC Progress OpenEdge Wire Protocol driver]Number contains an invalid character: ?
ERROR [HY000] [DataDirect][ODBC Progress OpenEdge Wire Protocol driver]Number contains an invalid character: ?
now, certainly, I'm using data sources in visual studio and parameterized queries. So, yes, if it's trying to run it as straight SQL and not filling the parameters like it's supposed to, then there is a question mark in a number field. My question is: why does the same .exe, in the same place, run by a user with HIGHER privileges throw errors?
Are you initializing the integer variable with zero (0). The question mark in progress means unknown value.
If you are still running into a problem or haven't verified a solution yet, maybe check this KnowledgeBase article on SQL tracking out to make sure that the interpretation/execution of these statements is correct.
Providing that everything is the same with the SQL statements, the problem is most likely with the way the .exe is being run. There may be filling with an alpha character rather than numeric input depending on how the .exe is being run.