jtablesaw cant read sqlite database correctly #1056
Unanswered
dddeveloperrr
asked this question in
Q&A
Replies: 2 comments
-
That looks like an integer overload problem. The values are too large for
a Java int. They should map to long. It’s possible SQLite doesn’t provide
enough detail on the size to map correctly. Could you retry with values
under 2 billion and let me know what you get?
…On Sat, Mar 19, 2022 at 11:33 AM farhad ***@***.***> wrote:
hi
I have a sqlite database which has a table with two columns. Name (which
is Text type) and ID (Which is Integer type).
[image: Untitled]
<https://user-images.githubusercontent.com/11577640/159127217-e951c6ac-d806-443a-a724-3de7d2058567.jpg>
[image: image]
<https://user-images.githubusercontent.com/11577640/159126937-019b8731-52bf-4aac-962b-7e2a463615ad.png>
I want to read this database and print it's content to console. here is my
code :
package Main;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import tech.tablesaw.api.Table;
public class Main {
public static void main(String[] args) {
try {
String DB_URL = "jdbc:sqlite:/home/farhad/Desktop/test";
Connection conn = DriverManager.getConnection(DB_URL);
Statement stmt = conn.createStatement();
String query = "SELECT * FROM mytable";
ResultSet results = stmt.executeQuery(query);
Table tb = Table.read().db(results, "mytable");
System.out.println(tb.printAll());
} catch (Exception e) {
System.out.println(e.getLocalizedMessage());
}
}
}
and here is output:
mytable
Name | ID |
-------------------------
Jack | 734294471 |
Alex | 1468588942 |
Ashly | -2092083883 |
as you can see, it returns wrong output
—
Reply to this email directly, view it on GitHub
<#1056>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA2FPASAF7UEO5VKMEYWWE3VAXXV5ANCNFSM5REFE7BA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
-
it works fine with small numbers and here is the output:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
hi
I have a sqlite database which has a table with two columns. Name (which is Text type) and ID (Which is Integer type).
I want to read this database and print it's content to console. here is my code :
and here is output:
as you can see, it returns wrong output
Beta Was this translation helpful? Give feedback.
All reactions