Firebird SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsDatabasesFirebird SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 3rd, 2012, 10:15 AM
jRam90 jRam90 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2012
Posts: 1 jRam90 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 1 m 2 sec
Reputation Power: 0
Fragmented rows in firebird embedded mode

I was doing this code, and something weird has happened. I make a bulk insert from an external file. But the result it's just fragmented, or maybe corrupted.

Code:
 cnx=factoryInstace.getConnection();
                pstmt = cnx.prepareStatement("DELETE FROM TEMPCELULAR");
                pstmt.executeUpdate();
                pstmt = cnx.prepareStatement("EXECUTE BLOCK AS BEGIN if (exists(select 1 from rdb$relations where rdb$relation_name = 'EXT_TAB')) then execute statement 'DROP TABLE EXT_TAB;'; END");
                pstmt.executeUpdate();
                pstmt = cnx.prepareStatement("CREATE TABLE EXT_TAB EXTERNAL '"+txtarchivoProcesar.getText()+"'(CELULAR varchar(11))");
                pstmt.executeUpdate();
                pstmt = cnx.prepareStatement("INSERT INTO TEMPCELULAR (CELULAR)SELECT CELULAR FROM EXT_TAB");
                pstmt.executeUpdate();
            pstmt = cnx.prepareStatement("SELECT CELULAR FROM TEMPCELULAR");
                ResultSet rs=pstmt.executeQuery();
                while(rs.next()){
                    System.out.println("::"+rs.getString(1));
                }


And now, all of a sudden the rows on my table look like this:

::c@gmail.com

::abc2@gmail.

::m
abc3@gma

::.com
abc4@

::ail.com
ab

::@gmail.com


::bc6@gmail.c

::abc7@gmai

::com
abc8@g

::il.com
abc

::gmail.com

::c10@gmail.c

::

The blank spaces between results were not made by me. This is the result as it is.

Source file for external table:

abc@gmail.com
abc2@gmail.com
abc3@gmail.com
abc4@gmail.com
abc5@gmail.com
abc6@gmail.com
abc7@gmail.com
abc8@gmail.com
abc9@gmail.com
abc10@gmail.com
sneciosup@hotmail.com

¿What's wrong with my code?

I've haven't seen this wack results in years. The database is created of the users pc on the first run. Hence, while in production every time I run the program.

I' ve cheked every query, and it goes wrong in the part where I create the external table: "CREATE TABLE EXT_TAB EXTERNAL '"+txtarchivoProcesar.getText()+"'(CELULAR varchar(11))". The external table output varies according to the data type and it's length, so if you put varchar(300) or varchar(50) then the output will vary a lot. Gee, I mean one hour before my presentation with my boss this was working ok...

Any help, will be appreciated.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesFirebird SQL Development > Fragmented rows in firebird embedded mode

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap