Hi all!
My problem is very, very silly and stupid, I know, don't blame me for
that please...
When I call my query from SQL*Plus, I get the correct result:
SELECT check_passwd('u ser', 'password') FROM dual;
CHECK_PASSWD('U SER','PASSWORD' )
---------------------------------------
1
Now I need to to the same thing from java program, so I wrote the
following test:
Statement stmt = dbm.getConnecti on().createStat ement();
ResultSet rs = stmt.executeQue ry("SELECT check_passwd('u ser','password' )
FROM dual");
assertTrue(rs.n ext());
assertTrue(rs.g etInt(1) == 1);
....
However, the second assertion fails! rs.getInt(1) returns "0"!
check_passwd is the function that returns integer, either 0 or 1.
BTW, the same thing happens when I use PreparedStateme nt and setString()
instead of directly stuffing username and password into the query.
I'm porting the code from PostgreSQL to Oracle, and in Postgres
everything worked perfectly, so ... any ideas?
Thanks in advance!
--
Maxim Slojko 5 3947
What is a return type for check_password? And what would be returned if
instead of getInt(1) you call getString(2)?
Best regards,
Igor.
Maxim пишет: Hi all!
My problem is very, very silly and stupid, I know, don't blame me for that please...
When I call my query from SQL*Plus, I get the correct result:
SELECT check_passwd('u ser', 'password') FROM dual;
CHECK_PASSWD('U SER','PASSWORD' ) --------------------------------------- 1
Now I need to to the same thing from java program, so I wrote the following test:
Statement stmt = dbm.getConnecti on().createStat ement(); ResultSet rs = stmt.executeQue ry("SELECT check_passwd('u ser','password' ) FROM dual");
assertTrue(rs.n ext()); assertTrue(rs.g etInt(1) == 1);
....
However, the second assertion fails! rs.getInt(1) returns "0"! check_passwd is the function that returns integer, either 0 or 1. BTW, the same thing happens when I use PreparedStateme nt and setString() instead of directly stuffing username and password into the query.
I'm porting the code from PostgreSQL to Oracle, and in Postgres everything worked perfectly, so ... any ideas?
Thanks in advance!
-- Maxim Slojko
Igor Kolomiyets wrote: What is a return type for check_password? And what would be returned if instead of getInt(1) you call getString(2)?
check_password returns integer, either 0 or 1. The function seem to be
fine, except that value is get corrupted somehow, if I use JDBC.
getString(1) returns "0" in that case as well. Best regards, Igor.
Maxim пишет:
Hi all!
My problem is very, very silly and stupid, I know, don't blame me for that please...
When I call my query from SQL*Plus, I get the correct result:
SELECT check_passwd('u ser', 'password') FROM dual;
CHECK_PASSWD('U SER','PASSWORD' ) --------------------------------------- 1
Now I need to to the same thing from java program, so I wrote the following test:
Statement stmt = dbm.getConnecti on().createStat ement(); ResultSet rs = stmt.executeQue ry("SELECT check_passwd('u ser','password' ) FROM dual");
assertTrue(rs.n ext()); assertTrue(rs.g etInt(1) == 1);
....
However, the second assertion fails! rs.getInt(1) returns "0"! check_passwd is the function that returns integer, either 0 or 1. BTW, the same thing happens when I use PreparedStateme nt and setString() instead of directly stuffing username and password into the query.
I'm porting the code from PostgreSQL to Oracle, and in Postgres everything worked perfectly, so ... any ideas?
Thanks in advance!
-- Maxim Slojko
I'd debug PL/SQL function, JDBC does not seem to be a problem here
unless there is some collision of the datatypes occurs during the call.
Did you try to run this program with JDBC debuggin on?
Maxim пишет: Igor Kolomiyets wrote:
What is a return type for check_password? And what would be returned if instead of getInt(1) you call getString(2)?
check_password returns integer, either 0 or 1. The function seem to be fine, except that value is get corrupted somehow, if I use JDBC. getString(1) returns "0" in that case as well.
Well, I've got rid of that mistake. Here is the part of explanation, as
I understand it. I would appreciate if you give me the correct one in
return :)
I have a table:
name nvarchar2(20)
passwd nvarchar2(20)
secure number(1)
When I insert something in that table, the BEFORE trigger is fired and
if secure is set to true (or null) password's md5 checksum is stored.
Otherwise plain password is stored (or md5 computed on client side).
My check_passwd function does the same thing. If the account is secure
it computes md5 of supplied password string and compares that value to
the stored one.
The problem appeared due to some chracter conversion issues. The account
was created by simple insert query from SQL*Plus. But was checked from
JDBC. So, when I called check_passwd from SQL*Plus everything was fine,
but when I called it from java it failed. I used only ASCII 7bit
characters in both username and password, so
how this can be?.. I know Oracle has character conversion issues, but
there are only latin letters...
Igor Kolomiyets wrote: I'd debug PL/SQL function, JDBC does not seem to be a problem here unless there is some collision of the datatypes occurs during the call. Did you try to run this program with JDBC debuggin on?
Maxim пишет:
Igor Kolomiyets wrote:
What is a return type for check_password? And what would be returned if instead of getInt(1) you call getString(2)? check_password returns integer, either 0 or 1. The function seem to be fine, except that value is get corrupted somehow, if I use JDBC. getString(1) returns "0" in that case as well.
What was the reason in using nvarchar2 instead of varchar2? I wouldn't
do this especially when only latin characters are used in the data. I am
almost 100% sure that if you change the data type from nvarchar2 to
varchar2 problem will disappear.
Maxim пишет: Well, I've got rid of that mistake. Here is the part of explanation, as I understand it. I would appreciate if you give me the correct one in return :)
I have a table: name nvarchar2(20) passwd nvarchar2(20) secure number(1)
When I insert something in that table, the BEFORE trigger is fired and if secure is set to true (or null) password's md5 checksum is stored. Otherwise plain password is stored (or md5 computed on client side).
My check_passwd function does the same thing. If the account is secure it computes md5 of supplied password string and compares that value to the stored one.
The problem appeared due to some chracter conversion issues. The account was created by simple insert query from SQL*Plus. But was checked from JDBC. So, when I called check_passwd from SQL*Plus everything was fine, but when I called it from java it failed. I used only ASCII 7bit characters in both username and password, so
how this can be?.. I know Oracle has character conversion issues, but there are only latin letters...
Igor Kolomiyets wrote:
I'd debug PL/SQL function, JDBC does not seem to be a problem here unless there is some collision of the datatypes occurs during the call. Did you try to run this program with JDBC debuggin on?
Maxim пишет:
Igor Kolomiyets wrote:
What is a return type for check_password? And what would be returned if instead of getInt(1) you call getString(2)?
check_password returns integer, either 0 or 1. The function seem to be fine, except that value is get corrupted somehow, if I use JDBC. getString(1) returns "0" in that case as well. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: JShurmatz |
last post by:
If anyone can shed some light on this problem I would greatly
appreciate it.
I am unsuccessfully trying to use a database connnection retrieved
from a pool configured using Java System Web Server 6.1 with the SQL
Server 2000 JDBC Driver.
The background:
1. I have downloaded the SQL Server 2000 JDBC Driver and installed it
on the web server.
|
by: Nils Valentin |
last post by:
Hi MySQL Fans ;-),
Is it possible that the 3.08 series allows to connect to 4.0.14 versions but
not to the 4.1 alpha-versions ?
I get belows error when tryig to connect from DbVisualizer which was working
fine until a while ago. I haven't watched it recently, and haven't changed
anything I am aware off right now. After I realized the problem I tried many
3.08 versions with the same symptom. Watch were it says "Unknown system
variable...
|
by: Robert Mazur |
last post by:
MySQL 5.0 alpha (binary install) on
Solaris 9 -or- RedHat 8.0
mysql-connector-java-3.0.8-stable
-----------------------
Is there something different going on with JDBC and the alpha version
of MySQL 5.0? When trying to connect I am getting:
** BEGIN NESTED EXCEPTION **
|
by: Praveen |
last post by:
Hi,
I have installed WebSphere Portal on AIX and connected to DB2 on a
remote machine, Getting the followin errors when trying to get the
values from database thru applications installed on Portal.
Any Help Appreciated.
Thanks in advance.
Praveen Singh
|
by: David Thielen |
last post by:
Hi;
I am creating png files in my ASP .NET app. When I am running under Windows
2003/IIS 6, the file is not given the security permissions it should have. It
does not have any permission for several users that the directory it is in
has, including IUSR_JASMINE (my system is named jasmine).
Here is the weird part. In my aps .net code I have the following:
String jname = Request.PhysicalApplicationPath + "images\\java_" + fileNum +...
| |
by: bevis |
last post by:
I'm new to sql server and mysql but this seems like it should be a pretty straight forward jdbc connection. But I have spent almost 2 days just trying to get a jdbc connection. Please help if you can.
I'm using Eclipse 3.2.2 and I have installed mysql-connector-java-5.0.6-bin.jar. I am trying to connect to SQL Enterprise Manager version 8.0 innstall on a Windows 2003 Server Enterprise Edition.
I have been able to successfully test...
|
by: Anoop |
last post by:
Is it true that there are no type 4 jdbc drivers to connect to a DB2
server v7.1? The DB2 server is hosted on ACF2 (OS/390). We would be
connecting from windows and solaris boxes.
If it is true, what are my options? Will I have to install db2 connect
on every client machine that needs to connect to the DB2 servers? Is
the DB2 Connect freely available or will we have to purchase it? I
have also read on this group that we can install DB2...
|
by: JYA |
last post by:
Hi.
I was writing an xmltv parser using python when I faced some weirdness
that I couldn't explain.
What I'm doing, is read an xml file, create another dom object and copy
the element from one to the other.
At no time do I ever modify the original dom object, yet it gets modified.
|
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: 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: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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: 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...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |