How to create a directory in linux application server using oracle forms 12c - oracle

I have a requirement to create a directory at run time in linux application server and create a report in that directory. I'm using the below command but its not working. Can you please advise?
webutil_host.host('mkdir -p '||'/BEE/temp/rdf');

As I mentioned in your Oracle Forum post, WebUtil is for working with function on the user tier. So unless your user is running a Unix/Linux OS, you code won’t work. Remove the Webutil part of the call and just use HOST.
https://community.oracle.com/tech/developers/discussion/4483447/not-able-to-create-a-directory-in-linux-application-server-using-oracle-forms-12c
Also, as some mentioned above, it is unclear why you have the pipes in you code.

Related

Executing Host commands using PLSQL

We wanted to know if we execute unix host commands from PLSQL program.
Does this invoke host commands in oracle DB installed OS or we can invoke host commands for different servers? Please suggest.
Have not tried any solution, need suggestions/inputs before implementation.
edit
Our requirement is like we have an application that has app layer and database layer. App layer contains application related programs which interact with database layer for any database information. App layer and database layer reside in different hosts (different ip addresses). Application related programs are unix shell scripts that interact with file system.
Client requirement is that instead of shell script interacting with file system, PL/SQL code should do the work so that we have complete security.
Solutions suggested by Xing and Ozhan are in direction of Java code interacting with file system and providing the related information. Filesystem interaction is done using the host command program in Java. My question is if we run the host commands using java program in app layer will it connect to file system of app layer or will it connect to file system of database layer? We want file system layer of the client system connected, not the database server.
Hope I have articulate my requirement. Please let me know if you need any other info.
Answer is yes and no
YES -> using sqlplus you can run host command from the machine you connect from.
NO -> when using utl packages it always redirects to the db machine/server
eg:
after connecting from sqlplus from windows/linux from local machine; you can do this
host mkdir abcd
host ls *.log
Strictly speaking, you can't execute host commands from PL/SQL.

Create an H2 Database from the console

I would like to run H2 on my local host (Windows), and create a new database.
To do so, I have dowloaded the zip file from http://www.h2database.com/html/main.html, unzipped it, then run the bin/h2.bat script. I have not used the windows installer, as the machine I will be running later on does not grant me installation privileges.
The console was successfully opened on the 8082 port, but I could not create any database, failing with Database "C:/Users/PC/test" not found [90013-198] 90013/90013. I have tried many variations, to no avail.
The documentation states that a database should be created automatically if it does not exist, but indicates it cannot be done so from the H2 console (http://www.h2database.com/html/tutorial.html#creating_new_databases).
However, the documentation does not provide an alternate way to create a database, either by running the jar with additional parameters, or by another utility.
I feel pretty dazed right now. How do I properly create a new database in H2? I would like a normal database, persisted on disk, not an in-memory one.
I would suggest that this does not work in version 198
You could download an older version (I used 196) to create the databse and then switch back to 198 to open the database.
I have managed to run it by using the following command line:
java -cp h2-1.4.198.jar org.h2.tools.Server -tcp -pg -web
I must have missed something in the documentation, sorry about this.

firebird, Bad File Descriptor/Your user name and password are not defined

I am trying to set up a test environment on my mac (os 10.12) and it requires Fishbowl/Firebird DB. No matter what I do i bounce back and forth between these two errors:
isql localhost:/Users/me/Fishbowl/database/data/EXAMPLE.FDB
which gives me:
Your user name and password are not defined. Ask your database
administrator to set up a Firebird login.
And anything to do using gsec to create user or change password:
And:
Statement failed, SQLSTATE = HY000 operating system directive stat
failed
-Bad file descriptor
This is supremely frustrating. Fishbowl Client itself seems to hit this DB just fine. I have chmod 770 the /tmp/firebird directory and even tried to chown the example.fdb file itself.
Can anyone tell me how I might hit this DB from my java app or commandline? Both ways produce these errors.
1) Your connection line starts with "localhost:". That means you user TCP/IP connection to reach the database server. And the database server is running in a separate process. That means chmod and chown should not matter as long as there is firebird daemon server running and listening at TCP port ( default is 3050 AFAIR, you can read the value of your installation in the text file firebird.conf ).
Indeed, there is so-called "embedded server" or "embedded mode" where the server is loaded as DLL/SO library into the application. But then the connection string can not have network protocol prefix, so that should NOT be your case.
2) You can check documentation at http://firebirdsql.org/manual/isql-switches.html to specify your user and password in the isql command line. The Firebird has one built-in superuser, namely "SYSDBA". Regarding the password it might be a bit complicated.... It differs by Firebird version and platform
2.0) whatever SYSDBA password might be set by the server installation, if server comes in a bundle with some application the said application can override it later. Then you would either have to contact application developers or try to remove the bundled FB and install your own vanilla one, risking rendering the application no more functioning.
2.1) Windows installation of FB 2.x sets the "default" SYSDBA password as "masterkey" (only 8 first symbols actually matter)
2.2) Linux installation of FB 2.x generates a random SYSDBA password and saves it into a text file in Firebird folder.
2.3) MacOS ? Don't know. Perhaps it is closer to Linux than to Windows. So try to find such a text file and try "masterkey"
2.4) With FB 3 the authentication methods and configuration was greatly overhauled, so... So it is quite hard to tell something specific. At least for me.
3) I don't know what Fishbowl ever is, but Google suggests this: https://www.fishbowlinventory.com/wiki/Fishbowl_for_Mac
If that is so, then check the bottomline examples at that page. They stress that you should sudo all those commands. That also makes sense because
3.1) Firebird daemon might have "trusted authentication" enabled, mapping FB users to Operating System users. On UNIX that would at least map SYSDBA to root. On Windows - to Administrator (however it is localized). This does not have to be enabled, but if it is then sudo UNIX command is exactly what makes applications run with OS superuser grants and might explain lack of user and password in the command line examples.
3.2) Firebird embedded server/mode work as part of an application process, and especially with CS (Classic Server) package on UNIX the command line utilities tend to fall into this mode. Then again it needs to be run as root to read highly sensitive data from Firebird Security Database, thus the need to sudo the command. Granted, I do not think your isql command might ever run in embedded mode - because you do specify "localhost:' prefix. But the example at the wiki link above - backup and restore - they use local connection strings, so they probably do run as embedded. So that might give you yet another hint - to try remove "localhost:" prefix from the connection string and to sudo isql rather than running it from regular user. It would hardly be a normal mode, but for test purposes why not.
Hope this helps.
PS. you might also try this Firebird IDE - it is simplistic, but again, for testing purposes... http://www.flamerobin.org/dokuwiki/wiki/manual

