Showing posts with label saving. Show all posts
Showing posts with label saving. Show all posts

Friday, March 30, 2012

Problem saving/retrieving unicode characters NVARCHAR with unicode collation (java jdbc)

I'm connecting to a SQL Server 2005 database using the latest (beta) sql server driver (Microsoft SQL Server 2005 JDBC Driver 1.1 CTP June 2006) from within Java (Rational Application Developer).

The table in SQL Server database has collation Latin1_General_CI_AS and one of the columns is a NVARCHAR with collation Indic_General_90_CI_AS. This should be a Unicode only collation. However when storing for instance the following String:

€_£_ùúü?ùúü?_???????£????_???_??????_прстуф_????
... it is saved with ? for all unicode characters as follows (when looking in the database):
€_£_ùúü?ùúü?_???????£????_???_?_?_?

The above is not correct, since all unicode characters should still be visible. When inserting the same string directly into the sql server database (without using Java) the result is ok.

Also when trying to retrieve the results again it complains about the following error within Java:

Codepage 0 is not supported by the Java environment.

Hopefully somebody has an answer for this problem. When I alter the collation of the NVARCHAR column to be Latin1_General_CI_AS as well, the data can be stored and retrieved however then of course the unicode specific characters are lost and results into ? So in that case the output is as described above (ie €_£_ùúü?ùúü?_???????£????_???_?_?_?)

We would like to be able to persist and retrieve unicode characters in a SQL Server database using the correct JDBC Driver. We achieved this result already with an Oracle UTF8 database. But we need to be compliant with a SQL Server database as well. Please help.

Thanks in advance for your help.So far nobody replied on my question. unfortunately.
Please help me to sort out this problem.

Bottom line we just want to be able to save and retrieve Unicode characters in SQL server within our Java application. We want to do this by setting the NVARCHAR columns in all tables to a Unicode collation.

Please help.
Thanks.|||

Hugo,

Can you tell me whether you have sendStringParametersAsUnicode set to "false" in your connection properties?

Thank you,

--David Olix

JDBC Development

|||

Hi David,

Thanks for your reply. I can ensure that I didn't set the sendStringParametersAsUnicode to "false". This parameter is default set to "true" so I didn't change it in the connection properties.

I found out that the unicode Collation I used "Indic_General_90_CI_AS" had a Codepage 0 in my SQL Server 2005 installation. In fact all unicode only collations do have a codepage 0 if I check them all using the following command:

SELECT COLLATIONPROPERTY('Indic_General_90_CI_AS', 'CodePage') as CodePage

Is this perhaps related to the problem I have in Java? Because in there the exception explains about the fact that the codepage is 0.

I really hope you can help me to sort this out.

Thanks in advance for your help David.

Hugo

|||Hi David,

I found the solution. When updating a SQL Server 2005 NVARCHAR column, you have to use the following syntax:

UPDATE <table> SET <column> = N'<value>'

So for example:
UPDATE customer SET id = '€_???????£????_???_??????_прстуф_????'

Has to be this for a SQL Server connection:

UPDATE customer SET id = N'€_???????£????_???_??????_прстуф_????'


The prefix N before the value is required to make sure to save the string in Unicode format. I did not do this so far. Now I'm able to store and retrieve data into a SQL Server database and my collatin is now Latin1_General_CI_AS since this supports Unicode as well.

Hugo|||

hi hugo

this is gr8 thread

i have facing a problem

i want to insert indic values in a table in SQL server

the update statement u mentioned is useful

UPDATE <table> SET <column> = N'<value>'

but when i use INSERT INTO <table> VALUES(N'<value>')

can u tell me y doesnt this work

tahnx in advance.

Problem saving/retrieving unicode characters NVARCHAR with unicode collation (java jdbc)

I'm connecting to a SQL Server 2005 database using the latest (beta) sql server driver (Microsoft SQL Server 2005 JDBC Driver 1.1 CTP June 2006) from within Java (Rational Application Developer).

The table in SQL Server database has collation Latin1_General_CI_AS and one of the columns is a NVARCHAR with collation Indic_General_90_CI_AS. This should be a Unicode only collation. However when storing for instance the following String:

€_£_ùúü?ùúü?_???????£????_???_??????_прстуф_????
... it is saved with ? for all unicode characters as follows (when looking in the database):
€_£_ùúü?ùúü?_???????£????_???_?_?_?


The above is not correct, since all unicode characters should still be visible. When inserting the same string directly into the sql server database (without using Java) the result is ok.

Also when trying to retrieve the results again it complains about the following error within Java:

Codepage 0 is not supported by the Java environment.


