This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Building Blockchain Apps and have Michael Yuan on-line!
See this thread for details.
Win a copy of Building Blockchain Apps this week in the Cloud/Virtualization forum!

Deepthi Xavy

Ranch Hand
+ Follow
since Aug 31, 2009
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Deepthi Xavy

Hai friends,

Am trying to use modal popup window while editing the datas in the form..I do know how to proceed with the steps,Please do help me out...


import java.io.*;
import java.sql.*;

import org.xml.sax.*;
import org.xml.sax.helpers.*;

import javax.xml.parsers.*;
import javax.xml.transform.*;
import javax.xml.transform.stream.*;
import javax.xml.transform.sax.*;

public class FlatFileXml {

BufferedReader br;
StreamResult sr;

TransformerHandler tfh;
AttributesImpl ai;

public static void main(String args[]) throws Exception{
try
{
new FlatFileXml().datamain();
System.out.println("You are Successfully create XML and data insert into the database.");
}
catch (Exception e)
{
System.out.println(e.getMessage());
}

}

public void datamain () {
try {
br = new BufferedReader(new FileReader("flatfile.txt"));
sr = new StreamResult("flatfile.xml");
xmlMain();
String str;
while ((str = br.readLine()) != null) {
doWork(str);
}
br.close();
xmlEnd();
}
catch (Exception e) { e.printStackTrace(); }
}


public void xmlMain() throws Exception {
SAXTransformerFactory tf = (SAXTransformerFactory)
SAXTransformerFactory.newInstance();

tfh = tf.newTransformerHandler();
Transformer serTf = tfh.getTransformer();
serTf.setOutputProperty(OutputKeys.ENCODING,"ISO-8859-1");
tfh.setResult(sr);
tfh.startDocument();
ai = new AttributesImpl();
}

public void doWork (String s) throws Exception{

String [] ar = s.split("\\-");
try{
Class.forName("org.gjt.mm.mysql.Driver");
con = DriverManager.getConnection(url+dbName,userName,password);
String queryString = "INSERT INTO flatfile ( id,name,address,contact_no) values('"+ar[0]+"','"+ar[1]+"','"+ar[2]+"','"+ar[3]+"')";

stmt=con.createStatement();
val = stmt.executeUpdate(queryString);

}
catch(Exception e)
{
System.out.println("e : " + e);
}
ai.clear();
tfh.startElement("","","ID",ai);
tfh.characters(ar[0].toCharArray(),0,ar[0].length());
tfh.endElement("","","ID");

}

public void xmlEnd() throws Exception{
tfh.endDocument(); }
}




I got the following code, how to convert this code to servlet...
10 years ago
Hai friends...

I just got a doubt,if there are 100's of records..how to insert in mysql, i searched through & found an information that after converting the data to XML,it can be taken to data base..how to do it..can anyone explain me, this in detail
itz not the same question,what i asked before..itz regarding insert querry,kindly go through..before marking duplicate
Hai experts...

Am beginner in mobile application, but am planning to do sms concpt for campus managament,in that i wish to send 70 messages at a strech with different details,for example consider that if am planning to send their semester mark...just by clicking send..all messages has to be delivered, if itz not send..it has to be highlighted..that particular contents has to be send again...can any body make me clear in this
10 years ago
Hai experts,

for adding bulk data's in profile part,i tried in two ways,
1.Directly upload from csv file & save it to database
2.number of rows & columns are given as per data's we want to insert,then the values are entered...at that time how to insert all the data's..
For e.g
if the profile has personal details like ,the name,date of birth,contact number,address,previous experience....etc....if there are 60 profiles...how to upload at a strech
thanks for everyone who helped me out to come from the trouble,let me try out everything...& report
loop might take more time to get executed,because if we want to insert 60 records.the loop has to be executed 60 times..it might be time consuming..so am planing to insert all the records at a time..using bulk insert..at a moment all records has to be inserted.
ya..batch update i tried,but how to proceed with the concept i mean here..
good work..keep growing
10 years ago
Hai..

