NLS setting with class4 JDBC thin driver
Hi,
we have a NLS setting for defining the charset which we need for compatibility setting in our system. The problem is that we have a default behaviour with that setting that works well using the SQLPlus command line tool. The JDBC driver seems to ignore the NLS settings.
Is there a way to tell the driver to read out the DB NLS settings?
Maybe is there a way to tell the driver by argument the NLS setting?
It would be best not to have code changes as we do compile the source against multiple databases wich would be a problem for Oracle!
Thanks!
Hi,
we have a NLS setting for defining the charset which we need for compatibility setting in our system. The problem is that we have a default behaviour with that setting that works well using the SQLPlus command line tool. The JDBC driver seems to ignore the NLS settings.
Is there a way to tell the driver to read out the DB NLS settings?
Maybe is there a way to tell the driver by argument the NLS setting?
It would be best not to have code changes as we do compile the source against multiple databases wich would be a problem for Oracle!
Thanks!
Similar Messages
-
Hanging problem with Oracle JDBC thin driver
Hi. We have an application running on top of WLS 6.1 accessing Oracle 8I with oracle's
JDBC thin driver. Under stress testing, it appears to hang sometimes. Thread dump
shows that many threads seem to be stuck at the same line of code in JDBC driver
(at oracle.sql.NUMBER._isPositive(NUMBER.java:2882)). Has anyone run into similar
issue? Any help is much appreciated.
"ExecuteThread: '1' for queue: 'default'" daemon prio=5 tid=0xe18960 nid=0xf wai
ting on monitor [0xb3680000..0xb36819d8]
at oracle.sql.NUMBER._isPositive(NUMBER.java:2882)
at oracle.sql.NUMBER._fromLnxFmt(NUMBER.java:2953)
at oracle.sql.NUMBER.toBigDecimal(NUMBER.java:557)
at oracle.sql.NUMBER.bigDecimalValue(NUMBER.java:1872)
at oracle.jdbc.dbaccess.DBConversion.NumberBytesToBigDecimal(DBConversion.ja
va:1771)
at oracle.jdbc.driver.OracleStatement.getBigDecimalValue(OracleStatement.jav
a:3357)
at oracle.jdbc.driver.OracleStatement.getObjectValue(OracleStatement.java:41
66)
at oracle.jdbc.driver.OracleStatement.getObjectValue(OracleStatement.java:41
23)
at oracle.jdbc.driver.OracleResultSetImpl.getObject(OracleResultSetImpl.java
:401)
at weblogic.jdbc.jts.ResultSet.getObject(ResultSet.java:268)
at weblogic.jdbc.rmi.internal.ResultSetImpl.getObject(ResultSetImpl.java:592
at weblogic.jdbc.rmi.internal.ResultSetStraightReader.getObject(ResultSetStr
aightReader.java:198)
at weblogic.jdbc.rmi.SerialResultSet.getObject(SerialResultSet.java:682)
"ExecuteThread: '6' for queue: 'default'" daemon prio=5 tid=0x6d93a8 nid=0x14
wa
iting on monitor [0xb3180000..0xb31819d8]
at oracle.sql.NUMBER._isPositive(NUMBER.java:2882)
at oracle.sql.NUMBER._fromLnxFmt(NUMBER.java:2953)
at oracle.sql.NUMBER.toBigDecimal(NUMBER.java:557)
at oracle.sql.NUMBER.bigDecimalValue(NUMBER.java:1872)
at oracle.jdbc.dbaccess.DBConversion.NumberBytesToBigDecimal(DBConversion.ja
va:1771)
at oracle.jdbc.driver.OracleStatement.getBigDecimalValue(OracleStatement.jav
a:3357)
at oracle.jdbc.driver.OracleStatement.getObjectValue(OracleStatement.java:41
66)
at oracle.jdbc.driver.OracleStatement.getObjectValue(OracleStatement.java:41
23)
at oracle.jdbc.driver.OracleResultSetImpl.getObject(OracleResultSetImpl.java
:401)
at weblogic.jdbc.jts.ResultSet.getObject(ResultSet.java:268)
at weblogic.jdbc.rmi.internal.ResultSetImpl.getObject(ResultSetImpl.java:592
at weblogic.jdbc.rmi.internal.ResultSetStraightReader.getObject(ResultSetStr
aightReader.java:198)
at weblogic.jdbc.rmi.SerialResultSet.getObject(SerialResultSet.java:682)Try get the latest thin driver from oracle and place it in the beginning of
the classpath in the server startup script to use it. This seems like a
oracle thin driver bug, the newer driver might help.
sree
"Andrew Dong" <[email protected]> wrote in message
news:[email protected]...
>
Hi. We have an application running on top of WLS 6.1 accessing Oracle 8Iwith oracle's
JDBC thin driver. Under stress testing, it appears to hang sometimes.Thread dump
shows that many threads seem to be stuck at the same line of code in JDBCdriver
(at oracle.sql.NUMBER._isPositive(NUMBER.java:2882)). Has anyone run intosimilar
issue? Any help is much appreciated.
"ExecuteThread: '1' for queue: 'default'" daemon prio=5 tid=0xe18960nid=0xf wai
ting on monitor [0xb3680000..0xb36819d8]
at oracle.sql.NUMBER._isPositive(NUMBER.java:2882)
at oracle.sql.NUMBER._fromLnxFmt(NUMBER.java:2953)
at oracle.sql.NUMBER.toBigDecimal(NUMBER.java:557)
at oracle.sql.NUMBER.bigDecimalValue(NUMBER.java:1872)
atoracle.jdbc.dbaccess.DBConversion.NumberBytesToBigDecimal(DBConversion.ja
va:1771)
atoracle.jdbc.driver.OracleStatement.getBigDecimalValue(OracleStatement.jav
a:3357)
atoracle.jdbc.driver.OracleStatement.getObjectValue(OracleStatement.java:41
66)
atoracle.jdbc.driver.OracleStatement.getObjectValue(OracleStatement.java:41
23)
atoracle.jdbc.driver.OracleResultSetImpl.getObject(OracleResultSetImpl.java
:401)
at weblogic.jdbc.jts.ResultSet.getObject(ResultSet.java:268)
atweblogic.jdbc.rmi.internal.ResultSetImpl.getObject(ResultSetImpl.java:592
atweblogic.jdbc.rmi.internal.ResultSetStraightReader.getObject(ResultSetStr
aightReader.java:198)
atweblogic.jdbc.rmi.SerialResultSet.getObject(SerialResultSet.java:682)
>
"ExecuteThread: '6' for queue: 'default'" daemon prio=5 tid=0x6d93a8nid=0x14
wa
iting on monitor [0xb3180000..0xb31819d8]
at oracle.sql.NUMBER._isPositive(NUMBER.java:2882)
at oracle.sql.NUMBER._fromLnxFmt(NUMBER.java:2953)
at oracle.sql.NUMBER.toBigDecimal(NUMBER.java:557)
at oracle.sql.NUMBER.bigDecimalValue(NUMBER.java:1872)
atoracle.jdbc.dbaccess.DBConversion.NumberBytesToBigDecimal(DBConversion.ja
va:1771)
atoracle.jdbc.driver.OracleStatement.getBigDecimalValue(OracleStatement.jav
a:3357)
atoracle.jdbc.driver.OracleStatement.getObjectValue(OracleStatement.java:41
66)
atoracle.jdbc.driver.OracleStatement.getObjectValue(OracleStatement.java:41
23)
atoracle.jdbc.driver.OracleResultSetImpl.getObject(OracleResultSetImpl.java
:401)
at weblogic.jdbc.jts.ResultSet.getObject(ResultSet.java:268)
atweblogic.jdbc.rmi.internal.ResultSetImpl.getObject(ResultSetImpl.java:592
atweblogic.jdbc.rmi.internal.ResultSetStraightReader.getObject(ResultSetStr
aightReader.java:198)
atweblogic.jdbc.rmi.SerialResultSet.getObject(SerialResultSet.java:682)
>
> -
Deploying .jar with Oracle JDBC thin driver
I was just experimenting with a Java application that uses an Oracle JDBC driver. It runs fine in JDeveloper. However, when I deploy it to a .jar and run it from a Windows XP Command Prompt I get:
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\xxx\deploy>java -jar testme.jar
Exception in thread "main" java.lang.NullPointerException
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
Is there anything special I need to do to the Deploy file? I tried including the the classes111 manifest to no avail.Hi,
Ensure that the JVM being used is the same or at least same spec level that you built your project. JDeveloper 9.0.3 uses VM's compatible with 1.3.1 by default. It is possible that your OS path has another VM that the cmd line defaults to. Use a java -version to check this.
Also ensure that you include Oracle JDBC as a project library and when you go to create a JAR file (either simple archiver or a Client Jar) that you include the Oracle JDBC libraries from the Dependency Analyzer. I assume this is probably the missing step since your are deploying to a Jar and not an app server where you would put the driver libraries in the app server classpath. -
Ssl with Oracle jdbc thin driver on weblogic 9.2
http://www.oracle.com/technology/products/weblogic/howto/jdbcssl/index.html
http://www.oracle.com/technology/tech/java/sqlj_jdbc/pdf/wp-oracle-jdbc_thin_ssl_2007.pdf
I had already created the ssl-jdbc connections for Weblogic 9.2 with Oracle 10.2.0.3.0 based on the documents above.
My questions
1. the connections are not using the desired ports. The TCP listener is using 1521, and TCPS listener is using 1522, and 2484. However the connections do not use the configured ports. Is it normal?
2. If using the unassigned port is the normal case, where can I limit the port range?
3. How to prove the connections are in SSL?1. the connections are not using the desired ports. The TCP listener is using 1521, and TCPS listener is using 1522, and 2484. However the connections do not use the configured ports. Is it normal? It is normal.
2. If using the unassigned port is the normal case, where can I limit the port range? I still have no idea.
3. How to prove the connections are in SSL? No idea, too. -
JDBC thin driver pads CHAR col to byte size when NLS_LENGTH_SEMANTICS=CHAR
We're using an Oracle 9.2 database with the database character set specified as AL32UTF8 with NLS_LENGTH_SEMANTICS set to CHAR. I've reproduced this problem with both the "classes12.zip" and "ojdbc14.jar" available with the Oracle 9.2 client installation.
The problem occurs with the JDBC thin driver. The problem does not occur with the JDBC OCI driver (nor SQL*Plus 9.2).
There are 2 relatively simply workarounds: use the OCI driver or convert CHAR columns to VARCHAR2 columns. I'm mostly curious as to whether there is some kind of setting for the thin driver to circumvent this problem, or if this is actually expected behavior. We're not that familiar with the NLS_LENGTH_SEMANTICS setting.
Consider a table as follows:
create table my_table (status CHAR(1));
If I describe the table it correctly shows the column using CHAR semantics.
STATUS CHAR(1 CHAR)
Given the AL32UTF8, this means that 4 bytes of storage are reserved for this column.
If I insert a single ASCII character in this table (for example "A") then read it back using the JDBC thin driver, I get the string "A " - the letter A followed by 3 spaces. In other words, the thin driver appears to have padded the value to its BYTE length. The OCI driver and SQL*Plus do not pad the value.
I understand that CHAR columns are normally blank padded when the data size is shorter than the defined column length, but I think that with NLS_LENGTH_SEMANTICS=CHAR, the padding should be based on the length of the column in chars, not in bytes.
Can anyone shed some light on this issue?
Thanks in advance,
TimUpdate:
I guess I should mention we're using Java 2 SDK 1.4.1_01 on Windows XP with an Oracle 9.2 database on Windows 2000. -
Jdbc thin driver bulk binding slow insertion performance problem
Hello All,
We have a third party application reporting slow insertion performance, while I traced the session and found out most of elapsed time for one insert execution is sql*net more data from client, it appears bulk binding is being used here because one execution has 200 rows inserted. I am wondering whether this has something to do with their jdbc thin driver(10.1.0.2 version) and our database version 9205. Do you have any similar experience on this, what other possible directions should I explore?
here is the trace report from 10046 event, I hide table name for privacy reason.
Besides, I tested bulk binding in PL/SQL to insert 200 rows in one execution, no problem at all. Network folks confirm that network should not be an issue as well, ping time from app server to db server is sub milisecond and they are in the same data center.
INSERT INTO ...
values
(:1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14, :15, :16, :17,
:18, :19, :20, :21, :22, :23, :24, :25, :26, :27, :28, :29, :30, :31, :32,
:33, :34, :35, :36, :37, :38, :39, :40, :41, :42, :43, :44, :45)
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.02 14.29 1 94 2565 200
Fetch 0 0.00 0.00 0 0 0 0
total 2 0.02 14.29 1 94 2565 200
Misses in library cache during parse: 1
Optimizer goal: CHOOSE
Parsing user id: 25
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net more data from client 28 6.38 14.19
db file sequential read 1 0.02 0.02
SQL*Net message to client 1 0.00 0.00
SQL*Net message from client 1 0.00 0.00
********************************************************************************I have exactly the same problem, I tried to find out what is going on, changed several JDBC Drivers on AIX, but no hope, I also have ran the process on my laptop which produced a better and faster performance.
Therefore I made a special solution ( not practical) by creating flat files and defining the data as an external table, the oracle will read the data in those files as they were data inside a table, this gave me very fast insertion into the database, but still I am looking for an answer for your question here. Using Oracle on AIX machine is a normal business process followed by a lot of companies and there must be a solution for this. -
Jdbc thin driver and bulk binding slow insertion performance
Hello All,
We have a third party application reporting slow insertion performance, while I traced the session and found out most of elapsed time for one insert execution is sql*net more data from client, it appears bulk binding is being used here because one execution has 200 rows inserted. I am wondering whether this has something to do with their jdbc thin driver(10.1.0.2 version) and our database version 9205. Do you have any similar experience on this, what other possible directions should I explore?
here is the trace report from 10046 event, I hide table name for privacy reason.
Besides, I tested bulk binding in PL/SQL to insert 200 rows in one execution, no problem at all. Network folks confirm that network should not be an issue as well, ping time from app server to db server is sub milisecond and they are in the same data center.
INSERT INTO ...
values
(:1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14, :15, :16, :17,
:18, :19, :20, :21, :22, :23, :24, :25, :26, :27, :28, :29, :30, :31, :32,
:33, :34, :35, :36, :37, :38, :39, :40, :41, :42, :43, :44, :45)
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.02 14.29 1 94 2565 200
Fetch 0 0.00 0.00 0 0 0 0
total 2 0.02 14.29 1 94 2565 200
Misses in library cache during parse: 1
Optimizer goal: CHOOSE
Parsing user id: 25
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net more data from client 28 6.38 14.19
db file sequential read 1 0.02 0.02
SQL*Net message to client 1 0.00 0.00
SQL*Net message from client 1 0.00 0.00
********************************************************************************I have exactly the same problem, I tried to find out what is going on, changed several JDBC Drivers on AIX, but no hope, I also have ran the process on my laptop which produced a better and faster performance.
Therefore I made a special solution ( not practical) by creating flat files and defining the data as an external table, the oracle will read the data in those files as they were data inside a table, this gave me very fast insertion into the database, but still I am looking for an answer for your question here. Using Oracle on AIX machine is a normal business process followed by a lot of companies and there must be a solution for this. -
How can I see KSC5602 character set using JDBC thin driver
After I change character set from USASCII7 to KO16KSC5601, I
cannot see korean from the clients
using JDBC thin driver.
But, I can see korean clearly using sqlplus at serer, or
application using SQLNet.
I use Oracle Enterprise Server 8.0.4.1.0, jdbc thin driver
8.0.4.0.6 on Windows 98. I read that all bugs realated
to multibyte language are fixed in Oracle8. What can I do to
solve this problem?
PS.server: Oracle 8.0.4.1 on Digital Unix 4.0b, client: jdk1.1.8
on Windows98. I used the command.
nullThe easiest thing to do is download it as an archive with your applet.
Otherwise, you have to have the files on every client machine.
For netscape, put the classes111.jar in the java classes folder typically:
c:\ProgramFiles\Netscape\Communicator\Program\java\classes.
I'd expect that IE would be setup in a similar way. -
Problems with jdbc thin driver (Euro Symbol)
Hello,
at the moment it is impossible for me to write or read euro characters to a database using a jdbc thin driver.
I am using
ojdbc14.jar (version 10.2.0.3.0) and orai18n.jar (also) together with JDK 1.4.2.
Charset of the database is WE8MSWIN1252. It does not work on ORACLE 9.2.0.1, 9.2.0.6 and 10.2.0.2.0 (others I have not tried). But the problem seams to be in thin client.
Inserting Eurosymbols using a PreparedStatement works quite well. Using a normal Statement does not work.
Also the values getting from a ResultSet are incorrect.
After several test I downloaded a patch 4659157 for ojdbc14.jar and 5470375 for orai18n.jar. After installing the patch the euro characters were returned, but:
In several selects of numeric fields (not all, seams to be random) my resultset returned the Euro character instead of 0 and so on.
Driver for 9.2 works quite well, but does not support 10g Release 2 (and contains also some funny bugs)
Following solutions are not suitable for us:
Changing the character set of the database (come on, this cannot be serious. I cannot change the character set of more than 100 databases)
Using the newest driver (ORACLE 11). We are still using JAVA 1.4.2 and cannot migrate our application at the moment.
Using an oci client. Not possible, no ORACLE client on clients...
Has anyone an idea how to deal with this?
Does anyone know when ORACLE is going to release a new jdbc driver for JAVA 1.4.2 (maybe 10.2.0.4.) ??
Regards,
ChristianJust installed PATCH 4659157 and 5470375 from metalink. The Euro problem seams to be corrected.
BUT:
Another problem occurred. Sometimes numeric values are returned wrong (0 from a numeric field comes as euro, 1 comes as Á (2 and 3 too).
This error seams to be random to me.
Our application is selecting a rowid from a table and after that fills several textfields in a frame by selecting the content in a way like this:
select [column1] from [table] where rowid=[rowid]
select [column2] from [table] where rowid=[rowid]
if I select the numeric column with select nr. 77 I get a wrong value. If I select it at nr. 10 I get the correct value.
The selects are done by a normal Statement object creating a ResultSet. The Value from the ResultSet is fetched by getObject() method.
I also tried to write a test program executing only the selects of the application, but it gives me correct results.
Also when selecting all the fields in one select I get a correct result.
Using a different charset than WE8MSWIN1252 seams to give correct results. Using the OCI driver returns correct results.
Using ojdbc14.jar and orai18n.jar Release 10.2.0.3. unpatched produces the same error (and does not return Euro symbols)
Using ojdbc14.jar and orai18n.jar Release 10.2.0.2. returns correct results (but wrong Euro)
Has anyone had the same problem yet?
Regards,
Christian -
SSL connection with JDBC thin driver
I am attempting to connect to an instance of Oracle 10.2 using the JDBC thin driver with SSL. I want to use the encryption feature of SSL only, but I can not perform the getConnection on the DataSource without running into an exception. According the JDBC docs, the SSL encryption feature is new for the 10.2 release of the JDBC thin driver, but I have seen no working examples. See http://download.oracle.com/docs/cd/B19306_01/java.102/b14355/overvw.htm#CHDIHFBD
I am using ojdbc14.jar on Java 5.0 using a standalone application, and it fails with an IOException (The network adapter could not establish the connection) (Error code 17002). I even enabled tracing using the ojdbc-g.jar to try to figure out what the REAL problem is, but it was not helpful at determining a root cause. I changed the driver type from "thin" to "oci" (and installed Oracle Instant client for my test machine) and the connection works just fine using the same tnsnames file, the same wallet, and the same cipher suite. From the Java perspective the only thing that changed was four characters -> "thin" became "oci". I am still using password based authentication as I understand that the authentication part of SSL is not supported in the thin driver on 10.2
Can anyone verify that the SSL encryption works with JDBC thin as advertised? (not the Oracle Net encryption, but rather the one described in Chapter 11 of the JDBC Developer's Guide. See http://download.oracle.com/docs/cd/B19306_01/java.102/b14355/sslthin.htm#CHDFEICG
I really would prefer to avoid using the OCI driver because of its dependencies on the native platform. Is there something special with how the users are created or how the JDBC API should be used? I am setting what I think to be appropriate parameters (oracle.net.wallet_location, oracle.net.cipher_suites) all to no avail. Does anyone have a working example they can provide?1) I would suggest posting this question over in the JDBC forum. The folks over there are far more likely to be able to help you.
2) When you do post this question over there, I would strongly suggest posting some sample code/ configuration scripts so that folks can reproduce your problem on their local machines. That tends to make it far easier to debug the problem and/or to notice if you've missed a step.
Justin -
Jdbc thin driver - nls parameters
Hi,
Does anyone have the experience on how the Oracle JDBC Thin Driver decide its NLS session related parameters? It looks to us that it will have its own settings which override the instance-level settings? If we want to set some specific settings (for example, NLS_DATE_FORMAT), is there any way besides setting them up via "alter session"?
Best Regards
A.C.Did you try the ALTER SESSION command ? For example , you just need to execute 2 SQL statements at the beginning of each SQL sessions to establish the correct locale environment ..
ALTER SESSION SET NLS_LANGUAGE = french;
ALTER SESSION SET NLS_TERRITORY = france; -
Hi Everyone,
Please let me know whether the JDBC thin driver 10.1.0.3 Driver compatible with the oracle server 10G version 10.2.0.2.0? We are facing some issues with the compatibility.
The Errors we are getting is : StaleConnectionException while we are using the driver from the Websphere.
Please let us know..Very Urgent.
Thanks in Advance,
Samuel.
Message was edited by:
user637857Hi Legatti,
Thanks for taking time out and replying me.
We dont know the reason why that error is being caused. Because the error is caused on the production we are not able to make any trail and errors. If we are sure that the driver compatibility is causing the error then we can go ahead and download the latest driver. If the latest driver will solve the problem we have to convince the client that the error is caused due to the incompatible driver. So if you have any documents/information supporting that please help.
Thanks
Samuel. -
Web Logic 6.1 JDBC Pooling with the Oracle Thin Driver
Hi,
We're slowly getting through a WebLogic 4.5.1 to 6.1 conversion for a small application
at my company. Initially, we had trouble getting the Oracle thin driver working.
We've finally cracked this nut. Now we're trying to get pooling working, and
cannot find an example of doing this with the Oracle thin driver.
Would anyone be able to provide:
1. the portion of the config.xml that pertains to building a connection pool using
the Oracle thin driver
2. the two lines of code for loading the driver and getting a connection from
this pool
i.e.
Driver d = (Driver)Class.forName("weblogic.jdbc.pool.Driver").newInstance();
Connection c = d.connect("jdbc:weblogic:pool:myPool", null);
Thanks very much!
Jeff Ryan
The Hartford"Jeff Ryan" <[email protected]> wrote:
>
1. the portion of the config.xml that pertains to building a connection
pool using
the Oracle thin driver
You don't usually edit the config.xml unless it is absolutely necessar. Instead,
you can config the pool in the GUI admin console, quite easily. After you successfully
configed the pool in the console, it is written into the config.xml file for you.
Only thing special when config the pool is the name of the driver and the url.
url: jdbc:oracle:thin@dbhost:dbport:dbinstance
driver: oracle.jdbc.driver.OracleDriver
If you prefer, you can also config the pool from the command line. It is detailed
in the "Weblogic Server Command-line Interface Reference".
2. the two lines of code for loading the driver and getting a connection
from
this pool
i.e.
Driver d = (Driver)Class.forName("weblogic.jdbc.pool.Driver").newInstance();
Connection c = d.connect("jdbc:weblogic:pool:myPool", null);
Again, you don't use the connection directly. Instead, you use "Data Source".
Data source in weblogic is just a connection object factory associated with a
JNDI name. You can therefore lookup the data source with the JNDI name and from
the data source object, you get the connectin object. No need to explicitly load
the driver class.
There are plenty of example codes available in the weblogic examples installed
with 6.1, that uses the data source.
Charles -
Problem using JDBC Thin driver with Oracle 8i Personal Edition
Hi all, I have an issue I have been unable to figure out. In order to make my code as portable as possible I am using the JDBC thin driver to access my database. I have been able to connect to an instance of Oracle 8i on a Sun box by hardcoding the following string into getConnection() call:
conn = DriverManager.getConnection("jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(COMMUNITY=tcp.world)(PROTOCOL=TCP)(Host=<myhostname>)(Port=1521))(ADDRESS=(COMMUNITY=tcp.w orld)(PROTOCOL=TCP)(Host = <myhostname>)(Port = 1526)))(CONNECT_DATA = (SID = <mysidname>)))", <myuser>, <mypassword>);
My problem is that I cannot figure out what string to use to connect to my local instance of Oracle 8i Personal. I used the following string (the sid I got from the looking at the init.ora file):
conn = DriverManager.getConnection("jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(COMMUNITY=tcp.world)(PROTOCOL=TCP)(Host=localhost)(Port=1521))(ADDRESS=(COMMUNITY=tcp.world)(PRO TOCOL=TCP)(Host = localhost)(Port = 1526)))(CONNECT_DATA = (SID = orcl)))", "scott", "tiger");
That didn't work, so I took the only entry found in my tnsnames.ora file in as:
conn = DriverManager.getConnection("jdbc:oracle:thin:@(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0)))(CONNECT_DATA = (SID = PLSExtProc)(PRESENTATION = RO)))", "scott", "tiger");
I am not knowing what is wrong, but that didn't work neither. Any suggestions would be highly appreciated.
Thanks....
nulltry this:
conn = DriverManager.getConnection("jdbc:oracle:thin:scott/tiger:@hostname:1521:sid");
or use system/manager as username/passward
null -
Bug in Oracle JDBC thin driver (parameter order)
[ I'd preferably send this to some Oracle support email but I
can't find any on both www.oracle.com and www.technet.com. ]
The following program illustrates bug I found in JDBC Oracle thin
driver.
* Synopsis:
The parameters of prepared statement (I tested SELECT's and
UPDATE's) are bound in the reverse order.
If one do:
PreparedStatement p = connection.prepareStatement(
"SELECT field FROM table WHERE first = ? and second = ?");
and then bind parameter 1 to "a" and parameter to "b":
p.setString(1, "a");
p.setString(2, "b");
then executing p yields the same results as executing
SELECT field FROM table WHERE first = "b" and second = "a"
although it should be equivalent to
SELECT field FROM table WHERE first = "a" and second = "b"
The bug is present only in "thin" Oracle JDBC driver. Changing
driver to "oci8" solves the problem.
* Version and platform info:
I detected the bug using Oracle 8.0.5 server for Linux.
According to $ORACLE_HOME/jdbc/README.doc that is
Oracle JDBC Drivers release 8.0.5.0.0 (Production Release)
* The program below:
The program below illustrates the bug by creating dummy two
column table, inserting the row into it and then selecting
the contents using prepared statement. Those operations
are performed on both good (oci8) and bad (thin) connections,
the results can be compared.
You may need to change SID, listener port and account data
in getConnecton calls.
Sample program output:
$ javac ShowBug.java; java ShowBug
Output for both connections should be the same
--------------- thin Driver ---------------
[ Non parametrized query: ]
aaa
[ The same - parametrized (should give one row): ]
[ The same - with buggy reversed order (should give no answers):
aaa
--------------- oci8 driver ---------------
[ Non parametrized query: ]
aaa
[ The same - parametrized (should give one row): ]
aaa
[ The same - with buggy reversed order (should give no answers):
--------------- The end ---------------
* The program itself
import java.sql.*;
class ShowBug
public static void main (String args [])
throws SQLException
// Load the Oracle JDBC driver
DriverManager.registerDriver(new
oracle.jdbc.driver.OracleDriver());
System.out.println("Output for both connections should be the
same");
Connection buggyConnection
= DriverManager.getConnection
("jdbc:oracle:thin:@localhost:1521:ORACLE",
"scott", "tiger");
process("thin Driver", buggyConnection);
Connection goodConnection
= DriverManager.getConnection ("jdbc:oracle:oci8:",
"scott", "tiger");
process("oci8 driver", goodConnection);
System.out.println("--------------- The end ---------------");
public static void process(String title, Connection conn)
throws SQLException
System.out.println("--------------- " + title + "
Statement stmt = conn.createStatement ();
stmt.execute(
"CREATE TABLE bug (id VARCHAR(10), val VARCHAR(10))");
stmt.executeUpdate(
"INSERT INTO bug VALUES('aaa', 'bbb')");
System.out.println("[ Non parametrized query: ]");
ResultSet rset = stmt.executeQuery(
"select id from bug where id = 'aaa' and val = 'bbb'");
while (rset.next ())
System.out.println (rset.getString (1));
System.out.println("[ The same - parametrized (should give one
row): ]");
PreparedStatement prep = conn.prepareStatement(
"select id from bug where id = ? and val = ?");
prep.setString(1, "aaa");
prep.setString(2, "bbb");
rset = prep.executeQuery();
while (rset.next ())
System.out.println (rset.getString (1));
System.out.println("[ The same - with buggy reversed order
(should give no answers): ]");
prep = conn.prepareStatement(
"select id from bug where id = ? and val = ?");
prep.setString(1, "bbb");
prep.setString(2, "aaa");
rset = prep.executeQuery();
while (rset.next ())
System.out.println (rset.getString (1));
stmt.execute("DROP TABLE bug");
nullHorea
In the ejb-jar.xml, in the method a cursor is closed, set <trans-attribute>
to "Never".
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name></ejb-name>
<method-name></method-name>
</method>
<trans-attribute>Never</trans-attribute>
</container-transaction>
</assembly-descriptor>
Deepak
Horea Raducan wrote:
Is there a known bug in Oracle JDBC thin driver version 8.1.6 that would
prevent it from closing the open cursors ?
Thank you,
Horea
Maybe you are looking for
-
Hello, I am using Blackberry Curve 9300. I purchased this phone for Rs. 17,250 before some 3 years, I considered RIM to be a Company providing premium services which is unique in itself and which worth spending on them and the most important thing is
-
How to use secondary method in workflow?
Hi friends, can anyone plz let me know how to use secondary methods in workflow? it would be helpful if u explain with an example.. thanks and regards, Arun.S
-
One of my apps has disappeared from my screen! I tried double tapping home button and the app showed up in the icon bar. I tapped and held the app and the red edit box appeared in left corner of app. I then hit the red button and the app went away. I
-
Import screen cannot enlarge preview thumbnail from Canon G15 raw CR2 file
Lightroom 4.3 import screen does not seem to be able to enlarge for better viewing the preview thumbnail from a Canon G15 raw CR2 file?
-
SAP.Web.Security.TicketException: MYSAP_INVALID
We recently updated our portal to the following: J2EE Engine 6.40 PatchLevel 108290.313 Portal 6.0.20.0.0 Previously sap.web.security dll worked fine but now I get this exception SAP.Web.Security.TicketException: MYSAP_INVALID I have tried all the su