Text File Database
Hello,
i am a student at The Open University "APEIRON" Travnik (www.out.edu.ba), i am pursuing a Masters degree in IT, we have one Exam called Java programming.
My practical exam part is to create a program that should enable user to manipulate students grades. The app should allow these options:
- Read students data,
Read students data, needs to ask a user for students name and some ID (Surname etc.), and after that lists students grades and Courses.
- Inserting of new grades,
Inserting of new grades should have option to insert a new Course name, students name and grade for that Course.
- Change of existing grades.
Change of existing grades needs to ask for students name and/or ID, surname and the name of a Course and shows his present grade, Then it should have an option to change students grade for that Course.
For this App all of validations should be done.
All of the data (students names, Course names, Grades etc.), needs to be stored in text file database?! Now, i am a newb to Java, but i worked before with VB, and SQL, and i saw there are some similarities to acces and modify data in SQL database. But the problem is, i never worked with Flat text file databases and now i am stuck, i do not even know how to create a text database or even to connect Java to that database.
Please, if anyone can help me i would be very grateful!?
HaloOo wrote:
i am pursuing a Masters degree in ITPursuing as in commencing, or pursuing as in first/second year undergraduate student. If the former then I am abit worried at your lack of prior research (or is this how you research).
Please, if anyone can help me i would be very grateful!?You will need to invest some time in the basics of programming in Java and OOL. There are multiple tutorials available on reading/writing to text files. One thing to note: a text file is treated in the majority of cases like a wipe board. You can write a whole bunch of stuff on it, but if you decide you want to write a line in the middle, then unfortunately you need to read what is currently on the whiteboard, rewrite it, append your new message, then append the remainding text from the white board. IMHO a (RAF) is not applicable in this situation.
Task1: Java: hello world
Task2: Introductory tutorials
Task3: Read a text file/write a text file/display contents of file
You choose,
Mel
Similar Messages
-
Importing text file databases into address book
I have a large csv formatted (all that easily allowed by my exporting database) that I want to import into addressbook. By the instructions this should work and so I diligently configured the "Text file import" screen to align the fields as they should be imported - and the sample entries shown in that window look and are configured exactly as they should be. However, when I click on the OK button in the "Text file import" window, I could not tell if it was importing one item or the thousands. But when I look at the address book it indicates that it imported all thousands of contacts. THE PROBLEM is that in the address book (which was previously essentially empty) the only items listed under "Names" is "No Name" (a huge number of them) and each one has NO other fields filled in. So it appears that nothing is importing despite that the Text file import screen shows everything set up correctly. Thoughts/help?
My problem is the same as Roderick. Text File Import reads my file and shows me the data that it will import. I dilligently assign all of the appropriate columns and press "OK"...Nothing happens. Any ideas?
-
Read a text file(database) from a servlet for j2me..?
Anyone know how to read data from a text file as a database using a servlet for j2me..?
How to do it..?
Thanks in advance.i tried something like that but there is a NullPointerException... Is what i'm doing correct..?
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
public class LoginServlet extends HttpServlet {
private static final String db_server = "localhost/";
private Connection con = null;
private String content="";
public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException
response.setContentType("text/plain");
PrintWriter out = response.getWriter();
String strUserid = request.getParameter("userid");
String strPassword = request.getParameter("password");
System.out.println("userid received: " + strUserid);
System.out.println("password received: " + strPassword);
try{
System.out.println("opening the file....");
//String url = "file://"+dbServer+"test.txt";
//String uri = "file://localhost/test.txt";
String uri = "file://Program Files\Apache Group\Tomcat 4.1\webapps\Project\WEB-INF\classes\trial\test.txt";
//String uri = "file:/database/res/test.txt";
System.out.println( uri );
InputConnection conn = (InputConnection) Connector.open( uri,Connector.READ );
System.out.println("connection established");
InputStream in = conn.openInputStream();
int ch;
conn.close(); // doesn't close input stream!
System.out.println( "Contents of [" + uri +"]" );
while( ( ch = in.read() ) != -1 ){
System.out.print( (char) ch );
in.close();
catch( ConnectionNotFoundException e ){
System.out.println( e.toString()+"File could not be found!" );
System.out.println( "File could not be found!" );
catch( IOException e ){
System.out.println( e.toString() );
catch( Exception e ){
System.out.println( e.toString() );
out.close();
} // End try
catch (Exception e) {
System.out.println("Exception in doPost(): " + e.getMessage() );
} // End doPost
} // End loginServlet -
Help needed in reading text file to database table
Hello experts,
i have to insert the values from the column of this text file and insert them in my database table.
I have done a few file to table insertions but i'm having some trouble with this one.
Any suggestions plz
thanks
liab_report 1.00 Page: 1
CDC:00537 / Mon Jun-21-2010 LIABILITY REPORT Mon Jun-21-2010 22:06:26
DRAW 1; SET 1; November 7, 2009
TOTAL PAID ON TOTAL EXPIRED ON TOTAL FRAC OUTSTANDING
WINNERS 06/21/10 PAID 06/21/10 EXPIRED ROUND
DIVISION AMOUNT AMOUNT AMOUNT AMOUNT AMOUNT AMOUNT AMOUNT
Div1 0.00 0.00 0.00 0.00 0.00 0.00 0.00
Div2 701040.00 0.00 660146.00 0.00 40894.00 0.00 0.00
Div3 1444128.00 0.00 1330056.00 0.00 114072.00 0.00 0.00
Div4 4711900.00 0.00 3889700.00 0.00 822200.00 0.00 0.00
6857068.00 0.00 5879902.00 0.00 977166.00 0.00 0.00
DRAW 2; SET 1; November 14, 2009
TOTAL PAID ON TOTAL EXPIRED ON TOTAL FRAC OUTSTANDING
WINNERS 06/21/10 PAID 06/21/10 EXPIRED ROUND
DIVISION AMOUNT AMOUNT AMOUNT AMOUNT AMOUNT AMOUNT AMOUNT
Div1 0.00 0.00 0.00 0.00 0.00 0.00 0.00
Div2 817817.00 0.00 817817.00 0.00 0.00 0.00 0.00
Div3 1687405.00 0.00 1611742.00 0.00 75663.00 0.00 0.00
Div4 3402100.00 0.00 3034200.00 0.00 367900.00 0.00 0.00
5907322.00 0.00 5463759.00 0.00 443563.00 0.00 0.00
DRAW 3; SET 1; November 21, 2009
TOTAL PAID ON TOTAL EXPIRED ON TOTAL FRAC OUTSTANDING
WINNERS 06/21/10 PAID 06/21/10 EXPIRED ROUND
DIVISION AMOUNT AMOUNT AMOUNT AMOUNT AMOUNT AMOUNT AMOUNT
Div1 0.00 0.00 0.00 0.00 0.00 0.00 0.00
Div2 779933.00 0.00 769804.00 0.00 10129.00 0.00 0.00
Div3 1605548.00 0.00 1525104.00 0.00 80444.00 0.00 0.00
Div4 4891700.00 0.00 4256800.00 0.00 634000.00 0.00 900.00
7277181.00 0.00 6551708.00 0.00 724573.00 0.00 900.00Plz clarify whether u want to load text file as a file into database or value of this text file into database. If values are to be loaded from this text file, U can better format the text file and use SQL loader to load the file into database. By formatting the database, i mean remove the unnecessary headings and characters, kee only the values to be loaded idelimited by ' '(space) or ','(comma). Create a control file and load it into the target table.
-
Importing text file into database
Hi again,
Could anyone give me any pointers on how to take a text file or csv file (or any other delimeted text file) and read the contents into java and then use the read in data to then insert the delimeted data into the table.
i assume i have to read the delimeted data into a variable then parse the complete string with the delimeter and split the data up maybe in an array. Maybe this is completely wrong, im really unsure.
any help would be greatly appreciated even a point in the right direction would be great :)
kind regards.Well, atleast i dont know of a single method, which does this kind of nonhomogenous task!! Its not hard to impliment what you want-->
//open the text file using FileInputStream & get the contents in a String variable
//Tokenise it
StringTokenizer st=new StringTokenizer(your_string_retrieved_from_file,delimiter);
int i=0;
while(st.hasMoreTokens())
i++;
//SQL Statement that inserts a string into database table(integer, varchar2)
insert into test_table values(i,st.nextToken());
Unless you are talking about putting the tokens as coloums in a single row, i dont find why this is a problem & if you are actually doing the above case, then you might wanna rethink your design -
Cannot get text file to print in jtable. Using text file as a database
Instead of doing JDBC i am using text file as database. I cant get data from text file to print into JTable when i click find button. Goal is to find a record and print that record only, but for now i am trying to print all the records. Once i get that i will change my code to search desired record and print it. when i click the find button nothing happens. Can you please take a look at my code, dbTest() method. thanks.
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
import java.util.*;
import java.io.*;
public class GUIdirectory extends JFrame
implements ActionListener {
// Define the components and the layout
JLabel inputLabel_lastname = new JLabel("Last Name");
JTextField inputText_lastname = new JTextField("Last Name",15);
JLabel inputLabel_firstname = new JLabel("First Name");
JTextField inputText_firstname = new JTextField(" ",15);
JLabel inputLabel_middleinitial = new JLabel("Middle Initial");
JTextField inputText_middleinitial = new JTextField(" ",4);
JButton inputButton = new JButton("Find");
JPanel inputLayout = new JPanel(new FlowLayout(FlowLayout.CENTER,5,5));
JButton jButton1 = new JButton();
//create a new table and scrollpane
JTable dataTable = new JTable();
JScrollPane dataTableScrollPane = new JScrollPane();
public static void main(String args[]) {
GUIdirectory gui = new GUIdirectory("Telephone Directory");
gui.show();
gui.pack();
//TokenTest tt = new TokenTest();
//gui.dbTest();
public GUIdirectory(String Title) {
super(Title);
// Add ourselves as a listener for the window closing
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent we) {
exitWindow(1); }
inputLabel_lastname.setLabelFor(inputText_lastname);
inputText_lastname.setHorizontalAlignment(JTextField.RIGHT);
inputText_lastname.addActionListener(this);
inputLabel_firstname.setLabelFor(inputText_firstname);
inputText_firstname.setHorizontalAlignment(JTextField.RIGHT);
inputText_firstname.addActionListener(this);
inputLabel_middleinitial.setLabelFor(inputText_middleinitial);
inputText_middleinitial.setHorizontalAlignment(JTextField.RIGHT);
inputText_middleinitial.addActionListener(this);
inputButton.addActionListener(this);
inputLayout.add(inputLabel_lastname);
inputLayout.add(inputText_lastname);
inputLayout.add(inputLabel_firstname);
inputLayout.add(inputText_firstname);
inputLayout.add(inputLabel_middleinitial);
inputLayout.add(inputText_middleinitial);
inputLayout.add(inputButton);
getContentPane().setLayout(new BorderLayout(5,5));
getContentPane().add("North",inputLayout);
dataTableScrollPane.setViewportView(dataTable);
getContentPane().add("Center",dataTableScrollPane);
// A default method, primarily used for testing.
public void actionPerformed(ActionEvent evt) {
GUIdirectory gui = new GUIdirectory();
gui.dbTest();
void dbTest() {
DataInputStream dis = null;
String dbRecord = null;
String hold;
try {
File f = new File("customer.txt");
FileInputStream fis = new FileInputStream(f);
BufferedInputStream bis = new BufferedInputStream(fis);
dis = new DataInputStream(bis);
Vector dataVector = new Vector();
Vector headVector = new Vector(2);
Vector row = new Vector();
// read the record of the text database
while ( (dbRecord = dis.readLine()) != null) {
StringTokenizer st = new StringTokenizer(dbRecord, ",");
while (st.hasMoreTokens()) {
row.addElement(st.nextToken());
System.out.println("Inside nested loop: " + row);
System.out.println("inside loop: " + row);
dataVector.addElement(row);
System.out.println("outside loop: " + row);
headVector.addElement("Title");
headVector.addElement("Type");
dataTable = new JTable(dataVector, headVector);
dataTableScrollPane.setViewportView(dataTable);
} catch (IOException e) {
// catch io errors from FileInputStream or readLine()
System.out.println("Uh oh, got an IOException error!" + e.getMessage());
} finally {
// if the file opened okay, make sure we close it
if (dis != null) {
try {
dis.close();
} catch (IOException ioe) {
} // end if
} // end finally
} // end dbTest
// Exits the program upon closing the window
public void exitWindow(int i) {
System.exit(i);
public GUIdirectory() {
try {
jbInit();
catch(Exception e) {
e.printStackTrace();
private void jbInit() throws Exception {
jButton1.setText("jButton1");
this.getContentPane().add(jButton1, BorderLayout.CENTER);Nothing happens because in the actionPerformed() method you are creating a new version of GUIdirectory. You just want to execute the dbTest() method of the current instance of GUIdirectory.
The code should be:
public void actionPerformed(ActionEvent evt)
//GUIdirectory gui = new GUIdirectory();
//gui.dbTest();
dbTest(); -
Importing a Text File to Database
Hi There,
Years ago with limited Coldfusion experience I created a Cold fusion process (below) that deletes the contents of a database table and inserts the contents of a 7mb text file which is passed via FTP down to our web server at regular intervals. Admittingly the code below is probably clunky to the more experienced, however i have found this process to work for the last 4 years without a problem. Recently my web server (shared hosted environment) has been throwing this error when this page runs,
"Request aborted due to heavy system load.",
I asked my host if there has been any changes, extra sites recently added to the server that may be causing this congestion which they naturally replied "no". I even tried reducing the text file size to about 3mb but still got the same issue. Is there any other more efficient coldfusion code options I can try that may be quicker and prevent the error from being thrown?
Im on Coldfusion 7 and using MS SQL server, database and coldfusion are on differnt boxes in a shared environment.The text file can contain null values and is delimeted by a pipe character "|"
Any help appreciated
<cfsetting requesttimeout="600">
<cftransaction>
<cfquery name="delete" datasource="#client.dsn#" username="#client.username#" passWord="#client.password#">
delete from xxxxxx
</cfquery>
<cfhttp method="get" textqualifier=" " username="xxxxx" password="xxxxxx" firstrowasheaders="no" delimiter="|" name="test" url="http://xxxxxxxxxxxxxx/br_orders.txt">
Records Read <cfoutput>#test.recordcount#</cfoutput>
<cfloop query="test">
<cfquery name="insert" datasource="#client.dsn#" username="#client.username#" passWord="#client.password#">
INSERT INTO xxxxx
(OrderNo, Line, AccountNo, AccountNoShip, Shipment, PurchaseOrder, Completed, OrderDate, ShipmentDate, Product, QtyOrdered, QtyShipped, Price, Carrier, Connote, Delivery1, Delivery2, Delivery3, Delivery4, Delivery5, Delivery6, Delivery7, Delivery8, expected)
VALUES (
<cfqueryparam value='#test.column_1#' cfsqltype="cf_sql_varchar">,
<cfqueryparam value='#test.column_2#' cfsqltype="cf_sql_varchar">,
<cfqueryparam value='#test.column_3#' cfsqltype="cf_sql_varchar">,
<cfqueryparam value='#test.column_4#' cfsqltype="cf_sql_varchar">,
<cfqueryparam value='#test.column_5#' cfsqltype="cf_sql_varchar">,
<cfqueryparam value='#test.column_6#' cfsqltype="cf_sql_varchar">,
<cfqueryparam value='#test.column_7#' cfsqltype="cf_sql_varchar">,
<cfqueryparam value='#test.column_8#' cfsqltype="cf_sql_varchar">,
<cfqueryparam value='#test.column_9#' cfsqltype="cf_sql_varchar">,
<cfqueryparam value='#test.column_10#' cfsqltype="cf_sql_varchar">,
<cfqueryparam value='#test.column_11#' cfsqltype="cf_sql_float">,
<cfqueryparam value='#test.column_12#' cfsqltype="cf_sql_float">,
<cfqueryparam value='#test.column_13#' cfsqltype="cf_sql_float">,
<cfqueryparam value='#test.column_14#' cfsqltype="cf_sql_varchar">,
<cfqueryparam value='#test.column_15#' cfsqltype="cf_sql_varchar">,
<cfqueryparam value='#test.column_16#' cfsqltype="cf_sql_varchar">,
<cfqueryparam value='#test.column_17#' cfsqltype="cf_sql_varchar">,
<cfqueryparam value='#test.column_18#' cfsqltype="cf_sql_varchar">,
<cfqueryparam value='#test.column_19#' cfsqltype="cf_sql_varchar">,
<cfqueryparam value='#test.column_20#' cfsqltype="cf_sql_varchar">,
<cfqueryparam value='#test.column_21#' cfsqltype="cf_sql_varchar">,
<cfqueryparam value='#test.column_22#' cfsqltype="cf_sql_varchar">,
<cfqueryparam value='#test.column_23#' cfsqltype="cf_sql_varchar">,
<cfqueryparam value='#test.column_24#' cfsqltype="cf_sql_varchar">
</cfquery>
</cfloop>
<cfparam name="OZ" default=""><cfset OZ=#dateAdd("h",18,now())#>
<cfset OZ=#CreateODBCDateTime(OZ)#>
<cfquery datasource="#client.dsn#" username="#client.username#" password="#client.password#">
UPDATE
UpdateTimes
SET
time=#OZ#
WHERE
id=<cfqueryparam value="1" cfsqltype="cf_sql_integer">
</cfquery>
</cftransaction>Girish Sharma wrote:
"I would be really grateful."
But now OP will not really grateful to you; because;
1.You are not going to perform/import the data at his machine.
2.You have not given him the required control file.... (even without knowning anything)
3.You have given only SQL Loader word; so now "oaf... i have to read Doc.."
Regards
Girish SharmaHahahaha . Supper.. ROFL! :) -
How to load data in plain-text file into database by using EJB?
Hi,
We need to develop an on-line application which requires us to load input data
from a selected plain-text file on the Web server (iplanet server) into the backend
oracle database. How could I use EJB to make it happen? it seems like using Entity
EJB is not feasible.
Really appreciate your help!
CoronaHi Corona,
"Corona Fang" <[email protected]> wrote in message
news:3f3b0ea3$[email protected]..
We need to develop an on-line application which requires us to load inputdata
from a selected plain-text file on the Web server (iplanet server) intothe backend
oracle database. How could I use EJB to make it happen? it seems likeusing Entity
EJB is not feasible.If you are talking about loading thousands of records,
the preferable way is using plain JDBC calls utilizing
batch methods.
Regards,
Slava Imeshev -
HOW TO IMPORT HUNDREDS OF TEXT FILE TO DATABASE AS TABLE
Hi,
I have hundreds of text files in my computer. Every text file includes records. I want to see these records in one table at the database. How can I do that?
thank you very much for help
ömer faruk akyüzlü
in TurkeyI have a standard template that my developers use for reading text files using External Tables . Each developer gets an external table to read in test data. The format the data in CSV format, but you could use others. The External Table points to a generic file name, such as "csv_data". They then just rename the file or create a link to it, depending on the OS.
My solution uses the Directory objects. The following can be put in a script and run passing the first argument as the developers name. It supports a csv file upto 15 columns, but you can expand it.
-- begin script
CREATE OR REPLACE DIRECTORY &1 as '/home/&1';
grant read on directory &1 to public;
alter session set current_schema=&1;
--drop table csv_data;
CREATE TABLE csv_data
col1 VARCHAR2(250),
col2 VARCHAR2(250),
col3 VARCHAR2(250),
col4 VARCHAR2(250),
col5 VARCHAR2(250),
col6 VARCHAR2(250),
col7 VARCHAR2(250),
col8 VARCHAR2(250),
col9 VARCHAR2(250),
col10 VARCHAR2(250),
col11 VARCHAR2(250),
col12 VARCHAR2(250),
col13 VARCHAR2(250),
col14 VARCHAR2(250),
col15 VARCHAR2(250)
ORGANIZATION EXTERNAL
( TYPE ORACLE_LOADER
DEFAULT DIRECTORY &1
ACCESS PARAMETERS
(RECORDS DELIMITED BY newline
NOBADFILE
NODISCARDFILE
NOLOGFILE
SKIP 0
FIELDS TERMINATED BY ","
OPTIONALLY ENCLOSED BY '"'
RTRIM
MISSING FIELD VALUES ARE NULL
REJECT ROWS WITH ALL NULL FIELDS
col1 CHAR, col2 char,col3 char,col4 char,col5 char,col6 char,col7 char,col8 char,col9 char,
col10 char,col11 char,col12 char,col13 char,col14 char,col15 char
LOCATION (&1:'csv_data')
REJECT LIMIT Unlimited
NOPARALLEL
NOMONITORING
--end script -
Reading Text file or Database efficiently
Hi.
I have an option to read EMP names randomly from either text file or database . Can anyone tell me which one will be fast. I have to read more than 5000 names dynamically for my application and pick one name randomly.
Many thanks, RaviHi quitte ,
Thanks for replying. I just want to pick names randomly from file or database to name each and every customer in my application dynamically.
For this, I created one table with Unique names and would like to design a code such that each customers will be named dynamically.
Any Suggestions or Advise?
Ravi -
hi all.
please i need to read data seperated by coma from a text file and insert it in oracle database. how can i do this
thanxUse this function (with Forms : TEXT_IO)
(Change PIPE-delimited line with comma -delimited )
create a FUNCTION in Program Unit
FUNCTION TOKEN (LINEBUF IN OUT VARCHAR2) RETURN VARCHAR2 IS
/* Returns the first token from the PIPE-delimited line */
/* passed as linebuf. Linebuf then has that token stripped */
/* so that subsequent calls return the second, third, etc. */
FIRST_TOKEN VARCHAR2(70);
PIPE_POS NUMBER;
BEGIN
PIPE_POS := INSTR(LINEBUF, ',');
IF PIPE_POS = 0 THEN
FIRST_TOKEN := LINEBUF;
LINEBUF := null;
ELSE
FIRST_TOKEN := SUBSTR(LINEBUF, 1, PIPE_POS - 1);
LINEBUF := SUBSTR(LINEBUF, PIPE_POS + 1);
END IF;
RETURN FIRST_TOKEN;
END;
Or If you are using 10gR2
Look
http://www.oracle.com/technology/products/forms/htdocs/webutil/webutil.htm
or
http://www.oracle.com/technology/sample_code/products/forms/index.html
or Francois Degrelle Blog(There is a example)
http://fdegrelle.over-blog.com/
Regards -
Reading text file from database server in OA Page
Hi Guys,
I am trying to embed an applet with in an OA Page. The applet is used to mainly for showing Gantt chart. I have to pass my connection details from OA Page to applet, I dont pass directly the connection details to the applet so i am placing all the server details, user name and password in a text file on the database server.
So from the OA Page i have to read the contents of the file on the database server and pass them to the applet using the <PARAM> tag. My question is how to read the text file from the database server.Any Inputs?
Thanks in advance for your help.
Regards,
Nagesh Manda.If the file to be read is on the database, then it makes sense to use the pl/sql code to read the file. Make a call to this pl/sql code from page controller to get back the values.
--Shiv -
How to extract data from text file to database table
Hi ,
I am trying to upload data in text file to database table using GUI_UPLOAD function .what would be the program for that.
thanks in advance.Hi,
I don't think you have a standard sap program to upload data from file to database table...
Instead you can create a custom program like this..
DATA: T_FILEDATA(1000) OCCURS 0 WITH HEADER LINE.
DATA: T_ZTABLE LIKE ZTABLE OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'C:\TEST.TXT'
tables
data_tab = T_FILEDATA
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT T_FILEDATA.
T_ZTABLE = T_FILEDATA.
APPEND T_ZTABLE.
ENDLOOP.
MODIFY ZTABLE FROM TABLE T_ZTABLE.
COMMIT WORK..
Thanks,
Naren -
Report the size of all SharePoint Databases in a text file using PowerShell?
I am new to Powershell. please help me for following question with step by step process.
How to report the size of all SharePoint Databases in a text file using PowerShell?Hi Paul,
Here is the changed script, which will also include the size for the Config DB.
Please let me know if it worked:
#Get SharePoint Content database sizes
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
$date = Get-Date -Format "dd-MM-yyyy"
#Variables that you can change to fit your environment
$TXTFile = "D:\Reports\SPContentDatabase_$date.txt"
$SMTPServer = "yourmailserver"
$emailFrom = "[email protected]"
$emailTo = "[email protected]"
$subject = "Content & Config Database size reports"
$emailBody = "Daily/Weekly/Monthly report on Content & Config databases"
$webapps = Get-SPWebApplication
$configDB = Get-SPDatabase | ?{$_.Name -eq ((Get-SPFarm).Name)}
$ConfigDBSize = [Math]::Round(($configDB.disksizerequired/1GB),2)
Add-Content -Path $TXTFile -Value "Config Database size: $($ConfigDBSize)GB"
Add-Content -Path $TXTFile -Value ""
foreach($webapp in $webapps)
$ContentDatabases = $webapp.ContentDatabases
Add-Content -Path $TXTFile -Value "Content databases for $($webapp.url)"
foreach($ContentDatabase in $ContentDatabases)
$ContentDatabaseSize = [Math]::Round(($ContentDatabase.disksizerequired/1GB),2)
Add-Content -Path $TXTFile -Value "- $($ContentDatabase.Name): $($ContentDatabaseSize)GB"
if(!($SMTPServer) -OR !($emailFrom) -OR !($emailTo))
Write-Host "No e-mail being sent, if you do want to send an e-mail, please enter the values for the following variables: $SMTPServer, $emailFrom and $emailTo."
else
Send-MailMessage -SmtpServer $SMTPServer -From $emailFrom -To $emailTo -Subject $subject -Body $emailBody -Attachment $TXTFile
Nico Martens - MCTS, MCITP
SharePoint 2010 Infrastructure Consultant / Trainer -
Text file storing in a database table
I have a text file, that contains so many lines in it,..
Now the problem is that.. I want to store my text file with the pl/sql code in a database table....
plz suggest, how to create a table and how to store that text file in a database table.....The following code is tested and get the correct result (forms 10.1.2.0):
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> create table tclob (col_lob clob);
Table created.
Declare
file TEXT_IO.FILE_TYPE;
text varchar2(10000);
L$Clob CLOB;
Begin
-- prepare CLOB object --
dbms_lob.createtemporary( L$Clob, TRUE ) ;
-- open text file --
file := TEXT_IO.FOPEN( 'c:\forms.css', 'R' ) ;
If TEXT_IO.IS_OPEN( file) Then
-- start reazding file --
Begin
Loop
TEXT_IO.GET_LINE( file, text );
-- add the line to the CLOB variable --
dbms_lob.writeappend (L$Clob, length(text), text);
End loop;
Exception
when no_data_found then
-- end of text file --
TEXT_IO.FCLOSE(file);
when others then
null;
End ;
-- store the CLOB in the database --
--Update tclob Set col_lob = L$Clob ;
insert into tclob (col_lob) values (L$Clob);
forms_ddl('commit');
dbms_lob.freetemporary( L$Clob ) ;
End if ;
exception
when others then
message(error_code || '-' || error_text);
End;Francois
Maybe you are looking for
-
Help! Please! Thanks so much!!!!!
-
Help!!! : Complex mysql query in dreamweaver
Ok Guys: I need this query executed on a client's website. I know it's working well in phpmyadmin, but in dreamweaver I cannot put it to work. The point is that the mysql_query funcion in PHP can only execute one query, So I cannot set the initial va
-
Hello.Just start using Final Cut Pro X.And got a problem with saved files.As I import files from my GoProHD ,I saved them in folder on my desktop.In FCPX I started new events and after chek status of my memory,I found out what same files save in two
-
Unwanted contact addition requests
I'm a women. And for a few days, I've been receiving requests to be added to my contacts from men I've never heard of. This happens 4-5 times a day. It's never happened before. It followed my merging MSN with Skype. How do they go about to find me? B
-
How do i import an eps file to elements 11
when i try to import an eps file i get a message that says "wrong file type"