Can anyone just help me out for doing bulk insert in mysql ,I got 60 records for marking attendance for a particular class,all the records has to be inserted in database at a time without using looping concept.I do know how to proceed with query.

I just think of a concept that if the check box were marked,that particular student is absent else the student is present.How to do it with query.Can anyone make me clear with query
hai friends....

am trying to draw chart using servlets...which jar has to be loaded,before proceeding with,can anyone suggest me
10 years ago
Hai friends...

Am doing campus management system..in that for attendance module,for a student per month one column should be used..for the next month next entry has to be made in next row ..and so on...so that the number of entryies will be minimised & it will be easy to retrieve...can any one help me ut from here for this querry please...

Thanks in advance......
<%@ page import="java.io.*,java.sql.*" %>
<html>
<%
String contentType = request.getContentType();
if ((contentType != null) && (contentType.indexOf("multipart/form-data") >= 0)) {
DataInputStream in = new DataInputStream(request.getInputStream());
int formDataLength = request.getContentLength();
byte dataBytes[] = new byte[formDataLength];
int byteRead = 0;
int totalBytesRead = 0;

while (totalBytesRead < formDataLength) {
byteRead = in.read(dataBytes, totalBytesRead, formDataLength);
totalBytesRead += byteRead;
}
String file = new String(dataBytes);
String saveFile = file.substring(file.indexOf("filename=\"") + 10);
System.out.println("saveFile=" + saveFile);
saveFile = saveFile.substring(saveFile.lastIndexOf("\\")+ 1,saveFile.indexOf("\""));
System.out.println("saveFile" + saveFile);
saveFile = file.substring(file.indexOf("filename=\"") + 10);
saveFile = saveFile.substring(0, saveFile.indexOf("\n"));
saveFile = saveFile.substring(saveFile.lastIndexOf("\\")+ 1,saveFile.indexOf("\""));
int lastIndex = contentType.lastIndexOf("=");
String boundary = contentType.substring(lastIndex + 1,contentType.length());
int pos;

pos = file.indexOf("filename=\"");
pos = file.indexOf("\n", pos) + 1;
pos = file.indexOf("\n", pos) + 2;
pos = file.indexOf("\n", pos) + 3;
int boundaryLocation = file.indexOf(boundary, pos) - 4;
int startPos = ((file.substring(0, pos)).getBytes()).length;
int endPos = ((file.substring(0, boundaryLocation)).getBytes()).length;

FileOutputStream fileOut = new FileOutputStream(saveFile);
fileOut.write(dataBytes, startPos, (endPos - startPos));
%>
<b>File <% out.println(saveFile); %> has been uploaded and inserted into Database.</b>
<%Connection con=null;
Statement pst=null;
String line = null;
String value=null;
try{
StringBuilder contents = new StringBuilder();
BufferedReader input = new BufferedReader(new FileReader(saveFile));
while (( line = input.readLine()) != null){
contents.append(line);
}
value = contents.toString();
System.out.println("Value:"+value);
Class.forName("org.gjt.mm.mysql.Driver");
con=DriverManager.getConnection
("jdbc:mysql://localhost:3306/deepthi?user=deepthi&password=deepthi");
pst=con.createStatement();
int val = pst.executeUpdate("insert into file(file_data) values('"+value+"')");
}
catch(Exception e)
{}
}
%>
</html>



Am doing a csv file import & saving in database.two jsp pages are used,one is to browse & the other page is to save in the database.I got the output but the problem is that all the row values are geting added in the same column in database,where do i want to correct so that i get a proper output such that rows has to save in row wise & column has to get saved in column wise..

Can anyone get me out from this point..
Hai friends,

Consider a case that if I want to insert 60 records of student, for their attendance. I just need to do bulk insert of all 60records at a second.Can any one get a sample query.Even if there is chance for batch update how to do it,can any one get me a sample querry.