Using oracle thin driver with to_char gives invalid column name

select x,y,z, to_char(event_time,'YYYY-MMM-DD') from eventtable;
if i execute the above query using oracle thin driver it gives me invalid column name. It works fine if i use weblogic driver. So what could be the problem ???
thanks.

Sorry , forgot to add that 'YYYY-MM-DD' or 'YYYY-Month-DD' or 'Year-MM-DD' or 'Year-Month-DD' are also allowed(please cheek also for other combinations), not 'YYYY-MMM-DD'.
Thanks

Similar Messages

  • Using Oracle thin driver with Weblogic 6.1

    hi all,
    i am trying to create a ConnectionPool using WLS6.1 and Oracle 8.0.5.
    Since i cannot use the weblogic driver (due to the old version of oracle that
    i have)
    i am trying to use instead the oracle thin driver.
    i configured my pool as follows:
    URL jdbc:oracle:[email protected]:1521:ORC1
    Driver oracle.jdbc.Driver.OracleDriver
    Propeties user=SCOTT
    when i try to assing the created pool to a server (using the 'Target' link),
    i always got this exception
    weblogic.management.DeploymentException: Error creating connection pool - with
    n
    ested exception:
    [weblogic.common.ResourceException: Cannot load driver class: oracle.jdbc.Driver
    .OracleDriver]
    at weblogic.jdbc.common.JDBCService.addDeployment(JDBCService.java:110)
    at weblogic.management.mbeans.custom.DeploymentTarget.addDeployment(Depl
    oymentTarget.java:329)
    at weblogic.management.mbeans.custom.DeploymentTarget.addDeployment(Depl
    oymentTarget.java:144)
    at java.lang.reflect.Method.invoke(Native Method)
    at weblogic.management.internal.DynamicMBeanImpl.invokeLocally(DynamicMB
    eanImpl.java:608)
    at weblogic.management.internal.DynamicMBeanImpl.invoke(DynamicMBeanImpl
    .java:592)
    at weblogic.management.internal.ConfigurationMBeanImpl.invoke(Configurat
    ionMBeanImpl.java:352)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
    55)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
    23)
    at weblogic.management.internal.ConfigurationMBeanImpl.updateConfigMBean
    s(ConfigurationMBeanImpl.java:484)
    at weblogic.management.internal.ConfigurationMBeanImpl.invoke(Configurat
    ionMBeanImpl.java:354)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
    55)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
    23)
    at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:449)
    at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:190)
    at $Proxy7.addDeployment(Unknown Source)
    at weblogic.management.internal.DynamicMBeanImpl.updateDeployments(Dynam
    icMBeanImpl.java:1448)
    at weblogic.management.internal.DynamicMBeanImpl.setAttribute(DynamicMBe
    anImpl.java:858)
    at weblogic.management.internal.DynamicMBeanImpl.setAttribute(DynamicMBe
    anImpl.java:810)
    at weblogic.management.internal.ConfigurationMBeanImpl.setAttribute(Conf
    igurationMBeanImpl.java:288)
    at com.sun.management.jmx.MBeanServerImpl.setAttribute(MBeanServerImpl.j
    ava:1356)
    at com.sun.management.jmx.MBeanServerImpl.setAttribute(MBeanServerImpl.j
    ava:1331)
    at weblogic.management.internal.MBeanProxy.setAttribute(MBeanProxy.java:
    303)
    at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:185)
    at $Proxy75.setTargets(Unknown Source)
    at java.lang.reflect.Method.invoke(Native Method)
    at weblogic.management.console.info.FilteredMBeanAttribute.doSet(Filtere
    dMBeanAttribute.java:89)
    at weblogic.management.console.actions.mbean.DoEditMBeanAction.perform(D
    oEditMBeanAction.java:116)
    at weblogic.management.console.actions.internal.ActionServlet.doAction(A
    ctionServlet.java:167)
    at weblogic.management.console.actions.internal.ActionServlet.doPost(Act
    ionServlet.java:85)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:265)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:200)
    at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
    rvletContext.java:2456)
    at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
    pl.java:2039)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    --------------- nested within: ------------------
    weblogic.management.DistributedOperationUpdateException: Error creating connecti
    on pool - with nested exception:
    [weblogic.management.DeploymentException: Error creating connection pool - with
    nested exception:
    [weblogic.common.ResourceException: Cannot load driver class: oracle.jdbc.Driver
    .OracleDriver]]
    at weblogic.management.internal.ConfigurationMBeanImpl.updateConfigMBean
    s(ConfigurationMBeanImpl.java:494)
    at weblogic.management.internal.ConfigurationMBeanImpl.invoke(Configurat
    ionMBeanImpl.java:354)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
    55)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
    23)
    at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:44>
    However, i set the CLASSPATH & PATH of my startWebLogic.cmd as follows:
    set PATH=c:\orant\bin;d:\bea\wlserver6.1\bin\oci817_8;.\bin;%PATH%
    set CLASSPATH=.;.\lib\weblogic_sp.jar;.\lib\weblogic.jar;.\samples\eval\cloudscape\lib\cloudscape.jar;.\config\examples\serverclasses;c:\orant\jdbc\lib\classes111.zip
    AND, i have written a small program that uses JDBC (without weblogic) to query
    a table
    on the Oracle (using the pool's URL in the properties for getting the Connection
    conn = DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:ORC1", "scott",
    "tiger");
    and that program works fine.
    Can anyone tell me what is wrong?? it seems that everything is in order (with
    respect to CLASSPATH, PATH etc..)
    hope someone can solve my problem
    thanx and regards
    marco

    your url should be
    jdbc:oracle:thin:@127.0.0.1:1521:ORC1
    notice the ':' before the '@'.
    sree
    "Marco" <[email protected]> wrote in message
    news:[email protected]...
    Hi Sree,
    You have to place the classes11.zip file in the beginning of the classpath.i did it. my CLASSPATH is now
    CLASSPATH=c:\orant\jdbc\lib\classes111.zip;.;.\lib\weblogic_sp.jar;.\lib\web
    logic.jar;.\samples\eval\cloudscape\lib\cloudscape.jar;.\config\examples\ser
    verclasses
    But now, when i assign the target, the exception is:
    --------------- nested within: ------------------
    weblogic.management.DistributedOperationUpdateException: Error creating
    connecti
    on pool - with nested exception:
    [weblogic.management.DeploymentException: Error creating connection pool -
    with
    nested exception:
    [weblogic.common.ResourceException: weblogic.common.ResourceException:
    Could not create pool connection. The DBMS driver exception was:
    java.sql.SQLException: Sub Protocol must be specified in connection URL
            at oracle.jdbc.dbaccess.DBError.check_error(DBError.java:352)
            at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:102)
            at
    weblogic.jdbc.common.internal.ConnectionEnvFactory.makeConnection(Con
    nectionEnvFactory.java:192)
            at
    weblogic.jdbc.common.internal.ConnectionEnvFactory.createResource(Con
    nectionEnvFactory.java:134)
            at
    weblogic.common.internal.ResourceAllocator.makeResources(ResourceAllo
    cator.java:698)
            at
    weblogic.common.internal.ResourceAllocator.<init>(ResourceAllocator.j
    ava:282)
            at
    weblogic.jdbc.common.internal.ConnectionPool.startup(ConnectionPool.j
    ava:629)
            at
    weblogic.jdbc.common.JDBCService.addDeployment(JDBCService.java:107)
            at
    weblogic.management.mbeans.custom.DeploymentTarget.addDeployment(Depl
    oymentTarget.java:329)
            at
    weblogic.management.mbeans.custom.DeploymentTarget.addDeployment(Depl
    oymentTarget.java:144)
            at java.lang.reflect.Method.invoke(Native Method)
            at
    weblogic.management.internal.DynamicMBeanImpl.invokeLocally(DynamicMB
    eanImpl.java:608)
            at
    weblogic.management.internal.DynamicMBeanImpl.invoke(DynamicMBeanImpl
    java:592)
            at
    weblogic.management.internal.ConfigurationMBeanImpl.invoke(Configurat
    ionMBeanImpl.java:352)
            at
    com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
    55)
            at
    com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
    23)
            at
    weblogic.management.internal.ConfigurationMBeanImpl.updateConfigMBean
    s(ConfigurationMBeanImpl.java:484)
            at
    weblogic.management.internal.ConfigurationMBeanImpl.invoke(Configurat
    ionMBeanImpl.java:354)
            at
    com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
    55)
            at
    com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
    23)
            at
    weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:449)
            at
    weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:190)
            at $Proxy8.addDeployment(Unknown Source)
            at weblogic.management.internal.DynamicMB>
    what is SubProtocol???
    my ConnectionPool is configured as follows:
    Name:     MyJDBC Connection Pool
    URL :     jdbc:oracle:[email protected]:1521:ORC1
    Driver:   oracle.jdbc.driver.OracleDriver
    Properties: user=SCOTT
    Password  : tiger
    can u help me???
    thanx in advance and regards
       marco
    >
    >
    at
    weblogic.jdbc.common.JDBCService.addDeployment(JDBCService.java:110)
    at
    weblogic.management.mbeans.custom.DeploymentTarget.addDeployment(Depl
    oymentTarget.java:329)
    at
    weblogic.management.mbeans.custom.DeploymentTarget.addDeployment(Depl
    oymentTarget.java:144)
    at java.lang.reflect.Method.invoke(Native Method)
    at
    weblogic.management.internal.DynamicMBeanImpl.invokeLocally(DynamicMB
    eanImpl.java:608)
    at
    weblogic.management.internal.DynamicMBeanImpl.invoke(DynamicMBeanImpl
    java:592)
    at
    weblogic.management.internal.ConfigurationMBeanImpl.invoke(Configurat
    ionMBeanImpl.java:352)
    at
    com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
    55)
    at
    com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
    23)
    at
    weblogic.management.internal.ConfigurationMBeanImpl.updateConfigMBean
    s(ConfigurationMBeanImpl.java:484)
    at
    weblogic.management.internal.ConfigurationMBeanImpl.invoke(Configurat
    ionMBeanImpl.java:354)
    at
    com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
    55)
    at
    com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
    23)
    at
    weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:449)
    at
    weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:190)
    at $Proxy7.addDeployment(Unknown Source)
    at
    weblogic.management.internal.DynamicMBeanImpl.updateDeployments(Dynam
    icMBeanImpl.java:1448)
    at
    weblogic.management.internal.DynamicMBeanImpl.setAttribute(DynamicMBe
    anImpl.java:858)
    at
    weblogic.management.internal.DynamicMBeanImpl.setAttribute(DynamicMBe
    anImpl.java:810)
    at
    weblogic.management.internal.ConfigurationMBeanImpl.setAttribute(Conf
    igurationMBeanImpl.java:288)
    at
    com.sun.management.jmx.MBeanServerImpl.setAttribute(MBeanServerImpl.j
    ava:1356)
    at
    com.sun.management.jmx.MBeanServerImpl.setAttribute(MBeanServerImpl.j
    ava:1331)
    at
    weblogic.management.internal.MBeanProxy.setAttribute(MBeanProxy.java:
    303)
    at
    weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:185)
    at $Proxy75.setTargets(Unknown Source)
    at java.lang.reflect.Method.invoke(Native Method)
    at
    weblogic.management.console.info.FilteredMBeanAttribute.doSet(Filtere
    dMBeanAttribute.java:89)
    at
    weblogic.management.console.actions.mbean.DoEditMBeanAction.perform(D
    oEditMBeanAction.java:116)
    at
    weblogic.management.console.actions.internal.ActionServlet.doAction(A
    ctionServlet.java:167)
    at
    weblogic.management.console.actions.internal.ActionServlet.doPost(Act
    ionServlet.java:85)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:265)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:200)
    at
    weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
    rvletContext.java:2456)
    at
    weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
    pl.java:2039)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    --------------- nested within: ------------------
    weblogic.management.DistributedOperationUpdateException: Error creating
    connecti
    on pool - with nested exception:
    [weblogic.management.DeploymentException: Error creating connection pool
    with
    nested exception:
    [weblogic.common.ResourceException: Cannot load driver class:
    oracle.jdbc.Driver
    OracleDriver]]
    at
    weblogic.management.internal.ConfigurationMBeanImpl.updateConfigMBean
    s(ConfigurationMBeanImpl.java:494)
    at
    weblogic.management.internal.ConfigurationMBeanImpl.invoke(Configurat
    ionMBeanImpl.java:354)
    at
    com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
    55)
    at
    com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
    23)
    at
    weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:44>
    However, i set the CLASSPATH & PATH of my startWebLogic.cmd as follows:
    set PATH=c:\orant\bin;d:\bea\wlserver6.1\bin\oci817_8;.\bin;%PATH%
    set
    CLASSPATH=.;.\lib\weblogic_sp.jar;.\lib\weblogic.jar;.\samples\eval\cloudsc
    a
    pe\lib\cloudscape.jar;.\config\examples\serverclasses;c:\orant\jdbc\lib\clas
    ses111.zip
    AND, i have written a small program that uses JDBC (without weblogic)
    to
    query
    a table
    on the Oracle (using the pool's URL in the properties for getting the
    Connection
    conn = DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:ORC1",
    "scott",
    "tiger");
    and that program works fine.
    Can anyone tell me what is wrong?? it seems that everything is in order
    (with
    respect to CLASSPATH, PATH etc..)
    hope someone can solve my problem
    thanx and regards
    marco

  • 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

  • Error in creating Connection Pool using Oracle Thin Driver

    Hi,
    I am trying to create a connection pool in WS 5.1 with sp #6 using Oracle Thin Driver (oracle.jdbc.driver.OracleDriver) on a Sun box. But I am able to create the pool using weblogic.jdbc.oci.Driver. I get an DBMS Driver exception when I use thin driver. I have LD library path and weblogic class path set correctly. WL shows the following exception :
    weblogic.common.ResourceException: weblogic.common.ResourceException:
    Could not create pool connection. The DBMS driver exception was:
    java.sql.SQLException: Io exception: The Network Adapter could not establish the
    connection
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java)
    at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java)
    at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java)
    Any help on this is greatly appreciated.
    Thanks,
    Ramu

    Hi Ramu,
    Please post your connection pool setting here. You might have missed some
    port/server info. The driver is unable to connect to the db server here.
    sree
    "Ramu" <[email protected]> wrote in message
    news:3d5bbc3a$[email protected]..
    >
    Yes. I am trying to create a connection pool in weblogic and I have theweblogic
    class path setup correctly. It points to classes111.zip andnls_charset11.zip.
    >
    -Ramu
    "Neo Gigs" <[email protected]> wrote:
    Did you setup the JDBC library classpath correctly?
    For me, e.g. Oracle 7.3.4, the classpath should be:
    export CLASSPATH = /oracle7.3.4/jdbc/lib/classes.zip:%CLASSPATH%
    Noted that the JDBC classpath must be the first classpath element in
    the export
    statement.
    Neo

  • Using oracle thin driver from Weblogic server 6.1

    Hi
    I need to know which driver is best for establishing JDBC Connection i.e.
    whether to use JDriver provided with Weblogic or to go using Oracle thin driver.
    Can some one tell the detailed procedure involved in configuring oracle thin driver
    in Weblogicserver 6.1.
    Thanks in advance,
    S Gopikrishna

    I would recommend using the thin driver where ever possible, their are
    certain problems with thin driver which are more in the area of XA support
    you can check weblogic documentation for pointers on this. Oracles latest
    thin driver is pretty stable as they have fixed a bunch of problems.
    heres how to use thin driver:
    create the connection pool using the following url
    jdbc:oracle:thin:@<mc-name or ip-address>:<port-no>:<oracle sid>
    and driver: oracle.jdbc.driver.OracleDriver
    You dont have to install the thin driver its bundled with the product.
    hth
    sree
    "S Gopikrishna" <[email protected]> wrote in message
    news:3c34a0e5$[email protected]..
    Hi
    I need to know which driver is best for establishing JDBC Connection
    i.e.
    whether to use JDriver provided with Weblogic or to go using Oracle thin
    driver.
    Can some one tell the detailed procedure involved in configuring oracle thin
    driver
    in Weblogicserver 6.1.
    Thanks in advance,
    S Gopikrishna

  • Jdbc connection using oracle thin driver( using jdk1.4 and oracle8 )

    hello ..
    while i was tring to connection using oracle thin driver and jdk1.4 am getting the below error message. i have set the class path for the driver also. am using oracle8 personal edition and jdk1.4.
    [java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
            at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
            at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
            at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:333)
            at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:404)
            at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.ja
    va:468)
            at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:314)
            at java.sql.DriverManager.getConnection(DriverManager.java:512)
            at java.sql.DriverManager.getConnection(DriverManager.java:171)
            at Connexa.main(Connexa.java:18)[/b]
    Press any key to continue...
    my program is....
    import java.sql.*;                                          
    import java.io.*;
    import java.util.*;
    import oracle.jdbc.driver.*;
    // needed for new BFILE class
    import oracle.sql.*;
       public class Connexa {
      public static void main (String args []) throws Exception {
            Statement stmt=null; 
      try{
        // Load the Oracle JDBC driver                            
        //DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    Class.forName("oracle.jdbc.driver.OracleDriver");
        // Connect to the database
        // You can put a database name after the @ sign in the connection URL.
    Connection conn =
    DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:orcl","scott","tiger");
        //Connection conn =
        //  DriverManager.getConnection ("jdbc:odbc:datasource", "system", "manager");
        stmt = conn.createStatement ();
    catch (SQLException e)
          e.printStackTrace();

    The code itself is fine; the problem is with one of:
    1) the connection URL
    2) intermediate networking
    3) the database itself
    1) your connection URL is "jdbc:oracle:thin:@127.0.0.1:1521:orcl"
    - is Oracle really running on the default port, 1521
    - is the installation SID really "orcl"
    2) lots of possibilities, but only a couple are likely
    - is TCP/IP configured and running on your host
    - is there a persoanl firewall rpduct running? perhaps it's blocking the connection
    3) Is Oracle running?
    Is the listener running?

  • Using oracle thin driver

    Hi,
    I have a problem in using oracle thin driver,ive downloaded oracle thin driver and classpath has been set for classes12.zip.Iam trying to connect to server:teams sid:teams .
    the following code compiles and throws error @ runtime
    ************************ code****************8
    import java.sql.*;
    public class ocdtest {
    public static void main(String arg[]){
    try {
    DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());
    Connection conn = DriverManager.getConnection ("jdbc:oracle:thin:@teams:1521:teams", "raghu", "startoracle");
    Statement stmt = conn.createStatement ();
    ResultSet rset = stmt.executeQuery ("select login_name from login");
    while (rset.next ()){
    System.out.println (rset.getString ("login_name"));
    }catch(Exception e){
    System.out.println(e);
    ********************* code *********************************
    ********************** Exception *************************
    Exception in thread "main" java.lang.UnsatisfiedLinkError: get_env_handle
    at oracle.jdbc.oci8.OCIEnv.get_env_handle(Native Method)
    at oracle.jdbc.oci8.OCIEnv.getEnvHandle(OCIEnv.java:70)
    at oracle.jdbc.oci8.OCIDBAccess.logon(OCIDBAccess.java:359)
    at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:252)
    at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.ja
    va:365)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:260)
    at java.sql.DriverManager.getConnection(DriverManager.java:512)
    at java.sql.DriverManager.getConnection(DriverManager.java:172)
    at ocdtest.main(ocdtest.java:11)
    *******************************Exception **********************
    can anyone help me how to solve this problem.
    thanks in advance
    karthik

    Hi,
    The following code works
    import java.sql.*;
    public class ocdtest {
    public static void main(String arg[]){
    try {
              Class.forName("oracle.jdbc.driver.OracleDriver");
              Connection con=DriverManager.getConnection("jdbc:oracle:thin:@teams:1521:teams", "raghu", "startoracle");
              Statement s=con.createStatement();
              System.out.println("connected");
              ResultSet rs=s.executeQuery("select login_name from login where login_name='tom'");
              System.out.println("resultset");
              while(rs.next()){
                   System.out.println(rs.getString("login_name"));
    }catch(Exception e){
              System.out.println(e);
    all u need to download is classes12.zip and the patch for this zip .
    thanks and regards
    Karthik

  • How to connect to personal oracle using oracle thin driver on windows98

    Hi,
    i would like to know is it possible to connect to personal oracle8 using oracle thin driver on windows98.iam getting some exceptions when iam running ,could any one help me
    1.exception in thread main java.sqlexception:IOexception:the
    networkadapter could not establish the connection
    2.at oracle.jdbc.dbaccess.DBError.throws sqlexception(DBError.java)
    3.atoracle.jdbc.dbaccess.DBError.throws sqlexception(DBError.java)
    4.atoracle.jdbc.driver.oracleconnection.<init>(oracleconnection.java)
    5.atoracle.jdbc.driver.oracledriver.getconnectioninstance(oracledrive
    r.jva)
    6.atoracle.jdbc.driver.OracleDriver.connect(OracleDriver.java)
    7.atjava.sql.DriverManager.getConnection(unknown source)
    8.atjava.sql.DriverManager.getConnection(unknown source)
    9.at JEmp.main(JEmp.java:16)
    null

    http://www.orafaq.com/wiki/JDBC#Thin_driver

  • Problem in getting Time info with webLogic using Oracle Thin Driver

    We have a servlet to store/retrieve date/time data from an Oracle 9i db using use the Oracle thin driver. Everyting is ok when run on JSDK2.1 servlet container or Tomcat. But when run under WebLogic 8.1, we have problem with time portion info, it is lost. After debuging, we found under WebLogic, the returned object type is a java.sql.Date which by definition has no time info, while in other servlet containers, it is a java.sql.Timestamp. Storing date/time data in a Date column is ok under WebLogic because we see the time portion data in the db table. We did not set anything about database/jdbc in WebLogic.
    It would be greatly appreciated if someone can explain what effect WebLogic has on a servlet that has its own jdbc connection or how WebLogic could change data type from a jdbc sql statement.

    That's a function of the JDBC driver, not the J2EE app server.
    Sounds like maybe you're using the WebLogic 8.1 driver when you deploy with WL instead of the Oracle driver. You certainly can deploy with the Oracle driver. Go into the WL config manager and set it up to use the ojdbc14.jar instead.
    %

  • Using Oracle Thin Driver w/WL 6.0

    I'm trying to create a JDBC Connection Pool in the WL 6.0 Console that uses
    the Oracle
    Thin Driver. The name is 'oraclePool'. I have the following properties
    defined for the
    Connection Pool.
    URL = 'jdbc:oracle:thin@localhost:7001:myserver'. I imagine this is wrong
    but don't know which section.
    Driver Class Name = 'oracle.jdbc.driver.OracleDriver'
    Properties =
    user=tiger
    password=scott
    dll=ocijdbc8
    server=oracle
    protocol=thin
    When I start the default weblogic server under mydomain connected to
    localhost:7001, I receive the
    following error message:
    <Oct 22, 2001 9:52:55 PM EDT> <Error> <JDBC Connection Pool> <Cannot startup
    connection pool "oraclePool" weblogi
    n.ResourceException:
    Could not create pool connection. The DBMS driver exception was:
    java.sql.SQLException: Io exception: SO Exception was generated
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:114)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:156)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
    at
    oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:210)
    at
    oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:251)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:224)
    at
    weblogic.jdbc.common.internal.ConnectionEnvFactory.makeConnection(Connection
    EnvFactory.java:155)
    at
    weblogic.jdbc.common.internal.ConnectionEnvFactory.createResource(Connection
    EnvFactory.java:114)
    at
    weblogic.common.internal.ResourceAllocator.makeResources(ResourceAllocator.j
    ava:649)
    at
    weblogic.common.internal.ResourceAllocator.<init>(ResourceAllocator.java:243
    at
    weblogic.jdbc.common.internal.ConnectionPool.startup(ConnectionPool.java:322
    etc. etc.
    I want to use this Connection Pool in a Data Source with the folllowing
    properties:
    Name = MyJDBCOracleData Source
    JNDI Name = oracleDataSource
    Pool Name = oraclePool.
    I'm assuming the 'Pool Name' mentioned above refers to the 'oraclePool'
    connection pool. I'm running everything locally on Win 2000. The path to the
    classes111.zip (the Oracle Thin Driver Classes) is
    in the system classpath and in the setEnv.cmd under Weblogic.
    Any help is GREATLY appreciated.

    Oracle thin driver is classes12.zip and not classes111.zip.
    Make sure you are adding while classpath including filename classes12.zip in
    classpath.
    Mitesh Patel
    Bill Blackmon wrote:
    I'm trying to create a JDBC Connection Pool in the WL 6.0 Console that uses
    the Oracle
    Thin Driver. The name is 'oraclePool'. I have the following properties
    defined for the
    Connection Pool.
    URL = 'jdbc:oracle:thin@localhost:7001:myserver'. I imagine this is wrong
    but don't know which section.
    Driver Class Name = 'oracle.jdbc.driver.OracleDriver'
    Properties =
    user=tiger
    password=scott
    dll=ocijdbc8
    server=oracle
    protocol=thin
    When I start the default weblogic server under mydomain connected to
    localhost:7001, I receive the
    following error message:
    <Oct 22, 2001 9:52:55 PM EDT> <Error> <JDBC Connection Pool> <Cannot startup
    connection pool "oraclePool" weblogi
    n.ResourceException:
    Could not create pool connection. The DBMS driver exception was:
    java.sql.SQLException: Io exception: SO Exception was generated
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:114)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:156)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
    at
    oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:210)
    at
    oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:251)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:224)
    at
    weblogic.jdbc.common.internal.ConnectionEnvFactory.makeConnection(Connection
    EnvFactory.java:155)
    at
    weblogic.jdbc.common.internal.ConnectionEnvFactory.createResource(Connection
    EnvFactory.java:114)
    at
    weblogic.common.internal.ResourceAllocator.makeResources(ResourceAllocator.j
    ava:649)
    at
    weblogic.common.internal.ResourceAllocator.<init>(ResourceAllocator.java:243
    at
    weblogic.jdbc.common.internal.ConnectionPool.startup(ConnectionPool.java:322
    etc. etc.
    I want to use this Connection Pool in a Data Source with the folllowing
    properties:
    Name = MyJDBCOracleData Source
    JNDI Name = oracleDataSource
    Pool Name = oraclePool.
    I'm assuming the 'Pool Name' mentioned above refers to the 'oraclePool'
    connection pool. I'm running everything locally on Win 2000. The path to the
    classes111.zip (the Oracle Thin Driver Classes) is
    in the system classpath and in the setEnv.cmd under Weblogic.
    Any help is GREATLY appreciated.

  • 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");

  • GUYS!! Is there any way to write BLOB's 4K using Oracle thin driver

    I've been trying for 3 days to do that but nothing worked ...
    Not
    setBinaryStream(x, new ByteArrayInputStream(anArrayWith10KBytes), anArrayWith10KBytes);
    nor setBytes(x, myArray), or setObject(x, myArray).
    Is there any way to store Blobs to Oracle 8.1.6 using the thin driver ????????????
    Please help ... cause I really need it !!!
    Best regards,
    Stefig

    Hi Stefig
    Following code help you to store the files >4k in BLOB column in Oracle database
    test is a table in which TEST is BLOB column
    String url = "jdbc:oracle:thin:@.....";
    String user = "user name";
    String password = "password";
    Connection conn = null;
    PreparedStatement aQuery = null;
    ResultSet rs = null;
    try
    Class.forName("oracle.jdbc.driver.OracleDriver");
    conn = DriverManager.getConnection(url,user,password);
    conn.setAutoCommit(false);
    Statement stmt = conn.createStatement();
    stmt.execute("insert into test values (EMPTY_BLOB())");
    rs = stmt.executeQuery("select TEST from test");
    rs.next();
    BLOB blob =((OracleResultSet)rs).getBLOB(1);
    File f = new File(filename);
    FileInputStream io = new FileInputStream(f);
    OutputStream os = blob.getBinaryOutputStream();
    int size = io.available();
    byte[] buffer = new byte[1024];
    int length=0;
    while((length=io.read(buffer)) != -1)
    os.write(buffer,0,length);
    io.close();
    os.close();
    stmt.execute("commit");
    catch()
    Good Luck
    From
    Sachin

  • Use of NOT IN leads to an invalid column name error

    The query works just fine when placed directly into sql plus
    The query works, called from a Java using an Oracle Statement, ONLY IF I remove the NOT.
    However, with NOT it chokes, and gives me this:
    selQ=select lenum, zeugn from stock_rpt where lenum NOT in ('X12345', 'X23456')
    Could Select or Read Selected data
    java.sql.SQLException: Invalid column name
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:208)
    at oracle.jdbc.driver.OracleStatement.getColumnIndex(OracleStatement.java:3319)
    at oracle.jdbc.driver.OracleResultSetImpl.findColumn(OracleResultSetImpl.java:1926)
    at oracle.jdbc.driver.OracleResultSet.getString(OracleResultSet.java:1515)
    at ecspack.StockRpt.selRecsByQ(StockRpt.java:172)
    at ecspack.StockRpt.selByDiff(StockRpt.java:261)
    at teste.main(teste.java:40)
    The column does have an index.
    The above is my simplified test query, I am using to narrow down the problem.
    SelQ is the value of the Select String.
    Really I want to do something like this:
    select x1, x2 from tableX where x1 NOT IN (select y1 from tableY)
    I know I can just compare records one at a time, but I would rather not, if there is a way to make NOT IN work.
    Thank you

    Hi Eileen Keeney ,
    may be you can use prepared statement but beware of sql injection
    selQ=select lenum, zeugn from stock_rpt where lenum NOT in ('X12345', 'X23456')
    Try :
    selQ=select lenum, zeugn from stock_rpt where lenum NOT in (?, ?)
    Then try running it with this fixed parameter binding:
    prest.setString(1, "X12345");
    prest.setString(2, "X23456");

  • Sysdate gives Invalid column name

    Using Oracle/Tomcat, I'm invoking the following query through JSP:
    SELECT id from my_table where create_date >= (sysdate-10)
    where create_date is a field in my_table.
    When I run it through JSP, it gives me Invalid column name error, but when I copy the outpout of the query string and run in in sqlplus, it works fine!!
    What could be the problem
    Najiks fine!!
    What could be the problem
    Naji

    Q: Can you SELECT sysdate FROM dual;
    If you can can you store it in a bind variable and use that in your query. Is there another JSP way of getting the date and storing it for use in your query?

  • 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....
    null

    try this:
    conn = DriverManager.getConnection("jdbc:oracle:thin:scott/tiger:@hostname:1521:sid");
    or use system/manager as username/passward
    null

Maybe you are looking for