Is it possible to take input from a file in NotesSQL - lotus-notes

For example I have to run a query to fetch data for a list of part numbers.
The list is very big say 1000. So I do not want to give all the part numbers in the query instead want to take it from a file say .txt or .xls
Is It possible with Notes SQL?

Why use Notes SQL to import data from a text file into Notes? Just write a Lotusscript agent that does the import.

Notes SQL is just a driver that maps SQL queries onto Notes and Domino databases, views, and documents. It's up to you to construct the queries and run them somehow.
There's nothing in the syntax of NotesSQL that can take input from files.
If the program that you are using to generate and run the Notes SQL queries has the ability to read files and use the contents of a file to modify the query before giving it to NotesSQL, then the answer is yes, it's possible to do what you want with Notes SQL.

You have it all backwards. NotesSQL lets you query (pull data out of) a Notes database (.nsf) using ODBC. That way any software that can connect via ODBC has access to Notes data. It doesn't allow importing data into Notes. To get the data into Notes you'll need to either write a script or use something like IBM Enterprise Integrator (IEI, formerly LEI, formerly formerly Notes Pump.)

Related

How do I create a file from a result set?

I'm using Oracle 11g
I'm trying to create a flat file (CSV or TXT) from a result set but am struggling on where to even start. It seems like I have to create a stored proc and use UTL_FILE. After doing some research, I have two questions:
Where does the file get created? According to this question I need to get access to the Oracle user directory, but where is that on a Windows and Linux environment? I have to test on Windows , and the script will eventually be on a Linux environment.
What would be the basic format of a SQL script to create the aforementioned file, and load data into it from a fairly basic SELECT query? I'm not seeing a UTL_FILE function to write the records to the file; do I have to iterate through the entire result set and use PUT or can I somehow just push the entire result to a file?
I think using "spool" can do the trick.
Check this out https://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:9518534700346581975
And more information is here http://www.dba-oracle.com/t_sqlplus_spool.htm
The file will get created in the directory where you launch sqlplus from.
If you're using SQL Developer you can create a view for your query. Right click view in schema browser and choose export and export as csv.
But personally I would go for spool as previous answer said. SQL Plus is most basic client so I don't believe you won't have it.

Though deprecated, is DAO still used for automation of Access databases from Excel?

