I have a very simple report that runs perfectly on in iReports (4.5.0) on my workstation. When I upload it JasperServer CE (4.5.0) I get the following error.
1 - Unable to get next record.
java.lang.Exception: 1 - Unable to get next record.
at com.jaspersoft.ireport.jasperserver.ws.WSClient.runReport(WSClient.java:403)
at com.jaspersoft.ireport.jasperserver.ws.WSClient.runReport(WSClient.java:320)
at com.jaspersoft.ireport.jasperserver.ReportRunner.run(ReportRunner.java:70)
at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:572)
at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:997)
There are other much more complex queries and reports that are running on the JasperServer without problem. The database system is Basis/Pro5 running BBJ (Business Basic Java). I am connected to the database in iReports and JasperServer using the same native JDBC Basis driver (BBjJDBS.jar). JasperServer is running on the same RHEL box as the BBj database. Jasper server is installed as a bundle using both the built in DB and Tomcat. No other known conflicts exist.
The following single table query is designed to get the sum totals of a transaction for a given month. The report has one detail section which just prints the query output.
SELECT
Month(INHI.TRANSACTION_DATE) AS TransMonth,
admin.INHI.ITEM_ID,
admin.INHI.TRANSACTION_TYPE,
SUM(admin.INHI.TRANS_QUANTITY) as TransQty
FROM
admin.INHI
WHERE
admin.INHI.ITEM_ID = 'R-CBSH-3300'
AND (
admin.INHI.TRANSACTION_TYPE = 'B2'
OR admin.INHI.TRANSACTION_TYPE = 'P1')
AND admin.INHI.TRANSACTION_DATE BETWEEN '2012-01-01' AND '2012-03-31'
GROUP BY
Month(INHI.TRANSACTION_DATE),
admin.INHI.ITEM_ID,
admin.INHI.TRANSACTION_TYPE
Order By
admin.INHI.TRANSACTION_TYPE
I have looked all over to try and find additional trouble shooting tips and have ran out of options to try. Any guidance is greatly appreciated.
In my case I was able to get an extended error from the JasperServer web interface which lead me to an Date/Time issue. The crux of the whole problem was the "Order By" clause. Once I removed the order by the query worked fine.
You can also get this error if you pass a closed result set as the data source for the report.
In my case I passed the JasperReportBuilder object around and somewhere I (prematurely) closed the Connection object that the result set was bound to.
Related
I'm having trouble identifying the issue with Hibernate where Hibernate throws persistence exception.
I've include a screenshot of the code.Sorry regarding the censoring. Source Code
Added logs as per Christian's suggestion. Application logs
The following are findings which I've done to identify the problem
Production
Application logs show the following error (javax.persistence.PersistenceException:
org.hibernate.exception.SQLGrammarException: could not extract
ResultSet Application exception overridden by commit exception) Where
it manages to enter the DAO function but it doesn't show the Hibernate
query in logs,also fail to exit function. Ran the same source code
query in production using SQL and it returned expected results.
Just to clarify: There's another DAO function which uses the same
tables and it manages to display correctly on production so I doubt it would be a table grant issue
Development
Records from the query display correctly on front - end when queried
data is present, logs show that it manages to enter and exit the DAO
function with the query displayed. No error even when there are no
results in database table to retrieve (Logs show the Hibernate query, front-end has no results)
You are not showing the exact error details so it's hard to help. I guess you are setting some parameter to null maybe which Oracle can't handle or maybe one of the functions you are using can't handle the data. The error details you are logging should help you get to the bottom of this.
I have really low knowledge on Java and JasperReports, barely used those to play around, nothing too serious. A friend of mine has been trying to get someone to develop him an application that will generate PDFs with information from an access database for each of his clients, however, after 6 months and 7 developers who ditched him, he has found none, so he asked me if I could help him to which I said I'd give it a try.
What I have been able to do so far:
So far I've managed to successfully (Everything has been done separately, I have like 8 projects in total so far):
Use Jaspersoft Studio/iReport to create a single PDF with the required client information on each sheet.
Create a separate JasperReports project with a input field to get a pdf with a single client information.
Create a Java App with a JFrame to launch the report generation.
Create a Java App to connect to the access database through ucanaccess and validate the search criteria
Questions:
Now, after a few days on Google up and down I havnt managed to successfully achieve everything that I'd like to achieve, and I'd love if someone could either point me into good noob-proof guides or (if willing) provide a noob-proof answer so I can continue to move on.
Create a Java App where you can choose to generate all client's report or a single report for a specified client (I am assuming this isn't too complicated since it'd just be a matter to embed both Jasper reports into the java app), however I'd need to pass the input value into jasper report field to generate a single report (Not sure if this one was clear enough), and run the query for the data-set based on that field's value.
Ideally though not highly needed, pass yet another variable as a field to set a date range.
Since this is being done on a MS Access Database -*.accdb- (Don't blame me, I've been telling him to move to MySQL/SQL for quite a while now), I'd love to know if its possible to make JasperReports do a query based on a UCanAccess JDBC connection (Tried a few options, none worked).
Finally, I need to generate in the report a date range (Something like: "Between 1/Jan/2014 and 1/Feb/2014")
I feel like I've made a decent amount of progress so far, but since I am no pro on either JasperReports nor Java, I am getting stuck in a point where more knowledge is required to create a more decent and practical piece of software and I'd love if someone could point me into a better direction (Either if something is impossible or just a few links to help me get thru)
-Remeber to add ucanaccess jar and all dependencies jars in the Driver Classpath, while creating the Data Adapter
-You have to set Showschema=true:
e.g.
jdbc:ucanaccess://c:/db/database.accdb;Showschema=true
In this way Jasper Studio will be able to navigate the metadata of your database, and you'll find your tables under the PUBLIC schema.
Then you'll be able to create your reports as usual.
I am trying to get a Java desktop application to pull some data from a Microsoft SQL-Server 2008 Database. Netbeans database explorer can generate Entity classes from database tables, but I was unable to get this feature working. Normally, when you conect to a database, you see something like this:
I entered the database URL, username and password, and the connection was established. But when I tried to explore the tables, they were all empty. Instead of the nice tree above, I was just given a list of empty Schemas. Mutlitple user names were tried, all had the same issue. Since there was no schema on the database matching the username, a number of different schemas were displayed for me to choose. Regardless of which one I chose, when I expanded it nothing showed up inside the Table, or the Views.
To verify that the useranema and password did have access to the tables I am interested in, I wrote a short Java method to connect to the database and display the ResultSet for a query. It worked as expected. Why was the netbeans database explorer unable to find the tables?
I was hoping to use this tool to generate Entity classes with Netbeans, but apparently Microsoft SQL erver won't have it. I am using netbeans 7.1; documentation for the database explorer tool is found on db.netbeans.org
Yesterday I had the same problem with JDBC driver from Microsoft. I tried another one, the project jTDS (available on SourceForge). It could solve my problem. Some forums recommend always to use this driver because it is much faster.
I just tested and redeployed my application to a test instance, and it worked fine, then i changed the app id and redeployed to my production instance, and I get an indexing problem. How do I avoid this in the future? I went to the effort to test it first and it worked fine!
Uncaught exception from servlet
com.google.appengine.api.datastore.DatastoreNeedIndexException: no matching index found.. <datastore-index kind="Article" ancestor="false" source="manual">
<property name="tags" direction="asc"/>
<property name="created" direction="asc"/>
</datastore-index>
at com.google.appengine.api.datastore.DatastoreApiHelper.translateError(DatastoreApiHelper.java:40)
at com.google.appengine.api.datastore.DatastoreApiHelper.makeSyncCall(DatastoreApiHelper.java:67)
The admin console says that it is "Building" the index. It has said that for 20 minutes now! How long does it take!?
When you create new queries, and use them for the first time on your local machine, they always work first time. When you run these new queries for the first time on google app engine, they will return this exception because the google app engine servers take some time to generate an "index" to allow your query to work properly.
I would recommend when you create new queries, to give them a once off run in the production environment to get the "index" built, so that when your users hit them, they work first time.
Secondly,manually pre defining your queries before you need them and uploading them to the server, means that when you really need them they may be built on the server already.
The way I work around this problem is to maintain a number of versions for my app.
Typically something like this:
Version 1: Current Default
Version 2: Next release
When I have a new release ready for deployment, I upload it to version 2 in this instance. Once the indexes have been built I make version 2 the default. This way customers never experience any downtime or errors.
So in essence you could swap between version 1 and 2 when releasing a new version.
I would suggest that you do also pre-test within a different testing "Application" prior to uploading to your deployed "Application".
This happens because the app-engine Data Store Indexes are not initialized i.e. corydoras's answer is correct. I am adding my fix for java [I presume python and the index.yaml have a similar fix].
You can see which indexes are serving on your using your Google account on https://appengine.google.com/ . click the app link on the left and on the left menu choose Datastore Indexes under data
When one makes a new query to the datastore it can take hours for the data indexes to be updated.
First you should know that debugging in the local environment creates a file called datastore-indexes-auto-xml every time a new "Kind" of entity is stored.
In the local environment it can be used instantly for a query but there is a delay in updating the datastore-indexes-auto-xml.
When deploying an application to the appengine the auto generated datastore-indexes-auto-xml is submitted and the data indexes are updated much faster [to see the results refresh the page].
So
Make sure none of your Entities have illegal signs e.g. '&'.
Open the Data Indexes view on appengine.google.com.
Make sure you havn't deleted the datastore-indexes-auto-xml. [I do this routinely]
Store an Entity of each "Kind"!
Use all the "Kinds" in Queries!
Make sure the datastore-indexes-auto-xml is updated [I sometimes even restart eclipse]
Deploy to appengine.
Refresh Data Indexes view on the browser.
Wait until you see the indexes
Please tell Google to fix this.
This was informative but didn't work for me: enter link description here
This was also informative but didn't work for me: enter link description here
Check your index.yaml file and make sure the proper indices are specified there, etc.
I'm considering using HSQLDB version 1.8.x in a desktop app for storing local data. From what I can see, the database is stored on disk as a number of SQL statements to create the tables, insert the data, etc.
Is there a simple way I can hide this from users? I'm don't necessarily need it to be completely encrypted, etc - I'd just like to prevent the casual user from simply opening the file and seeing the structure of the database.
You could embed your database files within a jar file and connect to them using the notation:
jdbc:hsqldb:res:<path in jar>
Check out the Advanced Topics section of the HSQLDB guide for more information on this. However, I've never tried it so am not 100% sure it will work ...
The solution I've gone with for now is to call:
db.update("SET SCRIPTFORMAT COMPRESSED;");
to store the .script file in a human-unreadable form and:
db.update("SET PASSWORD password;");
to prevent more savvy users from opening the DB using their own HSQLDB client.
Unfortunately I was not able to execute below command
db.update("SET scriptformat COMPRESSED");
And was getting this error
java.sql.SQLSyntaxErrorException: user lacks privilege or object not found: SCRIPTFORMAT
This error solved with this command
db.update("SET FILES SCRIPT FORMAT COMPRESSED");
I am using HSQLDB 2.3.3