Bulk data upload through JDBC
Hello, I am following SQLCopInto.java to upload bulk data into MonetDB but seems to be not working. I am even using mclient command to upload data but the command expects the input file to be accessible by the DB server, is there any alternative to this. Please suggest a best way to do through JDBC Thanks
I assume you refer to https://dev.monetdb.org/hg/monetdb-java/file/tip/example/SQLcopyinto.java What is not working on SQLcopyinto.java example program? Does your connection to the MonetDB server succeed? So: Connection con = DriverManager.getConnection("jdbc:monetdb://localhost/database", "monetdb", "monetdb"); succeeds? If not, change the connection URL to match your MonetDB server, database and user names. Note: In the example the name of the database is "database". It may be a different name (e.g. demo) in your situation. It depends on how your started MonetDB server. MvD On 05-01-2018 12:06, suvendu chakra wrote:
Hello, I am following SQLCopInto.java to upload bulk data into MonetDB but seems to be not working. I am even using mclient command to upload data but the command expects the input file to be accessible by the DB server, is there any alternative to this.
Please suggest a best way to do through JDBC
Thanks
_______________________________________________ users-list mailing list users-list@monetdb.org https://www.monetdb.org/mailman/listinfo/users-list
and for the mclient related part of your question: yes, copy into from file requires that the file is accessible for the server. See also this quote from the mclient manpage [1][2]: " EXAMPLES Efficiently import data from a CSV (comma-separated values) file into a table. The file must be readable by the server. $file is the absolute path name of the file, $table is the name of the table, $db is the name of the database. mclient -d $db -s "COPY INTO $table FROM ’$file’ USING DELIMITERS ’,’,’\\n’,’\"’" Efficiently import data from a CSV file into a table when the file is to be read by mclient (e.g. the server has no access to the file). $file is the (absolute or relative) path name of the file, $table is the name of the table, $db is the name of the database. mclient -d $db -s "COPY INTO $table FROM STDIN USING DELIMITERS ’,’,’\\n’,’\"’" - < $file Note that in this latter case, if a count of records is supplied, it should be at least as large as the number of records actually present in the CSV file. This, because otherwise the remainder of the file will be interpreted as SQL queries. See https://www.monetdb.org/Documentation/Manuals/SQLreference/CopyInto for more information about the COPY INTO query. " [1] https://www.monetdb.org/Documentation/mclient-man-page [2] `man mclient` ----- On Jan 8, 2018, at 11:04 PM, dinther dinther@monetdbsolutions.com wrote:
I assume you refer to https://dev.monetdb.org/hg/monetdb-java/file/tip/example/SQLcopyinto.java
What is not working on SQLcopyinto.java example program? Does your connection to the MonetDB server succeed? So: Connection con = DriverManager . getConnection ( "jdbc:monetdb://localhost/database" , "monetdb" , "monetdb" ); succeeds? If not, change the connection URL to match your MonetDB server, database and user names.
Note: In the example the name of the database is "database". It may be a different name (e.g. demo) in your situation. It depends on how your started MonetDB server.
MvD
On 05-01-2018 12:06, suvendu chakra wrote:
Hello, I am following SQLCopInto.java to upload bulk data into MonetDB but seems to be not working. I am even using mclient command to upload data but the command expects the input file to be accessible by the DB server, is there any alternative to this.
Please suggest a best way to do through JDBC
Thanks
_______________________________________________ users-list mailing list users-list@monetdb.org https://www.monetdb.org/mailman/listinfo/users-list
_______________________________________________ users-list mailing list users-list@monetdb.org https://www.monetdb.org/mailman/listinfo/users-list
-- | Stefan.Manegold@CWI.nl | DB Architectures (DA) | | www.CWI.nl/~manegold/ | Science Park 123 (L321) | | +31 (0)20 592-4212 | 1098 XG Amsterdam (NL) |
Yes I am giving the DB Url correctly.
When I try run a sample as mentioned in https://dev.monetdb.org/hg/
monetdb-java/file/tip/example/SQLcopyinto.java no records getting inserted
to table.
I got row count as 0
Please find the sample Program attached
On Tue, Jan 9, 2018 at 3:34 AM, dinther
I assume you refer to https://dev.monetdb.org/hg/ monetdb-java/file/tip/example/SQLcopyinto.java
What is not working on SQLcopyinto.java example program? Does your connection to the MonetDB server succeed? So: Connection con = DriverManager.getConnection("jdbc:monetdb://localhost/ database", "monetdb", "monetdb"); succeeds? If not, change the connection URL to match your MonetDB server, database and user names.
Note: In the example the name of the database is "database". It may be a different name (e.g. demo) in your situation. It depends on how your started MonetDB server.
MvD
On 05-01-2018 12:06, suvendu chakra wrote:
Hello, I am following SQLCopInto.java to upload bulk data into MonetDB but seems to be not working. I am even using mclient command to upload data but the command expects the input file to be accessible by the DB server, is there any alternative to this.
Please suggest a best way to do through JDBC
Thanks
_______________________________________________ users-list mailing listusers-list@monetdb.orghttps://www.monetdb.org/mailman/listinfo/users-list
_______________________________________________ users-list mailing list users-list@monetdb.org https://www.monetdb.org/mailman/listinfo/users-list
participants (3)
-
dinther
-
Stefan Manegold
-
suvendu chakra