I'm trying to wrap my head around it. I've checked other questions and nothing seems to be too similar.
The Office 2013 development centre contains extensive DAO examples and states it is one of the easiest ways to work with an Access file (does not require an Access window) but DAO is a deprecated technology. (https://msdn.microsoft.com/en-us/library/office/ff834801.aspx)
I'm trying to write an Excel Add-in (eventual end point) that will grade Access assignments in .accdb format.
I'm can't just use ADODB to perform SQL queries to extract data, unless SQL can also do the following:
check a specified report has a specified title
check that specified tables, queries, forms, and reports exist
check specific fields in a table exist
check that specific fields have been set as the Primary Key
I also need to check that certain values exist in a table, but those I can solve with SQL.
So should I be using DAO or stick with ADODB? Remember, I'm using Excel, not programming in Access VBA.
The simplest way to work with excel tables is to link them in Access either manually or via the TransferSpreadsheet function in VBA. If you use a generic naming standard for the file names and tab names in Excel, you will not have to relink, rather you can replace the Excel file and the Access link will read the new file unless the layout has changed.
Once linked you can use the query-by-example tool to write your queries which also can be written into code (i.e. either embedded in the VBA [old school and not a best practice] or saved in an Access table then looked up and assigned to a variable for use with the CurrentDb.Execute strSQL, dbFailOnError command.
I suggest manually linking the first go round so you can manually define the individual column types vs. letting Access mess it up.
If you cannot use generic names and have to pick the file via a browse dialog, you can get a file browse function via Google to allow you to programatically link the file. (or you can rename it to a generic name which works even better)
So DAO vs. ADODB is moot from an Access perspective. I supported 50 databases with 70,000+ lines of code and dozens of Excel source files the past 4 years and never had to ponder the question.
Microsoft originally deprecated DAO in favor of ADO, but recently renamed DAO to Microsoft Access Engine (ACE) and is now pushing it as the preferred data access technology for Automation-supported environments (VBA, WSH etc.)
In general, in your scenario I don't think it makes much of a difference which one you use. I suggest you read through this.
I don't think it's possible to read table/query/field information via SQL. However, this can be done either with the DAO.TableDefs and DAO.QueryDefs collection, or the ADO.OpenSchema method.
RE: forms/reports - I don't know if it's possible to read form/report information via DAO or ADO even without SQL, as it is actually part of the UI objects, and not the data; unless we're talking about reading/parsing the system tables. You may have to open the database in a hidden Access instance and read the forms/reports that way.

Convert IBM Lotus Notes file to text

How can I convert an .nsf lotus file to a text file? i want to write a java program to read .nsf file which is on my system. i have tried it simply but it is showing non english character is their any way to get access them normaly.
EDIT:
That code is in .net and using any server's session, I just want to read .nsf file by java without creating any server's session in fact i have .nsf database. i just want to read as a text file.if there a way to parse .nsf with javacc,it would be better enough......
lotus notes database is full of proprietary design components. Assuming you just want to export the data, you will need to write an agent, (aka batch process), that would look at all documents in the database and then export all the fields into a plain text file.
If you're into XML, you can export data in that format as well, but again, you will need to write an agent for that.
Alternatively, there are some basic builtin mechanisms in Lotus Notes to export data but this is restricted to running them from views. Views do no necessarily get all the documents. You can design a view to do that though.
Providing the size of the database is not extremely large, (less than 200k documents), you can create view listing all the columns you want to export and a view formula that has "Select #All", will give you all documents. Then, the "quickest" way to get data out from a view can be found here using simple export procedure.
There is still the issues of exporting rich media, you can have a look here for that.
You can export some data easily by selecting all the documents in a view, and then going to Edit > Copy Selected As Table. Then just paste the content into Excel or a text file.
To access the data beyond what is showing in a view, you can try a few other things:
Connect to the data using the NotesSQL driver
Connect via the COM api (using Java, C#, VB, etc)
Create some views in Lotus Notes that DO have the data you need, and use my recommendation above.
Install and and my Export to Excel application

Cannot connect csv to Excel thru ODBC

HI;
I cannot connect a CSV file to a SpreadSheet when the file is open. Currently a have a csv log file that is being constantly updated. I was able to connect it a an Excel SpreadSheet by normal import from external source with refresh every hour. However, its a big file so I needed to produce the reports using EXCEL SQL. It will not allow me to connect to the file while it is open. It says that the MS Jet database engine cannot open the file'unknown'. It is already opened exclusively by another user or i need permission to view its data. If granting permission is he problem , where do I grant myself permission. On a standard Impor, I have no problems reading the file while it is open, but otherwise, get this message and cannot proce3ed. Any help would be appreciated. If I close the update program, I am able to run the queries, but not if the update is running.
Using MSO 2007 W7 x64
It will not allow me to connect to the file while it is open.
That's right, it won't - there is no way to change this.
You must find another way to solve your problem.
How big is the file? You may be able to make a copy to a temporary filename, and connect Excel to that instead.
It sounds like you are accessing a logfile. LogParser can read CSV. In any case LogParser has an excellent SQL-like syntax and can read CSV files much more quickly and reliably than ODBC. It is also programmable from Excel VBA (or script). Perhaps you can use LogParser to extract the values of interest and then load those into your Excel table instead.
I suspect your best solution will be to use the LogParser MSUtil.LogQuery object from Excel VBA, to extract the values of interest into your spreadsheet. Since I don't know what you are actually doing this is just a guess!
I cannot recommend LogParser highly enough - it is a wonderful tool, and can read just about every standard type of logfile, CSV, TSV, W3C, as well as plain text files and the windows NT event logs:
LogParser 2.2 Download: http://www.microsoft.com/downloads/en/details.aspx?FamilyID=890cd06b-abf8-4c25-91b2-f8d975cf8c07&displaylang=en

Exporting data from Lotus Notes: C# interop, C, Java or LotusScript?

I'm about to export a lot of data from a Lotus Notes db, and I'm wondering if anyone can shed any light on how exactly I can move forward on this point.
Notes has some views (lists with custom templates?) of some kind - are these saved in .nsf files on the Domino server, or are the .nsf files for email only?
If the .nsf files are actually the database files, what would be the best language / development pack to use to pull data from them?
If you need full-time synchronization between an existing Notes infrastructure and a RDBMS, LEI (Lotus Enterprise Integrator) or a third-party tool like Notrix would be your best bet -- it's as simple as defining a job and a schedule/trigger to run it. If you need to occasionally pull (or push) a subset of the data, then NotesSQL is probably the easiest approach. If you're not afraid of learning the structure of the NSF (Notes Storage Facility), then the LotusScript/COM API or the Java/CORBA API would give you finer-grained control.
If what you really need is a one-time dump of everything, then exporting all of the data notes to DXL (Domino XML) would give you the most complete version of the data you're going to get, and in a way that would let you recover and convert formatted Notes Rich Text, file attachments, and so on in a way that would be incredibly difficult to achieve otherwise. DXL is verbose, so don't say I didn't warn you, but it is pretty comprehensive as well. (The DOmino Designer Help entry on the NotesDXLExporter class has example code that is exactly on point.)
It all depends on what language you're familiar with.
If you know LotusScript well, then that would be my first choice since it's the most integrated with the platform.
If you don't know LotusScript that well, but you know C#/Java/C really well...then you shouldn't have any trouble using any of those APIs (and they should all be able to get the job done equally as well).
In Lotus Notes Domino all the data is stored in the .nsf files. This is true for all Notes databases, not just email. The data is all stored in documents which are basically collections of named fields containing values. The views are simply ways of indexing and displaying collections of documents based of specific criteria. The views can also calculate values based on the value of a field in the documents.
The Notes LotusScript and Java APIs are essentially identical and would be the simplest way to programmatically access the data. The C API is much lower level and probably overkill for this kind of thing.
You could look at NotesSQL, if you want to create an ODBC connection to an NSF file to pull data into SQL or Access. If all the data is contained within the view you could simply select all the documents and click Edit > Copy Selected As Table and paste into Excel.
To answer your other questions: Notes views are similar to SQL views - essentially a query on the data stored within the NSF. NSF files contain both the data and the structure of the application in one file.

Resources