473,804 Members | 3,185 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Query Regarding csv file size problem

2 New Member
hi all
here im trying to create .csv file.
my code is

public class CSVFile {

public static void main(String[] args) {

String record=null;
try {
Class.forName(" org.sqlite.JDBC ");


Connection conn=DriverMana ger.getConnecti on("jdbc:sqlite :"+"C:\\Sqlite\ \retriver.db");
Statement stmt = conn.createStat ement(); ResultSet rs = stmt.executeQue ry("select * from fileSystem");
ResultSetMetaDa ta meta=rs.getMeta Data();
int colCount=meta.g etColumnCount() ;
int j=0;
File fileStore = new File(fileStore. csv");
FileOutputStrea m fos=new FileOutputStrea m(fileStore);
long i=0;
while(rs.next() )
{

record=rs.getSt ring(1)+","rs.g etString(2)","r s.getString(3)" ,"rs.getString( 4)","rs.getStri ng(5)","rs.getS tring(6)","rs.g etString(7)","r s.getString(8)" ,"rs.getString( 9)"\n";
fos.write(recor d.getBytes());
System.out.prin tln("counter"+( j++));

}
This is my code
my problem is in my database i have 2,00,000 records
but here i will get upto 65,000 records only

i want to get all records
is there any solution
Sep 27 '07 #1
1 1658
dmjpro
2,476 Top Contributor
hi all
here im trying to create .csv file.
my code is

public class CSVFile {

public static void main(String[] args) {

String record=null;
try {
Class.forName(" org.sqlite.JDBC ");

Expand|Select|Wrap|Line Numbers
  1. Connection conn=DriverManager.getConnection("jdbc:sqlite:"+"C:\\Sqlite\\retriver.db");
  2. Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery("select * from fileSystem");
  3. ResultSetMetaData meta=rs.getMetaData();
  4. int colCount=meta.getColumnCount();
  5. int j=0;
  6. File fileStore = new File(fileStore.csv");
  7. FileOutputStream fos=new FileOutputStream(fileStore); 
  8. long i=0; 
  9. while(rs.next())
  10. {
  11.  
  12. record=rs.getString(1)+","rs.getString(2)","rs.getString(3)","rs.getString(4)","rs.getString(5)","rs.getString(6)","rs.getString(7)","rs.getString(8)","rs.getString(9)"\n";
  13. fos.write(record.getBytes()); 
  14. System.out.println("counter"+(j++));
  15.  
  16. }
  17.  
This is my code
my problem is in my database i have 2,00,000 records
but here i will get upto 65,000 records only

i want to get all records
is there any solution
Use code tags while you do Post.
Read the posting guidelines before posting :-)
Are you getting 65,000 records out of 2,00,000 or you want to get 65,000 out of 2,00,000?
I think you are getting 65,000 out of 2,00,000 :-)

Actually you forgot to close the file o/p stream.
Expand|Select|Wrap|Line Numbers
  1. fos.close();
  2.  
Just close it after writing finishes.
Good Luck :-)

Kind regards,
Dmjpro.
Sep 27 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
8855
by: Praveen | last post by:
Hi All, I have a query something like this.. select col1, col2, col3 from ( select col1,col2,col3,col4 from table1 union all select col1,col2,col3,col4 from table2 )
3
5395
by: Harvey | last post by:
Hi, I try to write an asp query form that lets client search any text-string and display all pages in my web server that contain the text. I have IIS 6.0 on a server 2003. The MSDN site says there is a sample file called Ixtrasp.asp, but I could not find it in my system although I installed indexing service. I followed the steps in MSDN site to create a basic .asp query form (too long to post it here), but it always displays: No...
7
2218
by: stig | last post by:
hi. coming from postgresql, i am used to textual references to most of the things i do with the database. i feel a little lost with all the graphical. i have few questions regarding MS SQL 2000 1. what is the best (or easiest) way of getting a table definition in text? it could be either a CREATE TABLE sql-query or a just a definition, something like: TABLE thisTable id integer
4
1908
by: gaurav.dube | last post by:
I am facing a problem with warning removal I have got a header file it contains extern declarations of lot of variables (say 100) This header file is included in hundreds of .c files. Some of these .c file contain definition of one the variable declared as extern in header file. But since the header file is also included in this .c file containing definition of variable, the compiler gives a warning . The header file is common to...
1
2773
by: mm27603 | last post by:
I'm trying to do a simple query of an Oracle 10g database within some vbscript code. <% 'Get protocol information to display in dropdown list %> <!--#include file="dbconnect2.inc"--> <% sql= "select DISTINCT PROTOCOLNAME FROM GPL_PPDB.VW_IVRS_INFO_2 WHERE SPONSORNAME = '" & Sponsor & "' ORDER BY PROTOCOLNAME ASC" Set RS = Conn.Execute(sql) %></span>
17
2746
by: NeoAlchemy | last post by:
I am starting to find more web pages that are using a query parameters after the JavaScript file. Example can be found at www.opensourcefood.com. Within the source you'll see: <script src="/shared/scripts/common.js?revision=1.6" type="text/javascript">. I am trying to see if there is any big deal to this or a best practice that is starting to creep up in the JavaScript community. If this is used only as a way to distinguish what...
0
1039
by: swathi123 | last post by:
hi all here im trying to create .csv file. my code is public class CSVFile { public static void main(String args) { String record=null; try {
13
1931
by: prasadmpatil | last post by:
I am new STL programming. I have a query regarding vectors. If I am iterating over a vector using a iterator, but do some operations that modify the size of the vector. Will the iterator recognize this? I wrote the following program to test this out. #include <fstream> #include <iostream> #include <string>
9
3639
by: Sinner | last post by:
Hi, I have a field name 'USER' in tableMAIN. How do I replace the user names with corresponding user names. I can do that in xl using vlookup but now I'm trying to find a way to do that in access. For a user mismatch, it should give NA Thx.
0
9572
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10562
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10303
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9132
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5508
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5639
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4282
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3803
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2978
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.