[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Cannot save foreign characters to database correctly.

bertnz do-not-reply at jboss.com
Sun Sep 16 20:51:55 EDT 2007

Hi everyone,

I have inherited a J2EE application running inside a JBoss environment and am having trouble getting it to save Polish data correctly to the database.

I have the following code snipped which I have run in its own command line application I created and also run inside the JBoss application in question.

  | 			Class.forName("net.sourceforge.jtds.jdbc.Driver");
  | 			conn = DriverManager.getConnection("jdbc:jtds:sqlserver://localhost:1433/MyDatabase;selectMethod=cursor;appName=MyApp;", "MyUser", "password");
  | 			PreparedStatement t = conn.prepareStatement("insert into Test (TestColumn) values (N'Zwo?ywano - Outside of session')");
  | 			t.execute();
  | 			}
  | 			catch (Exception ex) 
  | 			{
  | 				System.out.println(ex.getMessage());
  | 			}
  | 			finally 
  | 			{
  | 				try {
  | 					conn.close();
  | 				}
  | 				catch (Exception ex) {}
  | 			}

When I run it by itself in its little harness app it puts in the correct polish characters into my SQL2000 database. As soon as I run the exact same code inside my JBoss environment the special characters get warped on their way to the database.

It is the exact same code using the exact same driver and connection string?

Any ideas?


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4084851#4084851

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4084851

More information about the jboss-user mailing list