How to use Oracle jdbc driver fixedString property?

Oracle pads values in char columns so if I insert "a" in a CHAR(2) column then I cannot get that record by comparing that column to "a", I should get it by comparing it to "a ". Right?
To solve this problem the Oracle jdbc driver has the property fixedString but I cannot make it work. (look for fixedString here )
I'm using ojdbc14.jar driver for Oracle 10gR2 and accessing an Oracle 10gR2 database.
This is my code:
try {
Properties props = new Properties();
props.put("user", "****");
props.put("password", "****");
props.put("fixedString", true);
Class.forName("oracle.jdbc.driver.OracleDriver");
String jdbcUrl = "jdbc:oracle:thin:@<host>:<port>:<sid>";
Connection connection = DriverManager.getConnection(jdbcUrl, props);
PreparedStatement ps = connection.prepareStatement(
"SELECT * FROM MY_TABLE WHERE MY_TABLE_ID = ?");
ps.setObject(1, "abc"); // (*)
// MY_TABLE_ID is CHAR(15)
ResultSet rs = ps.executeQuery();
while (rs.next())
System.out.print("data: ");
System.out.println(rs.getString("MY_TABLE_ID"));
rs.close();
ps.close();
connection.close();
} catch (SQLException ex) {
ex.printStackTrace();
} catch (ClassNotFoundException ex) {
ex.printStackTrace();
The above code executes fine (no exceptions thrown) but the ResultSet is empty after executeQuery().
If I change the line (*) for
ps.setObject(1, "abc ");
Then I get the column I wanted. So it seems the driver is ignoring the fixedString option.
I've also tried changing the line (*) for
ps.setObject(1, "abc", java.sql.Types.CHAR);
But the ResultSet I get is empty again. What am I missing?
Thanks in advance

Es un Bug se corrige en la versión del OAS 10.1.2.3
Bug 10222534: UNABLE TO SET FIXEDSTRING PROPERTY IN DATASOURCE

Similar Messages

  • How to use Oracle jdbc driver fixedString property in datasource.xml?

    I try configured fixedString property in the datasource.xml but doesnt work, this is in oc4j
    <data-source location="jdbc/prueba" class="com.evermind.sql.DriverManagerDataSource"
    password="xxxxx"
    max-connect-attempts="3"
    xa-location="jdbc/xa/prueba"
    ejb-location="jdbc/prueba"
    wait-timeout="1800"
    connection-driver="oracle.jdbc.driver.OracleDriver"
    username="xxxx" min-connections="35"
    max-connections="300"
    url="jdbc:oracle:thin:@144.1.0.54:1521:nodox"
    inactivity-timeout="300" name="jdbc/prueba">
    <property name="fixedString" value="true"/>
    </data-source>
    i Solved this problem in tomcat:
    <Resource name="jdbc/testsql" auth="Container"
    type="javax.sql.DataSource" driverClassName="oracle.jdbc.driver.OracleDriver"
    url="jdbc:oracle:thin:@144.1.0.54:1521:nodox"
    username="xxxxx" password="xxxxxxxx"
    maxActive="8" maxIdle="4" connectionProperties="fixedString=true;"/>

    Es un Bug se corrige en la versión del OAS 10.1.2.3
    Bug 10222534: UNABLE TO SET FIXEDSTRING PROPERTY IN DATASOURCE

  • How to use a jdbc driver in caf

    Hi, all.
         I tried to make a ws to access DB with CAF, but I had no idea how to use a jdbc driver(.jar).
        Can anyone do me a favor? Thx 
        PS: my server is ce7.1
    Edited by: Louis HUANG on Jul 27, 2009 1:09 PM

    hi
    If you want to interact with db tables in caf,try like this.
    it may work..
    Using EJB call database tables using jdbc driver.
    Expose EJB as webservice.
    and using External service option of caf utilise this webservice in caf,do the necessary mappings..
    you can search in sdn,how to call DB tables in EJB..
    Regards
    sowmya.

  • How to avoid oracle.jdbc.driver.OracleConnection using

    i'am new in Java but recently i've got a project on support.
    Problem:
    solution worked on jvm 1.4, now on 1.7.
    Respectively, class oracle.jdbc.driver.OracleConnection has been used.
    Now I need class oracle.jdbc.OracleConnection to use CLOB.createTemporary() but...I can't.
    According to the docs, it's enough to replace in code and config files one class declaration on another. But NO. I replaced all of them in all config files and anyway, there was only oracle.jdbc.driver.OracleConnection has been created. (there is no explicit declaration of connection type in code, everything is configured in config files)
    Project uses marven, mybatis-3.1.1. Database: oracle 9
    Driver: ojdbc14-9.2.0.5.jar contains both classes: both oracle.jdbc.driver.OracleConnection (for backward compatibility) and oracle.jdbc.OracleConnection.
    The matter is what should i do to use second one instead of first one.
    May be there is some java cache? I do not know...
    Anybody knows?

    Now I need class oracle.jdbc.OracleConnection to use CLOB.createTemporary() but...I can't.
    Why not? You have to explain, in detail, WHAT you are trying and WHY you say you "can't" do it.
    According to the docs, it's enough to replace in code and config files one class declaration on another.
    That is correct - this IS all that is required. Replace ALL references to 'oracle.jdbc.driver' in your code.
    But NO. I replaced all of them in all config files and anyway, there was only oracle.jdbc.driver.OracleConnection has been created. (there is no explicit declaration of connection type in code, everything is configured in config files)
    We can't SEE what 'config' information you say you changed. It is what is in the CODE that matters, not what is in a config file.
    If the 'oracle.jdbc.driver' package is being imported by your code and a reference to 'Connection' is made Java will use it from the first package that it finds the class in.
    You are using an ANCIENT jdbc jar file. That doc you linked to WARNS you that you should upgrade and that doc is over ten years old.
    Remove that old jdbc jar file and use the current driver. Also remove references to the old package and replace them with references to the new package.
    With code and jars that are that old you can expect to have problems trying to use additional features, especially extensions. I would be surprised if you didn't have other issues as well.
    You need to perform code review to find all of the references that need to be corrected.

  • How to use oracle thin driver?...pls help

    Hello. I am trying to insert a word file into my Oracle 9i database using JSP. I have tomcat running as my standalone server. So far, i have been using the sun.jdbc.odbc driver to implement all my DB accesses. Recently however, i found out that in order to use Oracle specific objects such as BLOBS or BFILES, i have to use the oracle thin driver or OCI driver.
    So far, i have downloaded the thin driver and put it into the tomcat shared/common folder and also put the .jar file into my classpath. Now, i am having trouble as to how to call the oracle thin driver inside my JSP code.
    My previous code read as:
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con = DriverManager.getConnection("jdbc:odbc:Andy","user","pass");
    How do i switch over to the oracle thin driver in JSP? Any help would be much appreciated. Thank you
    Andrew

    Class.forName ("oracle.jdbc.driver.OracleDriver");
    Connection conn = DriverManager.getConnection ("jdbc:oracle:thin:@hostname:port:SSID", "user", "password");

  • How to use oracle thin driver with jsp?...pls help

    Hello. I am trying to insert a word file into my Oracle 9i database using JSP. I have tomcat running as my standalone server. So far, i have been using the sun.jdbc.odbc driver to implement all my DB accesses. Recently however, i found out that in order to use Oracle specific objects such as BLOBS or BFILES, i have to use the oracle thin driver or OCI driver.
    So far, i have downloaded the thin driver and put it into the tomcat shared/common folder and also put the .jar file into my classpath. Now, i am having trouble as to how to call the oracle thin driver inside my JSP code.
    My previous code read as:
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con = DriverManager.getConnection("jdbc:odbc:Andy","user","pass");
    How do i switch over to the oracle thin driver in JSP? Any help would be much appreciated. Thank you
    Andrew

    my code is:
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    conn = DriverManager.getConnection(sConnStr, sUser, sPassword);
    notice the driver --"oracle.jdbc.driver.OracleDriver"!
    and copy the class12.zip to lib path
    if still not work
    change the class12.zip to class12.jar
    good luck

  • How to Include Oracle JDBC Driver

    Hi Experts,
    We have a requirement to access the database  through Java Code. We are using NWDS. But we are n't able to find a clue, how to add the driver to the project. This option was there in Eclipse, if I remember correctly.
    We are using NWDS for the first time. Could any one please give a clue, if we need to do the same in a different way.
    Regards,
    SS

    Hi Vijay,
    Thanks for the reply. But we need a stand alone program to run at the command prompt(of SAP server), and the sample code is as follows.
    package abc;
    import java.sql.Driver;
    import java.sql.DriverManager;
    import java.sql.Connection;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    * @author SahuS
    * To change the template for this generated type comment go to
    * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
    public class InsertData {
         public static void main(String[] args) throws SQLException {
              Statement mystat = null;
              Connection conn = null;
              try
                     // Step 1: Load the JDBC driver.
                     Class.forName("oracle.jdbc.driver.OracleDriver");
                     // Step 2: Establish the connection to the database.
                       conn = DriverManager.getConnection(
                                       "jdbc:oracle:thin:@SERVERNAME:1527:SXI",       // URL
                                        "SAPSXIDB",       // username
                                         "PASSWORD"        // password
                         mystat = conn.createStatement();
                        ResultSet rs = mystat.executeQuery("select * from sapsxidb.zemp_1;");
                        while (rs.next()) {
                        System.out.println(
                        rs.getInt(1) +      // first column
                        "\t" +              // the horizontal tab
                        rs.getString(2)     // second column
                        mystat.close();
                        conn.close();                           
                   catch (Exception e)
                     System.err.println("Got an exception! ");
                     System.err.println(e.getMessage());
                   finally{
    As, we could not get the option to import the Oracle JDBC Driver, we are getting exception
    Got an exception!
    oracle.jdbc.driver.OracleDriver
    So, any clue, how we can import the driver in NWDS and use it?
    Regards,
    SS

  • Not able to work with multiple Databases using  oracle.jdbc.driver.OracleDr

    Hi all,
    I am using the following Oracle Driver in Weblogic 6.1 sp 4
    oracle.jdbc.driver.OracleDriver / jdbc:oracle:thin:
    Driver. I am not able to select rows from two different table, which resides in two different Databases.
    The Exception is :
    SQL Exception Connection has already been created in this tx context for pool named CDPool. Illegal attempt to create connection
    nother pool: MultiTransactionTest
    Start server side stack trace:
    java.sql.SQLException: Connection has already been created in this tx context for pool named CDPool. Illegal attempt to create c
    on from another pool: MultiTransactionTest
    at weblogic.jdbc.jts.Driver.getExistingConnection(Driver.java:288)
    at weblogic.jdbc.jts.Driver.connect(Driver.java:123)
    at weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSource.java:214)
    at weblogic.jdbc.common.internal.RmiDataSource_WLSkel.invoke(Unknown Source)
    at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:305)
    at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java:93)
    at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:274)
    at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:22)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    End server side stack trace
    Can any one help me to fix this issue?
    -Thanks & Regards,
    Shamil.S

    Shamil S wrote:
    Hi all,
    I am using the following Oracle Driver in Weblogic 6.1 sp 4
    oracle.jdbc.driver.OracleDriver / jdbc:oracle:thin:
    Driver. I am not able to select rows from two different table, which resides in two different Databases.
    The Exception is :
    SQL Exception Connection has already been created in this tx context for pool named CDPool. Illegal attempt to create connection
    nother pool: MultiTransactionTestHi. You can't domultiple DBMSes in one transaction unless you use an XA driver and
    an XA transaction. Your workarounds are:
    1 - Use an XA driver, datasource, and tx
    2 - If you're just reading, you can use non-transactional datasources. Do make sure you
    always close your connections...
    Joe
    >
    Start server side stack trace:
    java.sql.SQLException: Connection has already been created in this tx context for pool named CDPool. Illegal attempt to create c
    on from another pool: MultiTransactionTest
    at weblogic.jdbc.jts.Driver.getExistingConnection(Driver.java:288)
    at weblogic.jdbc.jts.Driver.connect(Driver.java:123)
    at weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSource.java:214)
    at weblogic.jdbc.common.internal.RmiDataSource_WLSkel.invoke(Unknown Source)
    at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:305)
    at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java:93)
    at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:274)
    at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:22)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    End server side stack trace
    Can any one help me to fix this issue?
    -Thanks & Regards,
    Shamil.S

  • How to update oracle jdbc driver to 11.1.0.7.0 JDBC Drivers

    HI,
    I got a jdbc exception *" java.lang.ArrayIndexOutOfBoundsException "*.
    I have known that it is a Oracle JDBC bug and Oracle BUG number is BUG-6396242.
    The problem is too many rows per database transaction and it is fixed at version 11.1.0.7 Oracle JDBC Drivers.
    Here is the 11.1.0.7 Oracle JDBC Driver Readme.
    http://www.oracle.com/technetwork/database/enterprise-edition/111070-readme-083278.html
    and the download
    http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-111060-084321.html
    My question is :
    *1.How to update oracle jdbc drivers with those downloads ?*
    (ps. I have replaced ojdbc5_g.jar, ojdbc5.jar, ojdbc6_g.jar, ojdbc6_g.jar in $ORACLE/jdbc, but it did'nt work. )
    *2.My Oracle version is 11.1.0.6.0, will it be OK if only update the JDBC driver?*
    *3.Do I need to update the jdbc driver where my program runs on the client side ?*
    Thanks for answers~ :)

    Upgrade your database version to 11.1.0.7.
    Installation docs are included with all patches and upgrades.

  • Problem using Oracle JDBC Driver

    Hi,
    I try to configure the Oracle JDBC Driver the following way:
    I load the Oracle drivers ojdbc14_g.jar and nls_charset12.jar
    I configure the DataSource using the Driver Class oracle.jdbc.driver.OracleDriver, the database URL: jdbc:oracle:thin:@h50a430:1521:WLP1E1A0 and the User with Password.
    As soon as its activated I get the following error:
    java.rmi.RemoteException: Error occurred while starting application in whole cluster and wait.; nested exception is:
         com.sap.engine.services.deploy.exceptions.ServerDeploymentException: Complex error : server ID 4123350:Cannot start DataSource "Oracle".
         at com.sap.engine.services.deploy.server.DeployCommunicatorImpl.startApplicationAndWait(DeployCommunicatorImpl.java:678)
         at com.sap.engine.services.deploy.server.DeployCommunicatorImpl.startApplicationAndWait(DeployCommunicatorImpl.java:660)
         at com.sap.engine.services.dbpool.deploy.DataSourceManagerImpl.startApplication(DataSourceManagerImpl.java:535)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
    any hint?

    I can't create an Oracle datasource too.
    Uploaded ojdbc14.jar, used the same Oracle jdbc settings as in my jdbc explorer where everything works fine, set initial connections to 1, set SQL Engine to Native SQL,...
    -> won't start.
    I restarted the cluster too. The Datasource is still marked with a red cross in the admin tool.
    This is with the type 1.x setting, as XA seems to be still broken in WAS 6.40.

  • Oracle.jdbc.driver.OracleTypes is not visible

    We are migrating one application from Weblogic 8.1 SP6 to Weblogic 10.3.
    Earlier in Weblogic 8.1 SP6 we have been used oracle.jdbc.driver.OracleTypes class which is there in ojdbc14.jar.
    But when i am trying use same class in Weblogic 10.3 getting error as oracle.jdbc.driver.OracleTypes is not visible.
    When i checked the ojdbc6.jar(replacement for ojdbc14) oracle.jdbc.driver.OracleTypes class is there.
    can anybody let me how can i resolve this?

    Hi i m sorry as i m asking my problem here
    Can u plz help as i getting this error while publishing my application
    <Error> <HTTP> <BEA-101020> <[weblogic.servlet.internal.WebAppServletContext@38230 - appName: '_auto_generated_ear_', name: 'BillingClaim', context-path: '/BillingClaim', spec-version: '2.5'] Servlet failed with Exception
    java.lang.NullPointerException
         at jsp_servlet._pages._jsp._wholesale._secure._systems._billingclaim.__bchome._jspService(__bchome.java:269)
         at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
         Truncated. see log file for complete stacktrace
    Thanks...

  • Err : "Access Not Allowed to oracle.jdbc.driver.OraclePreparedStatement"

    Hi,
    How to resolve the error "Access Not Allowed to oracle.jdbc.driver.OraclePreparedStatement"
    in jdeveloper?
    Or
    Can you please give me some sample pgms which uses oracle.jdbc.driver.OraclePreparedStatement?
    Thanks in advance,
    Senthil Kumar M.

    This is the error from the trace logs...
    application [XMII] Cannot send an HTTP error response [500 Application error occurred during request processing. (details: com.sap.xmii.Illuminator.logging.LHException: com.sap.xmii.Illuminator.logging.LHException: java.lang.NoClassDefFoundError: oracle.jdbc.driver.OraclePreparedStatement)].
    The error is: com.sap.engine.services.servlets_jsp.server.exceptions.WebIOException: The stream is closed.
    Exception id: [0050569D6ACD006A0000010C000023D300046F4B653C90D7]
    I could not find anything on the SDN regarding this message, so I may need to open up an OSS note.
    Thanks
    Skip Ford

  • Oracle jdbc driver problems in netbeans 5.5

    need help again....i'm experience a problem. the problems are :
    i connect from netbeans 5.5 to oracle database express client 10g using jdbc driver ojdbc14.jar. the connection succeded (all the tables appears and i even can view the data). but when i trying to bind data to a drop down list component (with right click to the dropdown list component and then bind data), the dataprovider of that table appear in red color and there's no field appears in that. i'm so confused? i already add the ojdbc14.jar driver to the following path :
    1. i create a new class library in netbeans with consist of that driver,
    then added to my project (right click in my project then add library).
    2. then i added the ojdbc14.jar driver to my tomcats lib at "C:\Program
    Files\netbeans-5.5\enterprise3\apache-tomcat-5.5.17\common\lib".
    Is there any additional settings in using oracle jdbc driver? Does anyone knows? thanks a lot for the answers...
    Message was edited by:
    darma_sadha

    Hi!
    I'm using NetBeans 6.5 and I'm having some troubles to connect.
    The steps I've made:
    - Create the connection pool in Glassfish, nothing special, just standard parameters (Based on javax.sql.DataSource and including URL, Username and Password).
    - Create the JDBC resource associated with that connection pool,let's say jdbc/test.
    Now in NetBeans I register the driver:
    - New driver -> Find the ojdbc14.jar and from the options that I can choose it shows: oracle.jdbc.OracleDriver and oracle.jdbc.driver.OracleDriver.
    If i choose without +.driver+ I got the thin drivers (the ones i want) and if i chosse the one with the other one I got the OCI drivers. So I choose the first option oracle.jdbc.OracleDriver
    - Then I go to my project and click New -> Entity Classes from Database and from Datasource I select jdbc/test and it shows the following error message:
    Unable to find the driver oracle.jdbc.driver.OracleDriver. Please register this driver in the Databases.
    I can fix it if while registering the ojdbc14.jar I select the second option (*oracle.jdbc.driver.OracleDriver*) but with this option I need to specity the connection to use OCI instead of the desired thin driver.
    I hope you'll understand and help me somehow
    Edited by: KILE on Oct 10, 2008 2:26 AM

  • Oracle JDBC driver and CF MX 7 Standard edition

    hi, guys.
    is it possible to use Oracle JDBC driver with CF MX 7
    Standard edition?
    all our CF servers are Enterprise edition so we never ran
    into any
    problems connecting to Oracle servers.
    however, there will be a couple of new CF servers with
    relatively
    simple jobs running and we're trying to determine if we can
    use the
    Standard edition instead.
    I'd like to test this on my own, but CF MX 7 Standard edition
    is not
    available as a trial download.
    if there's someone who's done this already, I'd love to hear
    from
    you.
    can anyone shed a little light on this?
    thank you very much!
    J

    For the date/timestamp issue, you might check thread
    Oracle
    Date/Timestamp issue or
    CFMX
    and Oracle 10G JDBC no longer retrieves timestamp with date
    Phil

  • Escape characters using Oracle JDBC

    We use Oracle JDBC driver to do some operations on an Oracle 9i database, and ran into some problems with escape characters. Basically we'd like to escape the _ and % characters.
    The following two example statements both work:
    ResultSet rs = stmt.executeQuery("select * from identifier_protein where upper(IDENTIFIER_ACCNO) like 'NM\\_%' escape '\\' ");
    ResultSet rs = stmt.executeQuery("select * from identifier_protein where upper(IDENTIFIER_ACCNO) like 'NM\\_%' {escape '\\' }");
    However, when we have multiple query terms and the "escape" clause doesn't immediately follows EACH "like" clause, we got errors saying the sql statement does not end properly. One such example is the following:
    ResultSet rs = stmt.executeQuery("select * from identifier_protein where upper(IDENTIFIER_ACCNO) like 'NM\\_%' and creator = 'ABC' {escape '\\'} ");
    If we put an "escape" clause following each "like" clause, then it works.
    My question is, is there a smart way of letting JDBC knows that you want to use an escape character everywhere in the query? We often do very complicated dynamic queries, frequently with table joins and boolean logic and subqueries with tons of query terms. Trying to add the escape clause to each "like" clause is very painful. Any help is highly appreciated. Thanks!
    BL

    I'd use PreparedStatements, if you're not already. Let the JDBC driver escape things properly for you. That's what the setString() and setDate() methods are all about.

Maybe you are looking for