OleDbException Cannot open file dbf - visual-foxpro

After I run a query, SELECT SomeColumn FROM SomeTable, via the command window in VFP, I'm unable to access that table from C# using the OleDb Provider until I close VFP.
System.Data.OleDb.OleDbException: 'Cannot open file \\some-server\some-share\SomeTable.dbf.'
It's like VFP is not closing the file handle after executing the query.
How do tell VFP to close the file/table w/o having to close VFP?

use
without any argument closes the table\cursor in current work area.
use in (select('SomeTable'))
closes it in any work area, only if it is open.
Both commands are scoped to current data session. If you are using any sessions other than the default one, then you need to loop those sessions and close in there.
An easier way would be to execute:
set exclusive off
in VFP before opening any tables. Then the tables would be opened shared, and you could open them both from VFP and outside.
Or make that a permanent setting by going to Tools -> Options -> Data and unchecking "Open Exclusive":
BTW, I replied thinking about any table that you would open by using "use" or "select ... from thatTable".
Your question is vague though, maybe you mean the table is created as a result of the query (your query doesn't have that destination though). If that is the case, then the created table is in exclusive use until you close it (using one the commands at top).

Related

How can i close opened cursors in oracle?

i have this problem, into my oracle db i have too much cursor still opened that increase the mamory usage. The cursor was opened by C# and i can't modify the program.
Is it possible to close all cursor open in a session from oracle with a query withous close session?
Only the session that opened the cursor can close the cursor; you cannot close cursors from another session.
This means that your solutions are:
Fix the C# program that opened the cursors. (See java.sql.SQLException: - ORA-01000: maximum open cursors exceeded for some generic advice on this);
Kill the session that the C# program is using, which will automatically close all its cursors (and hope that the application is robust enough to recover and open a new session); or
Change the database settings to increase the maximum number of cursors (this may not fix the problem but it may delay it; however, it may cause other problems if the database starts using too many resources to manage all those open cursors).

Open several SQL Scripts on Toad starup

i am using Toad for Oracle V11.
And i'm already using View>Toad Options> File to execute on new connections to set some parameters when i start a new connection.
Here is also the option File to load on startup, but here i can only select a single file to open on startup. But I always need three different scripts when I open Toad and i don't want to merge them to one file.
Is it somehow possible to always open those three different scripts when i open toad?
You can't do that, as far as I can tell.
See whether creating a project (using the Project Manager; it's the 6th icon in my TOAD 14 toolbar) helps, as you can add folders or folder items (that would be your scripts) to it.

Edit manually (using notepad etc) existing connections' names in SQL Developer Connections pane

I have over 150 database connection names in my SQL Developer connections tab. And now I have to change all due to naming convention change (for my ease of understanding).
Is there a way of editing the connection names (the names with which we store the connection detail) externally using notepad etc ? Or, is it that I have to open up "properties" for each one and change manually in each case. The new names will follow a pattern as did the old ones.
You can right click on Connections and select Export Connections. That will give you an XML file you can edit. Then right click Connections again and select Import Connections. If you change the name, it may import the connections as new ones, rather than renaming them (I'm not sure), so you may wind up with duplicates that need deleting.

SQLite .DB file contents shown in Visual Studio Form DataGridView component

So I have a database file (name.db) on my desktop, as well as a project folder containing my program. I want to create a form to test my program, however I cant seem to get my contents from my database into the form, so I can't even test my code. I try to "connect a database" from the tools menu, but none of the options will allow me to connect my ".db" file.
Below are the images of what I'm trying to do, so you can get an idea.
The Form
The menu of different database options, none of which work
The code for the form
Files on the Desktop
The Problem is, that you never make any requests/queries to your database. Since your database could and most probably does contain mutliple tables you should run a corresponding sql query and then display the result. The following link should give you a good starting point how to integrate sqlite with c++.

Use dbms_output.put_line in Datagrip for .sql files

I started to use Datagrip for my PL/SQL (school) projects that need the use of DBMS_OUTPUT.PUT_LINE. Before this I was using Oracle SQL developer and I was able to use DBMS_OUTPUT by adding the following:
SET serveroutput ON;
There is a related question that shows how to enable or disable showing the contents of the DBMS_OUTPUT buffer but this only works for the Database Console tool window. How can I apply this to any .sql file? Currently, I am copying the content of my .sql files and run it in the Console tool window but there must be a better way.
Turn on this setting in the Output pane:
I second the comment from Prometheos II. Jakob also seems to say the same.
As you might know, the .sql scratch files HAVE to be associated with a console.
You need to toggle the Enable SYS.DBMS_OUTPUT option icon in the associated console and you do see the effect when executing from the associated .sql file.
Steps:
Open your .sql file
Associate it with a console
Open the console and enable Enable SYS.DBMS_OUTPUT option
Go back to the .sql file and run your code. You'll be able to get the DBMS_OUTPUT in the console output.
Suboptimal design by JetBrains, but it works.
My IDE version: IntelliJ 2018.3 Ultimate (DataGrip uses the same code, I think)
Couldn't comment to existing sections due to low rep. Hence, added a new answer.
When everything else fails, read the documentation: Showing DBMS_OUTPUT for Oracle:
For Oracle, you can enable or disable showing the contents of the
DBMS_OUTPUT buffer in the output pane. To do that, use
the apropriate icon (note by LF; can't reference that image) on the toolbar
of the Database Console tool window (Ctrl+F8).
For all that are reading this for version(s) > 2021.1
You can enable the output in the connection properties.
Source
This also works for sql files in DataGrip. Like moscas writes you need to activate the output console toggle button 'Enable SYS.DBMS_OUTPUT'.
Also you need to wrap it with begin end:
begin
dbms_output.put_line('test');
end;
Finaly found it! The previous answer didn't read the question and answer for intelij instead of datagrip which have completely different interface.
For 2021.1 right click on the console list in the service window and there should be a enable DBMS_OUTPUT when you right click.

Resources