Design For script
Can anyone suggest a better design for the following scenario:
There are a lot of numbers in the file, the file looks a little different:
-1100
-1101
-1102
-1103
-1104
-
-
-
-
-To 9999
- Design and develop a JDBC program that will read all numbers from a file and insert them into a table in a database.
Note. ... I don't want to read the file a thousand times and the fire insert pointer a thousand times.
0
a source to share
2 answers
Can't you use a bootloader? Here's an example for Sql Server:
BULK
INSERT BulkTest
FROM ‘c:\file.txt’
WITH
(
ROWTERMINATOR = ‘\n’
)
GO
Here is another option, at least as of Sql Server 2008, insert multiple lines with statement 1:
Insert into table(id, country)
Values
(1,‘USA’), –-Row 1
(2,‘UK’), –-Row 2
(3,‘France’) –-Row 3
+1
a source to share