insert « SQLserver « Java Database Q&A





1. Auto generate key on JDBC insert in SQL Server    stackoverflow.com

Is there a general, cross RDMS, way I can have a key auto generated on a JDBC insert? For example if I have a table with a primary key, id, and ...

2. How can I set the IDENTITY_INSERT option for a JDBC PreparedStatement?    stackoverflow.com

I need to copy data into an MSSQLServer 2005 database table which has an identity column. I've seen how to disable the identity column by executing

SET IDENTITY_INSERT <table> ON
before the insert queries. How ...

3. Insert Java Object In Sql Server    stackoverflow.com

How Can I Insert/Retrive A Java Object Into/From Sql Server? THX

4. Is it possible to pass an arraylist object to sql procedure with sql server 2000 and java 1.4?    stackoverflow.com

I have defined a class FieldProperty with some of properties corresponding to field defined in it.ArrayList object contains objects of class FieldProperty. now i want to store data in table .There ...

5. java 1.4 -sql server 2000:not able to insert multiple records into table    stackoverflow.com

INSERT INTO UPLOAD_FILE_RECORD_FIELDS_DATA

select ?,?,?,? 
union all 
select ?,?,?,? 
union all 
select ?,?,?,?
I have to insert multiple records into one table.So i am using query as below.and setting parameter values. But ...

6. Problems with string parameter insertion into prepared statement    stackoverflow.com

I have a database running on an MS SQL Server. My application communicates via JDBC and ODBC with it. Now I try to use prepared statements. When I insert a numeric (Long) ...

7. Fastest way for inserting very large number of records into a Table in SQL    stackoverflow.com

The problem is, we have a huge number of records (more than a million) to be inserted into a single table from a Java application. The records are created by the ...

8. Multiple row insert in sql server from java    stackoverflow.com

I need to insert multiple row's into sql server database (100 at a time) from my java code. How can i do this..? Currently i am inserting one by one and ...

9. JDBC, INSERT MULTIPLE records obtained from query, into other table    stackoverflow.com

I need to insert multiple records into mysql database at once. What I am doing is SELECT on one table, from my application with Prepared statement. What I must do is ...





10. java and jboss, with SQL server. Mulitple insert statements in a native query using entitymanager, not working; but does work in sql    stackoverflow.com

String myQuery1  = "insert into mytable(mycol) values(myval) \ngo";
String myQuery2  = "insert into mytable(mycol) values(myval2) \ngo";
String myQuery = myQuery1 + myQuery2;

Query query = myEntityManager.createNativeQuery(myQuery);
List<?> insertResultList = queryInsertDefaults.getResultList();
using the eclpise debugger ...

11. Java, PreparedStatement, TransactSQL (MS SQL), last insert id    stackoverflow.com

I insert some values into a database using a PreparedStatement, but it seems, that i cannot retrieve the last insert id in that case. I try to use the same statement ...

12. SQL Server 2008 datetime column JDBC insert problem    stackoverflow.com

I have a table with a column that is a DATETIME in a SQL Server 2008 database. The dates that are being inserted are not timestamps in the sense that ...

13. SimpleDateFormat value insert to ms db    stackoverflow.com

I formatted my jspinner as:

SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
JSpinner.DateEditor de = new JSpinner.DateEditor(jSpinner1, "MM/dd/yyyy");
jSpinner1.setEditor(de);
and try to insert the value of jSpinner to ms db:
String SQLString = "INSERT INTO Table1(DateToday)VALUES(?)";
stmt = con.prepareStatement(SQLString);
stmt.setDate(1, ...

14. Cachedrowset, JDBC and SQL server 2008 insert image problem    stackoverflow.com

I'm trying to insert an image file (.png,200KB) into Sql sever (columb type varbinary(max)) via jdbc type 4 (microsoft jdbc 3.0), here is my code:

       ...

15. JDBC 4.0 - MS SQL 2005 - how to insert image from Java app?    stackoverflow.com

I just downloaded the microsoft jdbc mssql driver to try connect my test app... The lib contains so many methods so I have confused ... There is a BLOB and InputStream ...

16. How to insert into sql server table extracted from excel sheet in Java    stackoverflow.com

I am trying to read a column (Category_name )from the excel sheet. The excel files are multiple in number. After this I have to access a table (category) from sql server. This ...





17. Insert query - executeUpdate returning -1    stackoverflow.com

I am trying to insert records into sql server using jdbc conn (in java). I am able to insert into sql, if I manually copy the query statement inthe java file. But ...

18. Problem inserting into an SQL Server Database with Java    stackoverflow.com

I have a problem because I can't insert into an sql server database: driver:[Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]

public int sendCabecera(String tpv, Date date, String time, int NumPers, int CodOfi) {

   ...

19. how to execute bulk insert statement in java (using JDBC) with db=SQL Server 2008 Express    stackoverflow.com

I am trying to execute a BULK INSERT statement on SQL Server 2008 Express. (It basically takes all fields in a specified file and inserts these fields into appropriate columns in a ...

20. Insert from java into SQL Server appends 'null'    stackoverflow.com

I'm trying to insert values into a SQL database from within Java. This works fine, except for some of the values. Eg, when I insert "foo" it appends null at the ...

21. INSERT in Stored Procedure called via JDBC    stackoverflow.com

I have an MSSQL Server 2008 (Express) set up. In my database I have a set of tables and a stored procedure. What I want to achieve is get any changes that have ...

23. cooL, it takes 14 seconds to insert 721 records to SQL Server 7.0    coderanch.com

Dear all, I just wrote a java program to read data from file and then insert to SQL Server. The file has 721 records ready to be inserted to database. The following is the program import java.sql.ResultSet; import java.sql.SQLException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; import java.util.HashMap; import org.apache.log4j.Logger; import com.ibm.websphere.jdbc.base.BasePreparedStatement; import com.ibm.websphere.jdbc.base.BaseBatchUpdateException; public class TeleMarkInsertRecAdaptorDAO extends TeleMarkDBAdaptorDAO { private int ...

24. strange error while executing an insert statement in MS SQL Server    coderanch.com

Hi all, i am using MS SQL Server and JDBC-ODBC bridge.i am having a very strange problem while trying to execute an insert statement. i get an saying database is busy with the results of another hstmt. by trial and error i found out that this was because of a SELECT statement a couple of lines above the INSERT statement.i was ...

25. How to put Row level lock in java while inserting a row in MSSQL table    coderanch.com

Hi folks, I am writing a java application where data is getting inserted in a table, say, table1 in database, say, db1. The back-end is MS SQL server 7.0. I am using JDBC-ODBC bridge. Now, the thing is when I a have one client then the application is running properly. But when there are multiple clients, deadlock occurs on the table ...

26. Java/ SQL-Server- What is wrong with my INSERT?    coderanch.com

Here I convert a String into a bytearray before loading it into a MS SQL Server table. The byte array is to be stored in a field of datatype=IMAGE. The 3 fields of the table are: rpt_id (char) rpt_name (char) rpt_data (IMAGE) The code looks like this: String fileData="A,B,C,D,E"; byte[] defaultBytes = filedata.getBytes(); String insertSQL = "INSERT INTO reports (rpt_id,rpt_name,rpt_data) VALUES ...

28. Inserting a BLOB into MSSQL Server 2000    coderanch.com

I'm not sure about this, but I think MSSQL Server has two different data types for large fields. One is BLOB (or something like that) which is binary data. Another one is Text or something like that. I'm not sure you can use free text search in the binary data types. Check it out. Try doing a search for MS SQL ...

29. insert CLOB into MS SQL Server 2K    coderanch.com

30. Problem while inserting data into MS SQL table    coderanch.com

Dear All, I am facing a strange problem with jdbc-odbc bridge database driver. Problem is as follows: I wrote a small script to read data from one database table at my local MS SQL server and after that inserting a record in another database. Now problem is that everything works fine, even executeUpdate() method gives me 1 after running insert query ...

31. Help: Inserting non-english(Hebrew) characters in MS SQL SERVER 2005    coderanch.com

Thanks for the quick response. I am not sure how to setup database encoding to use UNICODE . As I mentioned before, while creating the database, I have specified the COLLATE as SQL_Latin1_General_Cp1255_CI_AS. And regarding determining if the values coming from database is junk or not, i am downloading/extracting the data from the database into a MS Excel format file and ...

34. Problem while inserting data into MS SQL Server 2005.    coderanch.com

Sorry all, Before mentioning the problem,the connection was lost.I am extremely sorry for that. I have developed a portal for a Quiz application.I am using JSP as front end and MS SQL Server as backend. I am encrypting both the question and correct answer.While I am trying to store these details into the database I am getting a SQL exception. [Microsoft][SQLServer ...

35. SQL Server bulk insert    coderanch.com

Hi all, I need to insert a few text (csv) files into a remote MS SQL Server. I tried to use a generic sql client (aqua data studio) but it seems to be generating an insert for each record. Very inefficient and takes hours for even moderate size files (50K records). I was thinking of using jtds to do bulk insert. ...

36. Starting Point for Script that Inserts a Folder of .PDF files into an SQL Server Database    coderanch.com

Hello, I was wondering if anyone could point me in the right direction with some sample code snippets etc, for the following: I want to create a Java Application that runs standalone on a scheduled/cron basis. When it runs it will look at a folder say "reports" and read each .pdf file in that folder and load it into a SQL ...

37. How do I insert local AUDIO data into a remote SQL Server 200x DB?    java-forums.org

hey there, I have a local JAVA application connected to a remote DB using a sqlserver driver. The table has strings, numbers and a varbinary column defined to hold audio data. I used local *.SQL files in order to populate the tables initially. I used an OPENROWSET SINGLE_BLOB SQL call to move the audio data into the varbinary field, all that ...

39. EJB3.0 + NetBean 6 + MSSQL 2005 Cannot insert the value NULL into column    forums.oracle.com

EJB3.0 + NetBean 6 + MSSQL 2005 Cannot insert the value NULL into column Posted: May 22, 2008 12:23 AM Reply I am using Netbean6 to create ejb3.0 (sessionbean ,entity) and connecting to MSSQL 2005, ejb3 i am using CMP , if i change the database working perfectly, if i use MSSQL 2005 i am getting the following error, ...

40. sqlserver date insert question    forums.oracle.com

41. tyring to insert datetime field in sql server    forums.oracle.com

42. Text file insert to sql server advise    forums.oracle.com

You defined runSQL but never call it. Once you get your File from the JFileChooser in the actionPerformed event, you do nothing else, and your code eventually exits main and the program terminates. You should do something else at that point, perhaps passing your selected file to your runSQL method. Please use the code tags (CODE button on the editor) to ...

43. Inserting text file data into a database(sql server)    forums.oracle.com

Hai I have a text file, test.txt in which the data is in the below format Acno (1-10 positions) CustId (11-18 positions) AcType(19-25 positions) Say Acno CustId AcType 10000 2345 Savings 10001 1234 Current 10002 2367 Savings : : : I need to retreive the rows whose AcType is Savings from the above text file and insert into database as bulk. ...

45. Problem inserting greek data into Mssql database    forums.oracle.com

Hi All, Iam trying to insert greek data from jsp page into database ,eg. i enter " " from my jsp page and after submitting form, values are inserting in database but not the exact greek words i enterd instead its showing " ? ?? " in database and same on jsp page.How can i insert greek data in ...

46. EJB3.0 + NetBean 6 + MSSQL 2005 Cannot insert value NULL into column    forums.oracle.com

EJB3.0 + NetBean 6 + MSSQL 2005 Cannot insert value NULL into column Posted: May 22, 2008 12:25 AM Reply I am using Netbean6 to create ejb3.0 (sessionbean ,entity) and connecting to MSSQL 2005, ejb3 i am using CMP , if i change the database working perfectly, if i use MSSQL 2005 i am getting the following error, any ...

47. Inserting arabic text from java to sql server    forums.oracle.com

Please refrain from cross-posting. I have some doubt you'll get this resolved in two days based on the skill level you present in your post. There are multiple steps in which things could be going wrong. You will have to check each one. 1) Characters being entered in your form and sent to your servlet for processing could be getting mangled ...

48. Inserting a GregorianCalendar into a SQL Server datetime column.    forums.oracle.com

This is more like an SQL question than a Java question. Your problem is with the date formatting of your DBMS itself. SQL offers many functions that could convert your string to the date format it is expecting. Once you know that format you just parse the date you have in your application and present it to your server in the ...