Hopefully somebody has an answer for this problem. When I alter the collation of the NVARCHAR column to be Latin1_General_CI_AS as well, the data can be stored and retrieved however then of course the unicode specific characters are lost and results into ? So in that case the output is as described above (ie €_£_ùúü?ùúü?_???????£????_???_?_?_?)

We would like to be able to persist and retrieve unicode characters in a SQL Server database using the correct JDBC Driver. We achieved this result already with an Oracle UTF8 database. But we need to be compliant with a SQL Server database as well. Please help.

Thanks in advance for your help.
So far nobody replied on my question. unfortunately.
Please help me to sort out this problem.

Bottom line we just want to be able to save and retrieve Unicode characters in SQL server within our Java application. We want to do this by setting the NVARCHAR columns in all tables to a Unicode collation.

Please help.
Thanks.
|||

Hugo,

Can you tell me whether you have sendStringParametersAsUnicode set to "false" in your connection properties?

Thank you,

--David Olix

JDBC Development

|||

Hi David,

Thanks for your reply. I can ensure that I didn't set the sendStringParametersAsUnicode to "false". This parameter is default set to "true" so I didn't change it in the connection properties.

I found out that the unicode Collation I used "Indic_General_90_CI_AS" had a Codepage 0 in my SQL Server 2005 installation. In fact all unicode only collations do have a codepage 0 if I check them all using the following command:

SELECT COLLATIONPROPERTY('Indic_General_90_CI_AS', 'CodePage') as CodePage

Is this perhaps related to the problem I have in Java? Because in there the exception explains about the fact that the codepage is 0.

I really hope you can help me to sort this out.

Thanks in advance for your help David.

Hugo

|||Hi David,

I found the solution. When updating a SQL Server 2005 NVARCHAR column, you have to use the following syntax:

UPDATE <table> SET <column> = N'<value>'

So for example:
UPDATE customer SET id = '€_???????£????_???_??????_прстуф_????'

Has to be this for a SQL Server connection:

UPDATE customer SET id = N'€_???????£????_???_??????_прстуф_????'


The prefix N before the value is required to make sure to save the string in Unicode format. I did not do this so far. Now I'm able to store and retrieve data into a SQL Server database and my collatin is now Latin1_General_CI_AS since this supports Unicode as well.

Hugo
|||

hi hugo

this is gr8 thread

i have facing a problem

i want to insert indic values in a table in SQL server

the update statement u mentioned is useful

UPDATE <table> SET <column> = N'<value>'

but when i use INSERT INTO <table> VALUES(N'<value>')

can u tell me y doesnt this work

tahnx in advance.

Monday, March 26, 2012

problem regarding relationship

this is my diagram http://aspspider.net/vhalexxs/relationship.jpg

here is the error while saving the diagram...

'rco_prodattr' table saved successfully
'rco_prodacc' table
- Unable to create relationship 'FK_rco_prodacc_rco_prodattr1'.
Introducing FOREIGN KEY constraint 'FK_rco_prodacc_rco_prodattr1' on table 'rco_prodacc' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints.
Could not create constraint. See previous errors.

is there a way to create a constrain with cascade delete and update on rco_prodacc, or if not what will be the best possible solution for this.

thanks....

Do not enforce second relationship and maintain it by triggers on rco_prodattr.|||

does trigger also roll back when you perform a rollback transaction command in SQL

|||Rollback command rollbacks the transaction whatever it called from within.sql

Tuesday, March 20, 2012

Problem on Saving Data to one of the Database but work normal on other DB

