JDBC TNS PROBLEM

Hi all,
Thanks for the warning this is my problem:
exception
org.apache.jasper.JasperException: Exception in JSP: /DAO.jsp:16
13:
14: Class.forName("oracle.jdbc.driver.OracleDriver");
15:
16: conn = DriverManager.getConnection("jdbc:oracle:thin://PC280631275888:1521:XE","vincenzom86","xxx");
17:
18: Statement st = conn.createStatement();
19:
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:451)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
root cause
javax.servlet.ServletException: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
The Connection descriptor used by the client was:
localhost:1521:orcl
i've change also all the sid name in the listner.ora and tnsnames.ora with XE that is the SID of my DB.
Vincenzo

If XE is a SID specify the following url
jdbc:oracle:thin:@PC280631275888:1521:XE
If XE is a service specify the following url
jdbc:oracle:thin:@//PC280631275888:1521/XE

Similar Messages

  • MSSQLServer jdbc connect problem on ODI 11G R2

    I have a MS SQL Server jdbc connect problem on ODI 11G R2 / Windows server 2008 64 bits.
    Tried, one by one, all versions of Microsoft drivers.
    Sqljdbc4.jar copied to : %appdata%\odi\oracledi\userlib\
    The Topology connect syntax is :
    driver: com.microsoft.sqlserver.jdbc.SQLServerDriver
    URL : jdbc:sqlserver://<host>:1433
    => All the topology tests end with time-outs.
    Installed 10G ODI.
    Works with 1.4 java and sqljdbc.jar version 2 jdbc driver.
    Times out with version 3 and/or Sqljdbc4.jar + JAVA_HOME & ODI_JAVA_HOME set to 1.6 path.
    also tried, with no success (time-outs) on either 10g or 11g :
    com.inet.tds.TdsDriver
    jdbc:inetdae7://<host>:1433?database=<DB>
    same results for :
    net.sourceforge.jtds.jdbc.Driver
    jdbc:jtds:sqlserver://<host>:1433
    Any suggestions for a fix?
    Many thanks in advance.

    Hello,
    ODI (11g) Studio is certified on Windows 32 bit only, not on 64bit.
    However you may still install it and configure ODI Studio to run with a 32 bit java.
    Details pls see Master Note For ODI 11g Install Issues And Questions (Doc ID 1214428.1).
    To connect to SQL Server:
    # Check and make sure the authentication mode of your Microsoft SQL Server Server is set to "SQL Server and Windows" or "Mixed", otherwise Oracle Data Integrator (ODI) is unable to connect to the database.
    # Before you create the Oracle Data Integrator (ODI) Dataserver in Topology Manager > Physical Architecture, stop all ODI processes, and place the JDBC Driver file in the ODI's userlib and "/drivers" folder.
    For ODI Studio (Local No Agent)
    %APPDATA%\odi\oracledi\userlib
    %APPDATA% is the Windows Application Data directory for the user (usually C:\Documents and Settings\<user>\Application Data).
    Standalone Agent
    ODI_HOME\oracledi\agent\drivers
    Note: If you decide to use the DataDirect driver that comes with ODI 11g install/ embedded in ODI 11g
    weblogic.jdbc.sqlserver.SQLServerDriver
    Then you don't need to worry about this step.
    # Make sure that the database is the default database of the user account employed by ODI for connection, and that the password is correct.
    # Verify (in your Microsoft SQL Server Server network configuration) that TCP/IP has been enabled on port 1433.
    For more details see How To Set Up JDBC Driver Connections For The Microsoft SQL Server For ODI (Doc ID 423914.1)
    If you try sqljdbc.jar, you need to configure ODI_JAVA_HOME to jdk1.5
    sqljdbc4.jar, jdk1.6 (since ODI 11g requires jdk1.6, I'd suggest sqljdbc4.jar)
    More see Compatibility Matrix For Java Machines And JDBC Drivers Used With ODI (Doc ID 807235.1)
    Hope that helps other people who run into this,
    Edited by: user742480 on Apr 4, 2011 12:06 PM

  • JDBC Connection problem in Oracle 11g

    Hello Everyone,
    Recently we have upgraded our Oracle server from 9.2 to 11g. Since then our Java program scheduled in a shell script (on the Sun Unix server) is not working
    and is giving below error
    "java.sql.SQLException: ORA-12154: TNS:could not resolve the connect identifier specified"
    What is strange is that our Web application which is on the same server (application server is iPlanets) is able to connect successfully. Also I ran the same program on
    my local machine and it is able to connect to the 11g database. It is only on unix server (where the app server resides) that is giving problem. FYI the unix server
    does not have Oracle client installed so we are using the below in db.properties file (used by application for connection details).
    URL=jdbc:oracle:thin:@59.90.26.156:1521:LDPR
    The Web application and the stand alone java program (giving problem) call the same program to db connection and also share the same environment (class folder/library files etc).
    Also the program was working perfectly fine with Oracle 9.2. Please suggest the solution as I have tried everything that came to my mind.
    Regards,
    Sid.

    Hi ...
    Yeah BPEL connect from the back end rather than using weblogic, but to change it ... we need to change the code from BPEL side to connect from the weblogic JDBC services.

  • Tns problem with Oracle 11g ODAC 11.1.0.6.21 with Oracle Developer Tools

    I installed the full
    Oracle 11g ODAC 11.1.0.6.21 with Oracle Developer Tools for Visual Studio
    now I am at the good old "[ORA-12154: TNS:could not resolve the connect identifier specified]" error.
    I copied the same tnsnames.ora as used on the db server
    onto the client "C:\Oracle\product\11.1.0\client_2\Network\Admin".
    The host name is right since a normal ping works. TNSping is not available.
    but I get the [ORA-12154: TNS:could not resolve the connect identifier specified] error.
    The listener is running and the instance as well since it all works on the source server.
    I tried it with
    SET path=c:\oracle\product\11.1.0\client_2\bin
    but tnsping is still not recognized.
    sqlplus works on the other hand when I set it to
    SET path=c:\oracle\product\11.1.0\client_2\
    what is going on...

    hey
    u can post your query here, and i think everyone here is to share opinion so do not hesitate to do so and please try to google before posting here,
    and we know no one is expert like some people saying 'boring questions' you just try to overcome your problem and you will definitly get your problem solved .
    some mpeople ar still there who answeres hopeless questions and say nothing about them but when a fresher askin a qustion is not tolarated by them they think everyone is born DBA here
    they always tend to discouraging people here on forums,and i think they are vvolunteers to reduce crowd here on forums, inspite of there experience and people respect them they can not control their anger
    so please post you tns here, i think there are ways to ask people to google and search docs first, but not like this
    thanks and regards
    VD
    Edited by: vikrant dixit on Jun 29, 2009 4:33 AM

  • Oracle 8.1.5 JDBC driver problem with LONGVARCHAR

    Hi, I'm having problem with 8.1.5 release on Solaris with the
    JDBC type 4 driver (thin). If I create the following table
    create table test1 (col1 NUMBER, col2 LONG);
    Using JDBC driver to insert into the second column any string
    longer than 4000 characters causing run time exception. The type2
    driver works fine, but type2 is slow.
    String sql = "insert into test1 (col1, col2) values (1099,?)";
    PreparedStatement stmt ;
    stmt = conn.prepareStatement(sql);
    // create a string with very long value , bigger than 4096
    stmt.setString(1,string);
    stmt.executeUpdate();
    runtime exception:
    java.sql.SQLException: Data size bigger than max size for this
    type
    at java.lang.Throwable.<init>(Compiled Code)
    at java.lang.Exception.<init>(Compiled Code)
    at java.sql.SQLException.<init>(Compiled Code)
    at oracle.jdbc.dbaccess.DBError.check_error(Compiled
    Code)
    at oracle.jdbc.ttc7.TTCItem.setArrayData(Compiled Code)
    at
    oracle.jdbc.driver.OraclePreparedStatement.setItem(Compiled Code)
    at
    oracle.jdbc.driver.OraclePreparedStatement.setString(Compiled
    Code)
    at testi.main(Compiled Code)
    Any help is appreciated.
    Thanks
    Steve
    null

    Post the full stacktrace here
    Also you might want to post jdbc related questions to weblogic.developer.
    interest.jdbc
    Kumar
    DreamNEON wrote:
    Hello,
    the NSAPI integration works, also the JSP files.
    But I have still problems with the Jdriver for my Oracle 8.1.5.
    I get the message :
    Failed to invoke startup class
    weblogic.jdbc.common.internal.JdbcStartup=weblogic.jdbc.common.internal.JdbcStartup
    when the WebLogic Server is started.
    Any ideas or hints about that?
    Thanks in advance
    Armin

  • JDBC TableModel problem with setValueAt

    Hello to everyone. I have problem when I change value at cell in Table. My model makes update in DB, but in GUI the change is not visible. The change gets visible only when I reopen the Table.
    public class CustomTableModel extends AbstractTableModel implements Serializable
        int                  dateTime = Types.DATE;
        Connection                con = null;
        ResultSet                  rs = null;
        ResultSetMetaData  rsMetaData = null;
        int                numColumns;
        String[]          columnNames = null;
        boolean           isUpdatable;
        Vector                   rows = new Vector();
        public CustomTableModel(Connection connect, ResultSet rset, String[] strl )
         try
             con = connect;
          String[] sNames = strl;
             rs = rset;
             rsMetaData = rs.getMetaData();
             numColumns = rsMetaData.getColumnCount();
             columnNames = new String[numColumns];
          int rowIndex;
          int columnIndex;
           if (rs.getConcurrency() == ResultSet.CONCUR_UPDATABLE)
              isUpdatable = true;
             else
              isUpdatable = false;
             for (int i = 0; i < numColumns; i++)
        if (sNames==null){
              columnNames[i] = rsMetaData.getColumnLabel(i+1);
        else
          columnNames = sNames;
             while(rs.next())
              Vector tempRow = new Vector(numColumns);
              for (int i = 0; i < numColumns; i++)
                  switch(rsMetaData.getColumnType(i+1))
                  .............. TYPES....
             } // end for loop
              rows.add(tempRow);
             } // end while loop
         }My method setValueAt
    public void setValueAt(Object aValue, int rowIndex, int columnIndex)
         try
            Object oldValue = getValueAt(rowIndex,columnIndex);
             if (oldValue == null && aValue == null)
              return;
             // can use equals() only if oldValue is not null
             if (oldValue != null)
              if (oldValue.equals(aValue))
                  return;
             // JTable is 0 based while ResultSet is 1 based
             rs.absolute(rowIndex+1);
             updateResultSet(rs, aValue, rowIndex, columnIndex);
             rs.updateRow();
             con.commit();
             Vector aRow = (Vector)rows.elementAt(rowIndex);
                aRow.setElementAt(aValue, columnIndex);
           fireTableCellUpdated(rowIndex, columnIndex);
         catch (SQLException ex)
             ExceptionEvent event = new ExceptionEvent(this, ex.getMessage());
             fireExceptionGenerated(event);
             try
              con.rollback();
             catch (SQLException ex2)
              event = new ExceptionEvent(this, ex2.getMessage());
              fireExceptionGenerated(event);
         catch (Exception ex)
             ExceptionEvent event = new ExceptionEvent(this, ex.getMessage());
             fireExceptionGenerated(event);
        }Thanks in advance.

    import java.io.*;
    import java.sql.*;
    import java.text.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.table.*;
    public class TableModelDemo extends javax.swing.JFrame {
        public TableModelDemo() {
            initComponents();
            connectDatabase();
            CustomTableModel model = new CustomTableModel();
            model.init(conn,rs,null);
            jTable1.setModel(model);
        private void connectDatabase(){
            try{
                DriverManager.registerDriver(new com.sybase.jdbc2.jdbc.SybDriver());
            }catch (Exception ex){
                ex.printStackTrace();
            conn=null;
            try{
                conn = DriverManager.getConnection("jdbc:sybase:Tds:prdfs4:2638","dba","sql");
            }catch (Exception ex){
                System.out.println("Connection refused");
            try {
                if(conn!=null){
                    Statement stmt = conn.createStatement();
                    String query ="SELECT ANA_LED_BASE_FORGN_CURY, ANA_AXIS_CODE, ANA_ACC_NUM, ANA_LED_TXT FROM ana_ledger " +
                            "where CMPY_CODE='06-LV   ' and JRNL_CODE='SFA  ' and ANA_LED_DOC_NUM=0008170";
                    rs = stmt.executeQuery(query);
            } catch (SQLException sqe) {
                String message = sqe.getMessage();
                JOptionPane.showMessageDialog( null, message );
        private void initComponents() {
            jScrollPane1 = new javax.swing.JScrollPane();
            jTable1 = new javax.swing.JTable();
            jToolBar1 = new javax.swing.JToolBar();
            jButton1 = new javax.swing.JButton();
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            setTitle("change value at cell in Table");
            jScrollPane1.setViewportView(jTable1);
            getContentPane().add(jScrollPane1, java.awt.BorderLayout.CENTER);
            jToolBar1.setFloatable(false);
            jButton1.setText("change value at cell in Table");
            jButton1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jButton1ActionPerformed(evt);
            jToolBar1.add(jButton1);
            getContentPane().add(jToolBar1, java.awt.BorderLayout.NORTH);
            java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
            setBounds((screenSize.width-790)/2, (screenSize.height-327)/2, 790, 327);
        private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
            String val = JOptionPane.showInputDialog("change value at cell in Table","TEST,1,1");
            String val2[] = val.split(",");
            jTable1.setValueAt( val2[0],Integer.parseInt(val2[1]),Integer.parseInt(val2[2]) );
        public static void main(String args[]) {
                    new TableModelDemo().setVisible(true);
        private javax.swing.JButton jButton1;
        private javax.swing.JScrollPane jScrollPane1;
        private javax.swing.JTable jTable1;
        private javax.swing.JToolBar jToolBar1;
        private ResultSet rs ;
        private Connection conn;
    class CustomTableModel extends DefaultTableModel implements Serializable {
        int                  dateTime = Types.DATE;
        Connection                con = null;
        ResultSet                  rs = null;
        ResultSetMetaData  rsMetaData = null;
        int                numColumns;
        String[]          columnNames = null;
        boolean           isUpdatable;
        Vector                   rows = new Vector();
        public void init(Connection connectToDatabase, ResultSet rset, String[] strl ) {
            try {
                con = connectToDatabase;
                String[] sNames = strl;
                rs = rset;
                rsMetaData = rs.getMetaData();
                numColumns = rsMetaData.getColumnCount();
                columnNames = new String[numColumns];
                int rowIndex=0;
                int columnIndex;
                if (rs.getConcurrency() == ResultSet.CONCUR_UPDATABLE) {
                    isUpdatable = true;
                } else {
                    isUpdatable = false;
                for (int i = 0; i < numColumns; i++) {
                    if (sNames==null){
                        columnNames[i] = rsMetaData.getColumnLabel(i+1);
                    } else {
                        columnNames = sNames;
                while(rs.next()) {
                    Object[] rowData = new Object[numColumns];
                    addRow( rowData );
                    Vector tempRow = new Vector(numColumns);
                    for (int i = 0; i < numColumns; i++) {
                        if( rowIndex==0 ){
                            addColumn( columnNames[i] );
                        setValueAt( rs.getString(i+1), rowIndex, i );
                        //                    switch(rsMetaData.getColumnType(i+1))
                        //                    .............. TYPES....
                    } // end for loop
                    rows.add(tempRow);
                    rowIndex++;
                } // end while loop
            }catch(Exception ex){
                ex.printStackTrace();
        public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
            super.setValueAt( aValue, rowIndex, columnIndex );
            try {
                Object oldValue = getValueAt(rowIndex,columnIndex);
                if (oldValue == null && aValue == null) {
                    return;
                // can use equals() only if oldValue is not null
                if (oldValue != null) {
                    if (oldValue.equals(aValue)) {
                        return;
                // JTable is 0 based while ResultSet is 1 based
                //            rs.absolute(rowIndex+1);
                //            updateResultSet(rs, aValue, rowIndex, columnIndex);
                //            rs.updateRow();
                //            con.commit();
                //        Vector aRow = (Vector)rows.elementAt(rowIndex);
                //        aRow.setElementAt(aValue, columnIndex);
                //            fireTableCellUpdated(rowIndex, columnIndex);
                //        } catch (SQLException ex) {
                //            ExceptionEvent event = new ExceptionEvent(this, ex.getMessage());
                //            fireExceptionGenerated(event);
                //            try {
                //                con.rollback();
                //            } catch (SQLException ex2) {
                //                event = new ExceptionEvent(this, ex2.getMessage());
                //                fireExceptionGenerated(event);
            } catch (Exception ex) {
                //                    ExceptionEvent event = new ExceptionEvent(this, ex.getMessage());
                //                    fireExceptionGenerated(event);
    }

  • STRUTS - JDBC connection problem

    im using tomcat 5.5.9, jdk 1.5, oracle database...
    � have a project in struts...
    my project works with my compiler with no problem...
    *i setup tomcat on C:\jakarta-tomcat-5.5.9
    and � made these setting for tomcat:
    � added these strings to my CLASSPATH
    --C:\jakarta-tomcat-5.5.9\common\lib\servlet-api.jar
    --C:\jakarta-tomcat-5.5.9\common\lib\jsp-api.jar
    after � deployed my project under tomcat there was a "classes12.zip" file under this path:
    C:\jakarta-tomcat-5.5.9\webapps\BILGISU\WEB-INF\lib
    � changed it to class.jar
    also � have other .jars under the same path above.
    these jars are:
    classes12.jar
    commons-beanutils.jar
    commons-collections.jar
    commons-dbcp.jar
    commons-digester.jar
    commons-fileupload.jar
    commons-lang.jar
    commons-logging.jar
    commons-pool.jar
    commons-validator.jar
    jakarta-oro.jar
    jdbc2_0-stdext.jar
    struts.jar
    struts-legacy.jar
    THE PROBLEM IS:
    my index page is a "login" page..
    i can open the login page under tomcat.
    but when � enter the username and password, page says it is wrong username or password although these are true parameters...
    i think i still have a connection problem but � dont know how to solve...
    MY SEARCHES SAYS:
    you have to reconfigure "C:\jakarta-tomcat-5.5.9\conf\server.xml" like that:
    <Resource name="jdbc/myoracle"
    auth="Container"
    type="javax.sql.DataSource"
    driverClassName="oracle.jdbc.driver.OracleDriver"
    url="jdbc:oracle:thin:[email protected]:1521:mysid"
    username="scott"
    password="tiger"
    maxActive="20"
    maxIdle="10"
    maxWait="-1"/>
    Resource name="jdbc/myoracle" ->HERE WHAT IS "myoracle"??? DOES IT BELONG TO MY PROJECT?
    you have to reconfigure "C:\jakarta-tomcat-5.5.9\conf\web.xml" like that:
    <resource-ref>
    <description>Oracle Datasource example</description>
    <res-ref-name>jdbc/myoracle</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    will i write this to my web.xml
    and what is "auth=Container" here???????
    thanks in advance
    yasin

    ONE MORE QUESTION
    Im defining the datasource in my "struts-config.xml"
    do i have to define them again in "tomcat/conf/server.xml" ...

  • JSP + JDBC + MySql Problem (Tomcat 4.1)

    I'm completely helpless... whenever I try to retrieve stuff from the db (using a jsp page), I get errors that don't even make sense.
    out.println(stmt.executeQuery("SELECT * FROM newsTbl WHERE articleID = 1").getString("articleTitle"));if I try doing the above, I get a "ServletException : Before start of result set" error that supposedly occurred at this line of the generated servlet:
    if (pageContext != null) pageContext.handlePageException(t);---------------
    If i try this:
    ResultSet rsSec = stmt.executeQuery("SELECT * FROM newsSecTbl");
    rsSec.beforeFirst();  //<-- Even if I don't have this line the result does not change
      out.println(rsSec.next());
      while (rsSec.next()) { ... }I the while loop is never initiated, because rsSec.next() is false... kind of weird if you ask me, I even put two entries into the table to make sure the cursor wasnt at the first record and saying there was no second one (which would have been right if there were only one record).
    I would be very grateful if someone could help me out with this. I've never done any db programming with Java yet, so I dont have a clue what Im doing. By the way, I'm using MySql (indicated in the title) and the server was running and available when I ran the above code.
    Cheers,
    Tom

    You can't do this:
    out.println(stmt.executeQuery("SELECT * FROM newsTbl WHERE articleID = 1").getString("articleTitle"));The ResultSet you get back is a database cursor that doesn't point to the first row yet. The correct idiom is:
    String sql = "SELECT * FROM newsTbl WHERE articleID = 1";
    ResultSet result = stmt.executeQuery(sql);
    String articleTitle = "";
    while (result.next())
       title = result.getString("articleTitle");
    result.close();
    stmt.close();If you've never done DB programming before, I'd recommend that you click on the Tutorials link to the left and go through the JDBC tutorial carefully. You'll save yourself a lot of grief.
    Another good idea would be to separate out all your database code into at least one separate object, independent of the servlet. That way you can test and develop it off to the side until it's 100% solid. Then your servlet can simply instantiate one and use it. All your problems from that point forward will be servlet issues, because you'll know that your database code is working. - MOD
    See if that works better. - MOD

  • JDBC/MySQL Problem

    Hello, I'm getting this error when trying to make a connection with MySQL:
    Internal Servlet Error:
    org.apache.jasper.JasperException: Unable to compile class for JSPNote: sun.tools.javac.Main has been deprecated.
    C:\tomcat\work\localhost_8080\_0002fdb_0002ejspdb_jsp_10.java:62: Undefined variable or class name: DriverManager
         conn = DriverManager.getConnection("jdbc:mysql:numbers", "username", "password");
         ^
    1 error, 1 warning
         at org.apache.jasper.compiler.Compiler.compile(Compiler.java:282)
         at org.apache.jasper.servlet.JspServlet.doLoadJSP(JspServlet.java:612)
         at org.apache.jasper.servlet.JasperLoader12.loadJSP(JasperLoader12.java:146)
         at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:542)
         at org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:258)
         at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:268)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:429)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:500)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
         at org.apache.tomcat.core.Handler.service(Handler.java:287)
         at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
         at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:806)
         at org.apache.tomcat.core.ContextManager.service(ContextManager.java:752)
         at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213)
         at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
         at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
         at java.lang.Thread.run(Thread.java:536)
    Here's the code I'm using:
    <%
         Class.forName("org.gjt.mm.mysql.Driver").newInstance();
         java.sql.Connection conn;
         conn = DriverManager.getConnection("jdbc:mysql:numbers", "username", "password");
    %>
    If anyone knows how to fix this, I'd appreciate any help!

    Hi,
    Three things:
    1. I presume numbers refers to the prot you are accesaing mysql - i tend to use default 3306.
    2. If there are problems recognising DriverManagaer are you importing java.sql.*; I'm sure you are.
    3. I think the sun.tools.javac.Main error relates to the tools version that you are using, although I would not guarantee this. The tools.jar in later versions of tomcat is twice the size of earlier versions and you have to ensure this is the version that your application is checking for. A quick test for this is to put the newer version(size 74k) into WEB-INF \lib directory where an application looks first for complied java files.
    best,
    kev
    ps If I'm wrong completely, let me know as I am watching this topic

  • 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

  • JDBC Resultset Problem with ORACLE 10.1.0.2

    Hello
    I have a problem with Petstore GenericCatalogDAO. java. The problem is the behaviour of the resultset object when retrieving data from the database.Below are two synareos one that
    works (when) hard coded and one that does not work when parameter values passed into the the result set.
    1. The code the WORKS.
    statement = connection.prepareStatement("select name from employee where a.name ='SMITH' order by name"
    ,ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
    resultSet = statement.executeQuery();
    resultSet.absolute(1);
    String s = resultSet.getString(1);
    The code that gives me a 'exhausted resultset' error which I think means no results
    String[] parameterValues = new String[] { "SMITH" };
    statement = connection.prepareStatement("select name from employee where a.name =? order by name ",
    ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
    for (int i = 0; i < parameterValues.length; i++) {
    statement.setString(i + 1, parameterValues);
    resultSet = statement.executeQuery();
    resultSet.absolute(1);
    String s = resultSet.getString(1);
    There is obviously a problem using these named parametevalues with these preparedstatement resultset, Does anybody know anything about this and a fix for it????
    Cheers. Roger

    Roger,
    It's probably a mistake you made when posting your code, but your query string is incorrect it should be either:
    select name from employee where name = 'SMITH' order by nameor
    select a.name from employee a where a.name = 'SMITH' order by a.nameIn other words you have prefixed a column with a table alias but have not indicated a table alias in the query.
    Also, shouldn't your code be:
    for (int i = 0; i < parameterValues.length; i++) {
        statement.setString(i + 1, parameterValues[ i ]);
    }Or was the "[ i ]" part giving you trouble? (Since "[ i ]" -- without the spaces -- is treated as a text-formatting tag.)
    While I didn't try your specific query, I have no problem using "PreparedStatment"s with parameters.
    What is your environment? Mine is:
    Oracle 10g (10.1.0.4) database on Linux (Red Hat)
    JDK 1.4.2
    ojdbc14.jar JDBC driver (latest version)
    Good Luck,
    Avi.

  • Oracle JDBC driver problem for Oracle 8.1.6

    i am a newbee to Java, i was trying JDBC programming thru Jbuilder 4.0. now the problem is whenever i am trying the DriverManager.getconnection(), I am getting an error "NO SUITABLE DRIVER". i have downloaded jodbc14.jar(oracle 9i JDBC driver) but so result. what can i do now? any other config issues or is it due to absence of a Oracle JDBC driver of Oracle 8.1.6.

    i have set the classpath as mentioned. but no solution.
    the error is like this::
    java.lang.NoClassDefFoundError: java/sql/Savepoint
         at java.lang.ClassLoader.defineClass0(Native Method)
         at java.lang.ClassLoader.defineClass(ClassLoader.java:486)
         at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:111)
         at java.net.URLClassLoader.defineClass(URLClassLoader.java:248)
         at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
         at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:286)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
         at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:521)
         at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:325)
         at java.sql.DriverManager.getConnection(DriverManager.java:517)
         at java.sql.DriverManager.getConnection(DriverManager.java:177)
         at DbaseTest.DbaseForm.OpenConnection(DbaseForm.java:37)
         at DbaseTest.DbaseForm.jbInit(DbaseForm.java:73)
         at DbaseTest.DbaseForm.<init>(DbaseForm.java:26)
         at DbaseTest.Application1.<init>(Application1.java:11)
         at DbaseTest.Application1.main(Application1.java:40)
    i have imported
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.sql.*;
    import oracle.jdbc.*;
    import java.lang.*;
    the driver is registered by:
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());

  • BI JDBC character problem

    I tried to write  multiple data to database by using  BI JDBC connection.I wrote "insert" statement in the SQL_STATEMENT on the line(event) from table to BI query.It works.I select multiple records in the table and write these records to database.But there is a problem about some Turkish Characters such as  ü,&#351;,&#287;...There is no character problem when using stored procedures(JDBC connection) instead of BI JDBC.But I cannot write multiple records by using stored procedures.I select multiple records in the table, it onlys writes the first record when using stored procedures.Can I write a stored procedures which takes multiple records from VC? Or, how can I solve Turkish character problem when using BI JDBC connection?
    Thanks,
    Nihat

    Hi Nihat,
    I think it depends on your JDBC Driver, which character set it supports. Your database supports turkish characters, when it works with a stored procedure. Maybe you can try to use a conversion for using JDBC. Did you check the manual of the jdbc driver? Did you contact the the jdbc driver vendor?
    Best Regards,
    Marcel

  • JDBC Servlet Problem

    Hi,
    I am trying to write a servlet to do a simple query against a database, however I am getting an "ERROR 405 - Resource not allowed".
    I am getting nothing appearing in my webservers or the jdbc log, so I don't have a stack trace to show you all.
    Any help would be appreaciated!!
    Code Below (certain data removed for security):
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import java.sql.ResultSet.*;
    import java.util.*;
    import java.util.Arrays;
    public class Mitch extends HttpServlet
      private Connection connection;
      private Statement statement;
      public static ArrayList Array = new ArrayList();
        public void init( ServletConfig config ) throws ServletException
            try
                String username = "xxxxxxx";
                String password = "xxxxxxx";
                Class.forName("com.ibm.db2.jcc.DB2Driver");
                String dbURL = "jdbc:db2://IP ADDRESS AND PORT/DIR";
                Properties conProps = new Properties();
                conProps.setProperty( "user", username );
                conProps.setProperty( "password", password );
                connection = DriverManager.getConnection( dbURL, conProps );
                statement = connection.createStatement( ResultSet.TYPE_SCROLL_INSENSITIVE,  ResultSet.CONCUR_UPDATABLE );
           catch( Exception exception )
               exception.printStackTrace();
               throw new UnavailableException( exception.getMessage() );
        }//end init
        protected void doPost( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException
            response.setContentType( "text/html" );
            PrintWriter out = response.getWriter();
            out.println( "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">\n" );
            out.println( "<HTML>\n<HEAD>" );
            String sqlQuery;
            try
                sqlQuery = "SELECT h5_cpu_usr FROM ps_h5_cpu_fs_ap1 WHERE h5_dttm_stamp BETWEEN '2005-2-20 00:00:00.00000' AND '2005-2-20 23:00:00.000000'";
                ResultSet resultSet = statement.executeQuery( sqlQuery );
                out.println( "<TITLE> Servlet DB Test by Mitch </TITLE>" );
                out.println( "</HEAD>" );
                out.println( "<BODY>" );
                out.println( "<P>This is a test to connect to a database, execute a simple SELECT and display the results below." );
                out.println( "<br>\n<br>" );
                Integer intObject;
                while ( resultSet.next() )
                   intObject = new Integer( resultSet.getInt( 1 ) );   
                   Array.add( intObject );
                resultSet.close();
                for( int i = 0; i < Array.size(); i++)
                 out.println(Array.get(i));
                out.close();
            }//end try
            catch ( SQLException sqlEx )
                sqlEx.printStackTrace();
                out.println( "<TITLE>ERROR</TITLE>" );
                out.println( "<HEAD>" );
                out.println( "<BODY><P>An error occurred.<br>Contact Mitch!" );
                out.println( "</P></BODY></HTML>" );
                out.close();
        }//doPost end
        public void destroy()
            try
                statement.close();
                connection.close();
            catch( SQLException sqlEx )
                sqlEx.printStackTrace();
        }//end destroy
    }//end Class
           

    Thank you both for your replies
    1. Yes I did.
    2 See below
    I found some sample code that I adapted to my code. I removed the init( ) method and used a doGet ( ) to call my doPost ( ) method.
    The servlet now works!
    Except for one thing...
    It doesn't seem to be threading!
    I did a simple test where two different users attempted to use the servlet at the same time, the results simply added to each other. The current query I am doing is one that returns approximately 100 rows and 1 column of 2-digit integers.
    For example:
    User 1 runs the servlet, output is:
    12 45 56 66 65 23 06 03 34 56 78
    User 2 runs the servlet after User 1, output is:
    12 45 56 66 65 23 06 03 34 56 78 12 45 56 66 65 23 06 03 34 56 78
    User 1 runs servlet again, after User 2, output is:
    12 45 56 66 65 23 06 03 34 56 78 12 45 56 66 65 23 06 03 34 56 78 12 45 56 66 65 23 06 03 34 56 78
    I hope this illustrates my problem clearly.
    Also, I checked the database to see how many connections were open -- the servlet opens a NEW connection for EVERY query. These connections do not die until I kill my WebApp (WebLogic). It truely is a messy situation.
    Any help would be appreaciated for this servlet newbie.
    Thanks in advance.
    New Code:
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import java.sql.ResultSet.*;
    import java.util.*;
    import java.util.Arrays;
    public class Mitch extends HttpServlet
      public static ArrayList Array = new ArrayList();
      Connection connection;
      Statement statement;
      String username = "xxxxxxx";
      String password = "xxxxxxx";
        protected synchronized void doGet(  HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException
          doPost ( request, response );
        protected void doPost( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException
            //HttpSession session = request.getSession(true);
            response.setContentType( "text/html" );
            PrintWriter out = response.getWriter();
            out.println( "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">\n" );
            out.println( "<HTML>\n<HEAD>" );
            String sqlQuery;
            //if(session.isNew())
            try
                Class.forName("com.ibm.db2.jcc.DB2Driver");
                String dbURL = "jdbc:db2://xx.xx.xx.xx:yyyyy/zzzzzzz";
                connection = DriverManager.getConnection( dbURL, username, password );
                statement = connection.createStatement( ResultSet.TYPE_SCROLL_INSENSITIVE,  ResultSet.CONCUR_UPDATABLE );
                sqlQuery = "SELECT h5_cpu_usr FROM ps_h5_cpu_fs_ap1 WHERE h5_dttm_stamp BETWEEN '2005-2-20 00:00:00.00000' AND '2005-2-20 23:00:00.000000'";
                ResultSet resultSet = statement.executeQuery( sqlQuery );
                out.println( "<TITLE> Servlet DB Test by Mitch </TITLE>" );
                out.println( "</HEAD>" );
                out.println( "<BODY>" );
                out.println( "<P>This is a test to connect to a database, execute a simple SELECT and display the results below." );
                out.println( "<br>\n<br>" );
                Integer intObject;
                while ( resultSet.next() )
                   intObject = new Integer( resultSet.getInt( 1 ) );   
                   Array.add( intObject );
                resultSet.close();
                for( int i = 0; i < Array.size(); i++)
                 out.println(Array.get(i));
                out.close();
            }//end try
            catch ( SQLException sqlEx )
                sqlEx.printStackTrace();
                out.println( "<TITLE>ERROR</TITLE>" );
                out.println( "<HEAD>" );
                out.println( "<BODY><P>An error occurred.<br>Contact Mitch!" );
                out.println( "</P></BODY></HTML>" );
                out.close();
            catch( Exception exception )
               exception.printStackTrace();
               throw new UnavailableException( exception.getMessage() );
        //else
        //    out.println( "<h1>This indicates an old session</h1>" );
        }//doPost end
        public void destroy()
            try
                statement.close();
                connection.close();
            catch( SQLException sqlEx )
                sqlEx.printStackTrace();
        }//end destroy
    }//end Class
           

  • JDBC connector problem

    Hi All,
    I installed SAP BW 3.5 by following Installation Seqence in the mySAP ERP 2004 SR1 master guide,
    there are two servers under Visual Administator -> Cluster -> sapsid: one is "Server 0 10_37758"(I think this is Central Instance), another is "Server 0 12_93726" (it maybe dialog instance). The first server is empty, and I can see JDBC Conncetor, Connector Container and etc.
    In the runtime tab of JDBC Connector, the Drivers only inculdes System_Driver, is it correct?
    and the status of the connector jdbc, odbo, smla and sapq in the Connector Container, Connector 1.0 display as sap.com/com.sap.ip.bi.sdk.dac.connector.sapq/null
    sap.com/com.sap.ip.bi.sdk.dac.connector.xmla/null
    sap.com/com.sap.ip.bi.sdk.dac.connector.odbo/null
    sap.com/com.sap.ip.bi.sdk.dac.connector.jdbc/null
    and they are not activity. what problem are these?
    I tried to add JDBC Driver in JDBC Connector, the problem can't be fixed, please help me.
    I install all ECC IDES 5.0 and java components and database on same host which is windows 2003 with Oracle9i

    Hi there,
    Do i have to to put mysql.connecto.jar to the
    j2dk\lib\ext? I have not copy the files maybe this is
    a problem with the connector. What do you think?Good God, no. Your code does not belong there.
    You have to add the MySQL Connector JAR to your CLASSPATH when you run. If you're running on the command line, that means using the -classpath option on java.exe. If you're using an IDE, that means adding the JAR to your CLASSPATH using the mechanism provided by the IDE. If you're using an app server, that means packaging the JAR with your app.
    %

Maybe you are looking for