ケース 1:リモート サーバー上にある sql-server 2005 データベースに接続しようとしています。
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
connection = DriverManager.getConnection("jdbc:sqlserver://190.128.4.195/unicodedemo?user=ab&password=ab@Admin&useUnicode=true&characterEncoding=UTF-8");
実行すると、次の例外が発生しました。
com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host 190.128.4.195/unicodedemo?user=ab&password=ab@Admin&useUnicode=true&characterEncoding=UTF-8, port 1433 has failed. Error: "null. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall.".
ケース2:しかし、使用してデータソース名を使用しようとしたとき
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver") ;
connection = java.sql.DriverManager.getConnection("jdbc:odbc:unidemo","ab","ab@Admin");
データは正常に挿入されましたが、その場合、挿入された Unicode データが表示されませんでした。として表示され?????
ます。
誰でもエラーの解決を手伝ってもらえますか? ケース 1 でコミットしている場合、2 番目のケース (DSN を使用) を使用して Unicode 値を挿入するにはどうすればよいですか。
ありがとう..