Hi All,
I have some trouble on supporting a Windows Base System wrote by DELPHI
language implemented in my Company
Environment :
There are two Windows Server 2003 Std Ed servers
Server1 is Application Server
Server2 is Database Server(MS SQL2000 Std SP3a)
Hardware:
IBM Dual Xeon CPU
4GB Memory
Raid5 with 137GB Harddisk Space
Networking:
Server1 exposed to the Internet with firewall protected
A cross over cable connected between Server1 and Server2
Our Case:
We setup the Application on Server1
And all Workstations using the Windows Base Interface to use the program
If some user work outside Office, they will use the program through a remote
connection named TAXXI(http://www.taxxi.com).
Now we met a problem, on the SQL Server, we have created 3-5 database for
different group of users.
One of the database named D on the SQL Server always hang without any error
log.
It suddenly hang when user save their Data.
They can get the data from the System ,
only Save the data will make the screen freeze and lost of data after the
system back to normal in a hrs later.
We can't find any strange log on the EVENT VIEWER or SQL Server Log
From the Performance Monitor, we just found the Page Fault/sec was high and
always reach the Peak on Server1.
For Server2, only Write to Physical Disk was high.
If we login to other database in the time database D freeze the user screen
when save,
it works normally with input or save data to the system.
Plz help and give some suggestions for us to solve the problem.
Thx
Jack
Have you checked for database blocking during the save operation?
Hope this helps.
Dan Guzman
SQL Server MVP
"J" <j@.j> wrote in message news:%23hqYryrMFHA.2384@.tk2msftngp13.phx.gbl...
> Hi All,
> I have some trouble on supporting a Windows Base System wrote by DELPHI
> language implemented in my Company
> Environment :
> There are two Windows Server 2003 Std Ed servers
> Server1 is Application Server
> Server2 is Database Server(MS SQL2000 Std SP3a)
> Hardware:
> IBM Dual Xeon CPU
> 4GB Memory
> Raid5 with 137GB Harddisk Space
> Networking:
> Server1 exposed to the Internet with firewall protected
> A cross over cable connected between Server1 and Server2
> Our Case:
> We setup the Application on Server1
> And all Workstations using the Windows Base Interface to use the program
> If some user work outside Office, they will use the program through a
> remote
> connection named TAXXI(http://www.taxxi.com).
> Now we met a problem, on the SQL Server, we have created 3-5 database for
> different group of users.
> One of the database named D on the SQL Server always hang without any
> error
> log.
> It suddenly hang when user save their Data.
> They can get the data from the System ,
> only Save the data will make the screen freeze and lost of data after the
> system back to normal in a hrs later.
> We can't find any strange log on the EVENT VIEWER or SQL Server Log
> From the Performance Monitor, we just found the Page Fault/sec was high
> and
> always reach the Peak on Server1.
> For Server2, only Write to Physical Disk was high.
> If we login to other database in the time database D freeze the user
> screen
> when save,
> it works normally with input or save data to the system.
> Plz help and give some suggestions for us to solve the problem.
> Thx
> Jack
>
|||I agree with Dan, it sounds like a locking problem... when things are hung
up, use sp_who or Sp_who2, and check the blocking field. If it is non-zero,
then the corresponding spid is being blocked by the spid in the blocking
field...
This problem is generally caused by long-running trasnactions.
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"J" <j@.j> wrote in message news:%23hqYryrMFHA.2384@.tk2msftngp13.phx.gbl...
> Hi All,
> I have some trouble on supporting a Windows Base System wrote by DELPHI
> language implemented in my Company
> Environment :
> There are two Windows Server 2003 Std Ed servers
> Server1 is Application Server
> Server2 is Database Server(MS SQL2000 Std SP3a)
> Hardware:
> IBM Dual Xeon CPU
> 4GB Memory
> Raid5 with 137GB Harddisk Space
> Networking:
> Server1 exposed to the Internet with firewall protected
> A cross over cable connected between Server1 and Server2
> Our Case:
> We setup the Application on Server1
> And all Workstations using the Windows Base Interface to use the program
> If some user work outside Office, they will use the program through a
> remote
> connection named TAXXI(http://www.taxxi.com).
> Now we met a problem, on the SQL Server, we have created 3-5 database for
> different group of users.
> One of the database named D on the SQL Server always hang without any
> error
> log.
> It suddenly hang when user save their Data.
> They can get the data from the System ,
> only Save the data will make the screen freeze and lost of data after the
> system back to normal in a hrs later.
> We can't find any strange log on the EVENT VIEWER or SQL Server Log
> From the Performance Monitor, we just found the Page Fault/sec was high
> and
> always reach the Peak on Server1.
> For Server2, only Write to Physical Disk was high.
> If we login to other database in the time database D freeze the user
> screen
> when save,
> it works normally with input or save data to the system.
> Plz help and give some suggestions for us to solve the problem.
> Thx
> Jack
>

Problem on Saving Data to one of the Database but work normal on other DB

Hi All,
I have some trouble on supporting a Windows Base System wrote by DELPHI
language implemented in my Company
Environment :
There are two Windows Server 2003 Std Ed servers
Server1 is Application Server
Server2 is Database Server(MS SQL2000 Std SP3a)
Hardware:
IBM Dual Xeon CPU
4GB Memory
Raid5 with 137GB Harddisk Space
Networking:
Server1 exposed to the Internet with firewall protected
A cross over cable connected between Server1 and Server2
Our Case:
We setup the Application on Server1
And all Workstations using the Windows Base Interface to use the program
If some user work outside Office, they will use the program through a remote
connection named TAXXI(http://www.taxxi.com).
Now we met a problem, on the SQL Server, we have created 3-5 database for
different group of users.
One of the database named D on the SQL Server always hang without any error
log.
It suddenly hang when user save their Data.
They can get the data from the System ,
only Save the data will make the screen freeze and lost of data after the
system back to normal in a hrs later.
We can't find any strange log on the EVENT VIEWER or SQL Server Log
From the Performance Monitor, we just found the Page Fault/sec was high and
always reach the Peak on Server1.
For Server2, only Write to Physical Disk was high.
If we login to other database in the time database D freeze the user screen
when save,
it works normally with input or save data to the system.
Plz help and give some suggestions for us to solve the problem.
Thx
JackHave you checked for database blocking during the save operation?
Hope this helps.
Dan Guzman
SQL Server MVP
"J" <j@.j> wrote in message news:%23hqYryrMFHA.2384@.tk2msftngp13.phx.gbl...
> Hi All,
> I have some trouble on supporting a Windows Base System wrote by DELPHI
> language implemented in my Company
> Environment :
> There are two Windows Server 2003 Std Ed servers
> Server1 is Application Server
> Server2 is Database Server(MS SQL2000 Std SP3a)
> Hardware:
> IBM Dual Xeon CPU
> 4GB Memory
> Raid5 with 137GB Harddisk Space
> Networking:
> Server1 exposed to the Internet with firewall protected
> A cross over cable connected between Server1 and Server2
> Our Case:
> We setup the Application on Server1
> And all Workstations using the Windows Base Interface to use the program
> If some user work outside Office, they will use the program through a
> remote
> connection named TAXXI(http://www.taxxi.com).
> Now we met a problem, on the SQL Server, we have created 3-5 database for
> different group of users.
> One of the database named D on the SQL Server always hang without any
> error
> log.
> It suddenly hang when user save their Data.
> They can get the data from the System ,
> only Save the data will make the screen freeze and lost of data after the
> system back to normal in a hrs later.
> We can't find any strange log on the EVENT VIEWER or SQL Server Log
> From the Performance Monitor, we just found the Page Fault/sec was high
> and
> always reach the Peak on Server1.
> For Server2, only Write to Physical Disk was high.
> If we login to other database in the time database D freeze the user
> screen
> when save,
> it works normally with input or save data to the system.
> Plz help and give some suggestions for us to solve the problem.
> Thx
> Jack
>|||I agree with Dan, it sounds like a locking problem... when things are hung
up, use sp_who or Sp_who2, and check the blocking field. If it is non-zero,
then the corresponding spid is being blocked by the spid in the blocking
field...
This problem is generally caused by long-running trasnactions.
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"J" <j@.j> wrote in message news:%23hqYryrMFHA.2384@.tk2msftngp13.phx.gbl...
> Hi All,
> I have some trouble on supporting a Windows Base System wrote by DELPHI
> language implemented in my Company
> Environment :
> There are two Windows Server 2003 Std Ed servers
> Server1 is Application Server
> Server2 is Database Server(MS SQL2000 Std SP3a)
> Hardware:
> IBM Dual Xeon CPU
> 4GB Memory
> Raid5 with 137GB Harddisk Space
> Networking:
> Server1 exposed to the Internet with firewall protected
> A cross over cable connected between Server1 and Server2
> Our Case:
> We setup the Application on Server1
> And all Workstations using the Windows Base Interface to use the program
> If some user work outside Office, they will use the program through a
> remote
> connection named TAXXI(http://www.taxxi.com).
> Now we met a problem, on the SQL Server, we have created 3-5 database for
> different group of users.
> One of the database named D on the SQL Server always hang without any
> error
> log.
> It suddenly hang when user save their Data.
> They can get the data from the System ,
> only Save the data will make the screen freeze and lost of data after the
> system back to normal in a hrs later.
> We can't find any strange log on the EVENT VIEWER or SQL Server Log
> From the Performance Monitor, we just found the Page Fault/sec was high
> and
> always reach the Peak on Server1.
> For Server2, only Write to Physical Disk was high.
> If we login to other database in the time database D freeze the user
> screen
> when save,
> it works normally with input or save data to the system.
> Plz help and give some suggestions for us to solve the problem.
> Thx
> Jack
>

Problem on Saving Data to one of the Database but work normal on other DB

Hi All,
I have some trouble on supporting a Windows Base System wrote by DELPHI
language implemented in my Company
Environment :
There are two Windows Server 2003 Std Ed servers
Server1 is Application Server
Server2 is Database Server(MS SQL2000 Std SP3a)
Hardware:
IBM Dual Xeon CPU
4GB Memory
Raid5 with 137GB Harddisk Space
Networking:
Server1 exposed to the Internet with firewall protected
A cross over cable connected between Server1 and Server2
Our Case:
We setup the Application on Server1
And all Workstations using the Windows Base Interface to use the program
If some user work outside Office, they will use the program through a remote
connection named TAXXI(http://www.taxxi.com).
Now we met a problem, on the SQL Server, we have created 3-5 database for
different group of users.
One of the database named D on the SQL Server always hang without any error
log.
It suddenly hang when user save their Data.
They can get the data from the System ,
only Save the data will make the screen freeze and lost of data after the
system back to normal in a hrs later.
We can't find any strange log on the EVENT VIEWER or SQL Server Log
From the Performance Monitor, we just found the Page Fault/sec was high and
always reach the Peak on Server1.
For Server2, only Write to Physical Disk was high.
If we login to other database in the time database D freeze the user screen
when save,
it works normally with input or save data to the system.
Plz help and give some suggestions for us to solve the problem.
Thx
JackHave you checked for database blocking during the save operation?
--
Hope this helps.
Dan Guzman
SQL Server MVP
"J" <j@.j> wrote in message news:%23hqYryrMFHA.2384@.tk2msftngp13.phx.gbl...
> Hi All,
> I have some trouble on supporting a Windows Base System wrote by DELPHI
> language implemented in my Company
> Environment :
> There are two Windows Server 2003 Std Ed servers
> Server1 is Application Server
> Server2 is Database Server(MS SQL2000 Std SP3a)
> Hardware:
> IBM Dual Xeon CPU
> 4GB Memory
> Raid5 with 137GB Harddisk Space
> Networking:
> Server1 exposed to the Internet with firewall protected
> A cross over cable connected between Server1 and Server2
> Our Case:
> We setup the Application on Server1
> And all Workstations using the Windows Base Interface to use the program
> If some user work outside Office, they will use the program through a
> remote
> connection named TAXXI(http://www.taxxi.com).
> Now we met a problem, on the SQL Server, we have created 3-5 database for
> different group of users.
> One of the database named D on the SQL Server always hang without any
> error
> log.
> It suddenly hang when user save their Data.
> They can get the data from the System ,
> only Save the data will make the screen freeze and lost of data after the
> system back to normal in a hrs later.
> We can't find any strange log on the EVENT VIEWER or SQL Server Log
> From the Performance Monitor, we just found the Page Fault/sec was high
> and
> always reach the Peak on Server1.
> For Server2, only Write to Physical Disk was high.
> If we login to other database in the time database D freeze the user
> screen
> when save,
> it works normally with input or save data to the system.
> Plz help and give some suggestions for us to solve the problem.
> Thx
> Jack
>|||I agree with Dan, it sounds like a locking problem... when things are hung
up, use sp_who or Sp_who2, and check the blocking field. If it is non-zero,
then the corresponding spid is being blocked by the spid in the blocking
field...
This problem is generally caused by long-running trasnactions.
--
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"J" <j@.j> wrote in message news:%23hqYryrMFHA.2384@.tk2msftngp13.phx.gbl...
> Hi All,
> I have some trouble on supporting a Windows Base System wrote by DELPHI
> language implemented in my Company
> Environment :
> There are two Windows Server 2003 Std Ed servers
> Server1 is Application Server
> Server2 is Database Server(MS SQL2000 Std SP3a)
> Hardware:
> IBM Dual Xeon CPU
> 4GB Memory
> Raid5 with 137GB Harddisk Space
> Networking:
> Server1 exposed to the Internet with firewall protected
> A cross over cable connected between Server1 and Server2
> Our Case:
> We setup the Application on Server1
> And all Workstations using the Windows Base Interface to use the program
> If some user work outside Office, they will use the program through a
> remote
> connection named TAXXI(http://www.taxxi.com).
> Now we met a problem, on the SQL Server, we have created 3-5 database for
> different group of users.
> One of the database named D on the SQL Server always hang without any
> error
> log.
> It suddenly hang when user save their Data.
> They can get the data from the System ,
> only Save the data will make the screen freeze and lost of data after the
> system back to normal in a hrs later.
> We can't find any strange log on the EVENT VIEWER or SQL Server Log
> From the Performance Monitor, we just found the Page Fault/sec was high
> and
> always reach the Peak on Server1.
> For Server2, only Write to Physical Disk was high.
> If we login to other database in the time database D freeze the user
> screen
> when save,
> it works normally with input or save data to the system.
> Plz help and give some suggestions for us to solve the problem.
> Thx
> Jack
>