Java run Ms Access query - java

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.

Related

Unable to execute Snowflake PUT Command through Java

We are trying to load JSON files using Java from a file location to Snowflake Named Stage. Currently, the PUT command only works for ODBC and not JDBC. So is there any way to execute PUT command using Java code?
Thanks
The Snowflake JDBC Driver does support use of PUT statements for local file uploads. The following java statement is considered a valid query and the file is uploaded:
statement.executeQuery("PUT file:///tmp/foo.json #JSONSTAGE/ overwrite=true");
Running it under a logger produces logs such as the following (logs here are from JDBC driver version v3.12.2):
n.s.c.jdbc.SnowflakeFileTransferAgent$1 FINE call:778 - filePath: /tmp/foo.json
n.s.c.jdbc.SnowflakeFileTransferAgent FINE uploadFiles:1751 - Done with uploading
The JDBC driver also supports a more efficient way of uploading a stream directly, documented here.

javahelp indexer for full text search

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.

Jasperstarter Usage

I am trying to utilize Jasperstarter with MSSQL on Windows with a JDBC driver. It seems never to find or connect with this driver for some reason despite using the same Driver and URL used by iReport which does work. I can execute reports that do not access the DB, but once I add the database parameters the call fails. I do not get any info back from the call, not sure where the debug stuff goes. Are there any special path settings that need to be made to get this to work? The exec call output just returns a 1 without any failure info.
PHP exec command stream:
"C:\\Inetpub\\wwwroot\\TekEnterpriseServer\\protected\\JasperPHP/JasperStarter/bin/jasperstarter pr ./reports/maintenance.jasper -f pdf -t generic --db-driver net.sourceforge.jtds.jdbc.Driver --db-url jdbc:jtds:sqlserver://localhost/tekenterprise"
The jdbc driver must be put into the jdbc directory of the JasperStarter installation or the path to the driver jar must be specified with --jdbc-dir.
You have to specify username and password as part of the --db-url, see
http://jtds.sourceforge.net/faq.html#urlFormat
You can get verbose output with:
jasperstarter -v pr ./reports/maintenance.jasper ...

How to generate script file of a database in postgresql with insert queries instead of copy query?

In postgresql, I had taken backup. That file didn't have any insert queries instead it used Some copy statments like
COPY user_customers (userid, customerlist) FROM stdin;
anil customer1:customer2
babu customer1:customer4
srikakulapu customer1:customer2
\.
But i want insert statements of that table....
How could I get the insert statements of table data in backup file?
Besides that I couldn't execute pg_dump command....
I am generating backup file by right clicking on a table by chosing backup option..
Kindly help me out... Otherwise I have to rewrite all the insert queries manually for documentation....
waiting for your help.........
If you use pg_dump , then you can add the -inserts parameter.
Dump data as INSERT commands (rather than COPY).
Source
If you could add the code of your attempt to use pg_dump, we could solve this problem, too.
1.Open command prompt
2.Make it to point to bin in postgres folder
3.execute following command
pg_dump --column-inserts -U postgres databasename>filename
4. File will be stored in bin folder of postgres

Operation failed on file due to file permissions,hos_clientfileio.cxx 142

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.

Categories