tns not resolving correctly through webservice

I realise there are some similar questions on here already but I couldn't see one that matched my problem so I'm afraid I had to ask a new question.
I have a webservice running on a server, which is throwing a ORA-12154: TNS:could not resolve the connect identifier specified" error. However when I log onto the said server i am able to tnsping the entry successfully, and connect to it via sqlplus, but not through the webservice.
If anyone has any suggestions as to things to look for then I would greatly appreciate it.
Cheers
Some other things to look at include:
If you're using a service name instead of SID, are you specifying the entire service name?
If you're using the ORACLE_SID environmental variable, check the case (mydb vs MYDB)
Check for a sqlnet.log file
If you're using a username/password#SID connect string, you may need to quote your password if it contains special characters (like an # symbol).
The webservice can't find tnsnames.ora which usually means that you didn't set up Oracle's environment properly when starting the process. This usually means you didn't source oraenv.sh in the shell script which starts it.
So your interactive login works - what is different between your interactive login and the user that runs your web service?
Are they the same user? If not then you will need to update some of your configs in order to make the Oracle client files available to the webservice.
Details like Operating System, Oracle Version, etc are always a help.

Can you connect to a MS Access database from Ruby running on a Mac?

I'm pretty sure the answer is "no" but I thought I'd check.
Background:
I have some legacy data in Access, need to get it into MySQL, which will be the DB server for a Ruby application that uses this legacy data.
Data has to be processed and transformed. Access and MySQL schemas are totally different. I want to write a rake task in Ruby to do the migration.
I'm planning to use the techniques outlined in this blog post: Using Ruby and ADO to Work with Access Databases. But I could use a different technique if it solves the problem.
I'm comfortable working on Unix-like computers, such as Macs. I avoid working in Windows because it fills me with deep existential horror.
Is there a practical way that I can write and run my rake task on my Mac and have it reach across the network to the grunting Mordor that is my Windows box and delicately pluck the data out like a team of commandos rescuing a group of hostages? Or do I have to just write this and run it on Windows?
Why don't you export it from MS-Access into Excel or CSV files and then import it into a separate MySQL database? Then you can rake the new one to your heart's content.
Mac ODBC drivers that open Access databases are available for about $30.00
http://www.actualtechnologies.com/product_access.php is one. I just run access inside vmware on my mac and expore to csv/excel as CodeSlave mentioned.
ODBC might be handy in case you want to use the access database to do a more direct transfer.
Hope that helps.
I had a similar issue where I wanted to use ruby with sql server. The best solution I found was using jruby with the java jdbc drivers. I'm guessing this will work with access as well, but I don't know anything about access

Resources