Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 ERROR INTRODUCING WORD DOC

Author  Topic 

SQLapprentice
Starting Member

29 Posts

Posted - 2012-02-12 : 09:53:14
When I try to send a word doc to a text column I get this error:

Incorrect string value: '\xD0\xCF\x11\xE0\xA1\xB1...' for column 'text' at row 1



Can anyone help me with this?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-02-12 : 12:05:39
how are sending it? using an application or direct t-sql statement?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

SQLapprentice
Starting Member

29 Posts

Posted - 2012-02-12 : 18:05:30
I'm using jdbc in a jsp web apllication:

String url = "jdbc:mysql://localhost/data?";
String username = "root";
String password = "root";
String path="c:\\Users\\Desktop\\00011.doc";


Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection(url, username, password);
conn.setAutoCommit(false);
String sql = "INSERT INTO versao2 (name, version, text) VALUES (?, ?, ?)";
PreparedStatement stmt = conn.prepareStatement(sql);
stmt.setString(1, "name");
stmt.setString(2, "version");

File text = new File(path);
fis = new FileInputStream(image);
stmt.setBinaryStream(3, fis, (int) text.length());
stmt.execute();
Go to Top of Page

SQLapprentice
Starting Member

29 Posts

Posted - 2012-02-12 : 18:06:38
I'm using jdbc in a jsp web apllication:

String url = "jdbc:mysql://localhost/data?";
String username = "root";
String password = "root";
String path="c:\\Users\\Desktop\\00011.doc";


Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection(url, username, password);
conn.setAutoCommit(false);
String sql = "INSERT INTO versao2 (name, version, text) VALUES (?, ?, ?)";
PreparedStatement stmt = conn.prepareStatement(sql);
stmt.setString(1, "name");
stmt.setString(2, "version");

File text = new File(path);
fis = new FileInputStream(text);
stmt.setBinaryStream(3, fis, (int) text.length());
stmt.execute();
Go to Top of Page

SQLapprentice
Starting Member

29 Posts

Posted - 2012-02-13 : 02:00:48
Now it's working with text columns, changed to txt and utf8
Go to Top of Page
   

- Advertisement -