When i execute SQL "LOAD TABLE ...USING CLIENT FILE..." to Sybase IQ database in tomcat's apps,
get this problem"Operation failed on file due to file permissions,hos_clientfileio.cxx 142".
But when i run the piece code in a single java file (not under tomcat), the LOAD TABLE can
succeeded.
what's the cause?
Thanks in advance.
After many tries , i found the problems , i execute the following statement together.
set option allow_read_client_file='ON'
"LOAD TABLE ...USING CLIENT FILE..."
When execute them separatly, the poblem gone.
Related
I've been trying for the last week or so to make integration tests work on travis for a school project. I've debugged a fair bit of the project but now I'm blocked and need external help.
To give a bit of context, so far, I've debugged the java project so that the tests can be launched from eclipse or from maven in command line. I've worked on the travis file so that a database is created, the database scripts run and the java tests launch. However, the tests fail on travis because of a "table missing" in the database.
This is a link to our repo.
This is the travis.yml file's code:
language : java
jdk:
- oraclejdk8
service:
- mysql
before_script:
- mysql -e 'DROP DATABASE IF EXISTS koalatest'
- mysql -e 'CREATE DATABASE IF NOT EXISTS koalatest;'
- mysql -u root --default-character-set=utf8 koalatest < backend/koalacal-backend/koalacal.sql
script: cd backend && cd koalacal-backend && mvn test -X
after_success:
- bash <(curl -s https://codecov.io/bash)
The java project that is being built and run by maven is located under rootfolder -> backend -> koalacal-backend.
Here is a link to the error log maven produces on travis.
This line seems to be the source of the error:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'koalatest.Calendar' doesn't exist
I have two hypothesis:
1- The sql script that creates all the tables is not being run properly by travis.
To test this hypothesis, I changed the name of the script called by travis. As expected, I got an error saying that travis can't find the file. So at least, I know that this line of code causes travis to look up at an sql file.
- mysql -u root --default-character-set=utf8 koalatest < backend/koalacal-backend/koalacal.sql
That being said, I have no idea if the file is run properly on the database.
For the sake of putting all relevant informations in this post, here is a link to the database script.
2- The tests can't connect properly to the database.
Here is the config file that contain the info regarding which database to connect to:
TestInstance=true
user=root
password=
serverName=localhost
databaseName=koalacal
portNumber=3306
testUser=root
testPassword=
testServerName=127.0.0.1
testDatabaseName=koalatest
testPortNumber=3306</code>
If the parameter TestInstance is set to true, the tests take the informations testUser, testPassword, testServerName, testDatabaseName and testPortNumber to connect to the relevant database.
I believe the connection informations currently contained in the config file match how the travis documentation says we need to connect to a mysql database. I tried to change the testUser to something invalid (like root3) and got error messages as expected.
Maybe somehow the tests can't connect to the database and don't produce a related error message, but I doubt it.
Can someone look at my problem and see if I've missed something obvious (or not)? I don't know what else to try and I don't want to be blocked one more week on a technical issue.
For anyone who may google travis mysql and has a similar error to the one I had, I solved my problem.
The error was caused by a case sensitivity issue. The java code tried to connect to tables like 'Calendar' and 'Event' while the sql script created the tables 'calendar' and 'event'.
It took a long time to troubleshoot this because the case sensitivity didn't pose any problem on my machine. Maven can run its tests properly without any issue. It's only on the travis servers that case sensitivity of the tables started to matter.
I need to run queries of Ms Access file and the problem is that there is not any sql code to execute from my java code. When I try to see sql code of query
The SQL statement could not be executed because it contains ambiguous
outer joins
alter is shown. So i must call and run queries. I tried to open and run spesific queries by cmd .bat file. However I cannot find any script for solution. Is there any sql code to run any query from another query? if it is possible it can help me. How I can solve this problem?
You could call/run a macro in an Access-database from a bat-file and the called macro could run the query via the macro-command OpenQuery.
Lets say you name your macro mRunQueryX in Access, within the macro you define the commands:
OpenQuery (with the appropiate parameters) and QuitAccess (This closes Access after it is started from the bat-file.
Now from your cmd/bat-file you call/run the macro with:
"C:\Program Files\Microsoft Office\Office12\MSACCESS.EXE" "[PathToDatabase]\[NameOfTheDatabase].accdb" /X mRunQueryX
The path to MSACCESS.EXE varies with the Office-version.
I have a problem with the full text search database generation in javaHelp. In order to generate the db I have to execute a command from a batch file:
java -cp jhall.jar com.sun.java.help.search.Indexer -db .\JavaHelpSearch .\html
This only works if the batch file is in the same directory of the html directory containing the files to index. I have tried to execute the batch file from an external location using absolute paths:
java -cp jhall.jar com.sun.java.help.search.Indexer -db C:\help\JavaHelpSearch C:\help\html
The db generation give no erros, but if I search a word in the javaHelp window I get the following error:
Failed to create URL from file:/C:/help/myHelp.hs|C:/help/html/myhtml.html
I have spent a lot of time facing this problem, without success. What I really need is to call the Indexer class directly from my Java application, but the same problem happens there.
I developped my application locally with the default in memory h2 database. Everything works perfectly.
Now I tried to deploy my app by pushing to Heroku.
Before that I added a Procfile to my app's root folder with this line:
web: target/start -Dhttp.port=${PORT} -DapplyEvolutions.default=true -Ddb.default.url=${DATABASE_URL} -Ddb.default.driver=org.postgresql.Driver
My application.conf looks like:
db.default.driver=org.h2.Driver
db.default.url="jdbc:h2:mem:play;MODE=PostgreSQL"
So I pushed that and then, when I try to access my app i get:
Salieri:addressManager administrator$ heroku ps
=== web (1X): `target/start -Dhttp.port=${PORT} -DapplyEvolutions.default=true -Ddb.default.url=${DATABASE_URL} -Ddb.default.driver=org.postgresql.Driver`
web.1: crashed 2013/06/27 22:04:16 (~ 4m ago)
and in the heroku logs:
2013-06-27T20:04:14.511136+00:00 app[web.1]: [error] play - ERROR: syntax error at or near "user"
2013-06-27T20:04:14.515578+00:00 app[web.1]: at play.api.db.evolutions.Evolutions$.databaseEvolutions(Evolutions.scala:334)
2013-06-27T20:04:14.515153+00:00 app[web.1]: #6emdb57b1: Database 'default' is in inconsistent state!
I tried to delete the whole db with
heroku pg:reset HEROKU_POSTGRESQL_ROSE_URL
and then i pushed again, but no success.
I have to mention that I did a push before, and at that time my app was running on Heroku. The only problem was, that i couldn't log in with the credentials provided in my fixtures (Global.java file with a job on app start).
Any suggestions?
From this error:
ERROR: syntax error at or near "user"
I guess your Evolution scripts are wrong. User is a reserved word in SQL. PLease try to run the Evolution scripts locally in a dev PostgreSQL database. Once working, you can try to deploy again.
I'd also suggest disabling evolutions for production apps, it's a risky system sometimes.
PostgreSQL interprets user as a keyword. If you have an app/models/User class in your app, play will try to create a table named user. The easiest way to avoid this is to rename your User class to something like MyUser. (The same might happen if you use an attribute named user in one of your classes. Here, as well, you should rename it).
Then you should run your application locally and open it in the browser in order to get the evolution script file updated. You can then find the evolution script at conf/evolutions/default/1.sql. According to this example, it should create a table named my_user now.
I am writing a batch file with the command db2cmd/c /w /i db2 DROP DATABASE xyz with DB2 and Windows 7 through java.
db2cmd is unable to delete the database and returns the error:
The requested operation cannot be performed on a file with a user-mapped section open
How do I fix this?
and
There are no open connections present while executing the command as this command is creating problem only in windows 7.
It's possible that there are open connections to the database that are blocking the operation. Try issuing these commands first:
db2 CONNECT TO xyz
db2 QUIESCE DB IMMEDIATE FORCE CONNECTIONS
Here are details on the QUIESCE command.