Calling a stored procedure from Java with ojdbc 1.4 corrupts (converts to ¿) unicode characters that are not contained in DB's current charset.
Calling this proc from C# works as expected (all unicode characters are properly stored). - String driver = "oracle.jdbc.OracleDriver";
-
Class.forName(driver);
-
DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
-
conn = DriverManager.getConnection(url, username, password);
-
CallableStatement storedProc = conn.prepareCall("{call SMSC.p_smsu_campaign_insert(?,?,?,?,?,?)}");
-
-
String campaign="_šđčćž ò#±¦ţ!ę";
-
storedProc.setString("Campaign_name", campaign); //<----problem here!
-
//Campaign_name parameter in DB is nchar type (oracle's unicode type)
-
/*set other parameters*/
-
storedProc.execute();
Do you have any idea what is the cause?
Note: this is a simplification of my previous post 2 3550
If anyone comes by the same problem again, here is the solution: - storedProc.setString("Campaign_name", campaign);
-
((OraclePreparedStatement) storedProc).setFormOfUse(1, OraclePreparedStatement.FORM_NCHAR); //<---this makes the difference!
JosAH 11,448
Recognized Expert MVP
If anyone comes by the same problem again, here is the solution: - storedProc.setString("Campaign_name", campaign);
-
((OraclePreparedStatement) storedProc).setFormOfUse(1, OraclePreparedStatement.FORM_NCHAR); //<---this makes the difference!
Not that I know another solution to your problem but I find the solution you
showed here very ugly: it ties your code to the Oracle database forever. Better
isolate that trickery-dickery to a small utility class that can be changed when
you have to migrate to another database.
kind regards,
Jos
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Rahul |
last post by:
I am getting the following exception when accessing one of my tables.
java.lang.reflect.InvocationTargetException:
java.lang.ArrayIndexOutOfBoundsException
at oracle.sql.NUMBER._fromLnxFmt(NUMBER.java:3181)
at oracle.sql.NUMBER.toBigDecimal(NUMBER.java:636)
at oracle.jdbc.dbaccess.DBConversion.NumberBytesToBigDecimal(DBConversio
n.java:2805)
at oracle.jdbc.driver.OracleStatement.getBigDecimalValue(OracleStatement
..java:4539)
|
by: Kevin |
last post by:
Dear all,
Could you please advise where should I put the Oracle JDBC driver
(classes12.zip or classes12.jar) under Windows XP with Tomcat 4.1? Do I
need to set classpath?
Many thanks.
Kevin.
|
by: mwang |
last post by:
We just upgraded JDBC Thin driver from 9.0.1 to 9.2.0.3. After the
upgrade we found the applications ran significantly slower. Our test
showed the same app running up to 5 times slower with the new driver
than with the previous driver. The database server is Oracle 9.2.0.1.0
E.E.. Has anyone else also experienced similar performance degradation
with JDBC 9.2.0.3?
|
by: Kona |
last post by:
Hello,
I'm new with Oracle JDBC connection.
Is it a way to crypt, hide the password string into a Oracle JDBC
connection string ?
The goal is to hide the password within script file.
Thank's in advance
|
by: goyald |
last post by:
Is their any support for data compression while using Oracle JDBC
driver (8i or above)
Thanks
| |
by: stmfc |
last post by:
hi,
is there any place where i can download oracle jdbc connector for free
other than official oracle site (in oracle.com sign-up procedure takes too much time )
|
by: Jim Kennedy |
last post by:
ALL DDL does a commit. Hence Drop Table movies; issues a commit. True you
don't issue a commit and the driver does not issue a commit, but the server
does for all DDL.
That is probably where your commit is coming from.
Jim
--
Replace part of the email address: kennedy-down_with_spammers@attbi.com
with family. Remove the negative part, keep the minus sign. You can figure
it out.
|
by: Debabrata Jana |
last post by:
Please go through the JAVA code below:
class Main{
public Connection getConnection(){
Connection l_con = null;
try {
String hostname = "172.10.23.1:1527"; //Host IP:port No
String dbsid = "TESTSID"; //SID Name or Service Name
String username = "TESTUSER"; //Database user
String password = "password"; //User password
|
by: yeshvanth |
last post by:
hi i got windows 7 as os and orcle 11g installed in my pc and i set classpath for "ojdbc5.jar" file but still whenever i use "oracle.jdbc.OracleDriver" it shows the following
exception in thread main classnotfound exception for the following code
import java.sql.*;
class One
{
public static void main(String args)throws Exception
{
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |