Jdbc thin driver connect oracle as internal

I need to connect to Oracle as Internal using jdbc driver, is there a way we can do this using jdbc thin driver. Actually I don't want to pass username and password as it will be harcoded in a properties file.
Please let me know.

Hi Minol,
Have a look at this code example that shows how to Connect to Database as internal ( as sysdba ). In this code sample the properties are hard-coded, you can supply these Properties by loading them from a properties file.
Connecting to Oracle Database with DBA privileges
http://myjdbc.tripod.com/basic/codeindex.html
The code snippet to load properties from a properties file
//Import IO related classes
import java.io.IOException;
// Necessary support classes
import java.util.Properties;
import java.util.Enumeration;
import java.util.ResourceBundle;
   * This method reads a properties file which is passed as
   * the parameter to it and load it into a java Properties
   * object and returns it.
   * @param file File path
   * @return Properties The properties object
   * @exception IOException if loading properties file fails
   * @since 1.0
  public static Properties loadParams(String file)
      throws IOException {
    // Loads a ResourceBundle and creates Properties from it
    Properties     prop   = new Properties();
    ResourceBundle bundle = ResourceBundle.getBundle(file);
    // Retrieve the keys and populate the properties object
    Enumeration enum = bundle.getKeys();
    String      key  = null;
    while (enum.hasMoreElements()) {
      key = (String) enum.nextElement();
      prop.put(key, bundle.getObject(key));
    return prop;
  }Regards
Elango.

Similar Messages

  • Oracle JDBC Thin Driver for oracle 9.2.0.4

    Hi,
    It would be nice if someone please guide me to the download of Oracle JDBC Thin Driver for oracle 9.2.0.4.
    Thanks in anticipation

    user566773,
    As far as I know, all Oracle JDBC drivers are meant to be backward compatible.
    According to the table on the following Web page, the latest Oracle JDBC driver can be used with Oracle 9.2.0.x DBMS.
    http://www.oracle.com/technology/tech/java/sqlj_jdbc/index.html
    Good Luck,
    Avi.

  • Oracle 7 - JDBC Thin driver - connect - compatibility

    When logging on to an Oracle server v.7.2.3.0.0 with JDBC-thin
    driver (classes111.zip), I get the message:
    ORA-01017 invalid username/ password; logon denied
    even if the password, username and connection string is correct.
    The connection worked OK until some work was performed on the
    database and some changes with SQL*Net was done.
    I thought the driver worked OK with all versions of SQL*Net
    listeners?
    The database can be connected to with SQL*Plus.
    null

    I have the same problem trying to connect to database cache on iAS with iAS.

  • Oracle JDBC Thin-Driver: Connection still valid (db still open)?

    Hi,
    I've got a problem with my program. The app opens a connection to an Oracle Database usingt the Oracle JDBC Thin.Driver. Everything works just fine but I can't figure out a way how to find out wheter the connection is still valid, e.g. if the database is still open?
    connection.isClosed() return always false :(
    Any help is appreciated.
    Thanks,
    Spaulding

    Hi oracle_guru,
    unfortunately it's not that easy. :(
    You can't just check for
    if(conn == null)since the connection won't realize when the db shuts down.
    Therefore I created a connection-watcher-thread which uses a prepared statement to check every once in while if the connection is still valid.
    Nevertheless, thanks for you reply,
    Spaulding

  • JDBC thin driver and Oracle 8.1.6

    Hi,
    I have installed Oracle 8.1.6 on Windows NT 4.0 with service pack 4 and using Oracle JDBC thin driver driver (classes111.zip). My application is multithreaded, but each thread maintains its own connection (and own set of Statements). Things are okay in single threaded mode, but in multi threaded mode, I get weird errors!
    1. My resultsets are SCROLL_SENTITIVE and UPDATABLE
    2. Sometimes, while updating a row, "No current row" SQLException is thrown, although a row exists that satisfies my select criteria
    3. I am also calling executeUpdate() for inserting new rows and such rows are not seen by successive resultsets!
    Appreciate any hints! Thanks!

    Try this isntead.
    java -classpath d:\jdbc\classes12.zip;. jdbccheckup
    an error occured:
    Exception in thread "main" java.lang.NoClassDefFoundError:jdbccheckup
    Why??????

  • JDBC thin driver connection problems using cybersafe authentication

    Hi
    i am trying to use jdbc thin driver to connect to oracle 8.1.7 DB using ASO and cybersafe authentication.
    Question:
    Does the oracle jdbc thin driver in 8.1.7.0.0 support third-party authentication features supported by Oracle Advanced Security--such
    as those provided by RADIUS, Kerberos, or SecurID
    i am getting the following error.
    Exception in thread "main" java.sql.SQLException: invalid arguments in call
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java)
    at oracle.jdbc.dbaccess.DBError.check_error(DBError.java)
    at oracle.jdbc.ttc7.TTC7Protocol.logon(TTC7Protocol.java)
    at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java)
    at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.ja
    va)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java)
    at java.sql.DriverManager.getConnection(DriverManager.java:517)
    at java.sql.DriverManager.getConnection(DriverManager.java:146)
    at ASOJdbc.main(ASOJdbc.java:43)
    Following is the program i am trying.
    public class ASOJdbc {
         public static void main(String args[]) throws SQLException {
              String url = "jdbc:oracle:thin:@son1129:1521:sonias";
              Connection con;
              String query = "select EMPNO, ENAME from EMP";
              Statement stmt;
              // ASO Stuff
                   Properties props = new Properties();
                   try {
                   props.put("oracle.net.authentication_services", "CYBERSAFE");
                   props.put("oracle.net.authentication_gssapi_service", "oracle/[email protected]");                    
                   props.put("oracle.net.encryption_types_client", "DES");
                   props.put("oracle.net.encryption_types_server", "DES");               
                   props.put("oracle.net.crypto_seed", "4fhXXXX");               
                   } catch (Exception e) { e.printStackTrace();
                   DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
                   // ASO
                   con = DriverManager.getConnection(url, props);
                   stmt = con.createStatement();
                   ResultSet rs = stmt.executeQuery(query);
                   stmt.close();
                   con.close();          
    jdk version: jdk 1.3.1
    Oracle jdbc driver information, which i obtained as per Note 94091.1
    =============
    Database Product Name is Oracle
    Database Product Version is Oracle8i Enterprise Edition Release 8.1.7.1.1 - Production With the Partitioning option
    JServer Release 8.1.7.1.1 - Production
    JDBC Driver Name is Oracle JDBC driver
    JDBC Driver Version is 8.1.7.0.0
    JDBC Driver Major Version is 8
    JDBC Driver Minor Version is 1

    1. What JDBC Thin client Driver are you using? (version) If you don't know, open up the Manifest.
    2. the JDBC/OCI driver is a thick driver. It uses the oracle client, and therefore should read the tnsnames.ora
    3. You have yet to give us any ORA- errors, which would help immensely in troubleshooting.

  • 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

  • JDBC Thin-Driver and Oracle Stored Procedure

    I've got a Oracle stored procedure which returns a Oracle record.
    How can I retrieve the record in java using the JDBC Thin-Driver ?
    Record:
    TYPE messagerec IS RECORD
    (log_level VARCHAR(2), timestamp VARCHAR2(19), text VARCHAR2(200));

    Using PL/SQL BOOLEAN, RECORD Types, and TABLE Types:
    Oracle SQLJ and JDBC do not support calling arguments or return values of the
    PL/SQL BOOLEAN type or RECORD types. Also, when using the Thin driver, they
    do not support calling arguments or return values of PL/SQL TABLE types (known
    as indexed-by tables). TABLE types are supported for the OCI driver.
    Check the following guide,
    http://otn.oracle.com/tech/java/sqlj_jdbc/pdf/a96655.pdf

  • Jdbc thin driver with Oracle 9i database

    Hi,
    I'm having a problem with java code which previously deployed ok on an Oracle 817 database. In attempting to access data from a 9i database I get the following error:
    java.sql.SQLException: ORA-00600: internal error code, arguments: [ttcgcshnd-1], [0], [], [], [], [], [], []
    From looking around I get the impression that the problem is with an incompatability with the driver and the 9i database. Any ideas as to whether this is true or not or suggestions on how to resolve it?
    Any help will be greatly appreciated.
    Thanks,
    Alison

    I don(t understand,my JBuilder use the libraries from Oracle 9.01
    and when I make a connection,
    with this code:
    DatabaseMetaData meta = conn.getMetaData();
    System.out.println("JDBC driver version is " + meta.getDriverVersion());
    It send me back thin driver 8.17
    how is it possible?

  • JDBC thin driver for oracle 7.1.3

    Hi,
    we r using Oracle 7.1.3. i would like to know where i can get the
    thin driver for java compatible with the oracle version 7.1.3 so
    that i need not install an oracle client in the clients pc.
    thanks
    veera
    null

    Jay (guest) wrote:
    : BUBBA (guest) wrote:
    : : Veera Nagendran (guest) wrote:
    : : : Hi,
    : : : we r using Oracle 7.1.3. i would like to know where i can
    : get
    : : the
    : : : thin driver for java compatible with the oracle version
    : 7.1.3
    : : so
    : : : that i need not install an oracle client in the clients pc.
    : : : thanks
    : : : veera
    : : Thedatabase you're using went out of support over 2 years
    ago.
    : : oracle doesn't provide jdbc drivers for anything less than
    : : supported version 7.3.4.
    : So why does Oracle make this claim
    : "The Thin driver does not require Oracle software on the client
    : side. It connects to any Oracle database of version 7.2.x and
    : higher. The driver requires a TCP/IP listener on the server
    : side. " ???
    : Jay
    re-read my earlier reply -- the comment was :
    Thedatabase you're using went out of support over 2 years
    ago. oracle doesn't provide jdbc drivers for anything less
    than the minimum supported version ---> 7.3.4.At no time did i refer to the client s/w being required !!
    also it was not tested against unsupported version of the
    rdbms ...
    also rdbms 7.1.3 isn't y2k compliant.
    use it at your own risk..
    what "claim" are you saying oracle made ??
    null

  • JDBC Thin driver and Oracle names server

    Hi
    Any managed to get the Thin driver to user the Names Server aliases, ie I want to connect to service xxx like
    jdbc:oracle:thin:@xxxx and not specify instance and port as the DB is running in a multiple machine cluster and can be switched to a different machine...
    With OCI driver I have managed on NT but having problem with OCI/Linux and Beta 10g...
    Tks
    Andre

    I don't have much experience with OCI from JDBC, but should work like any other kind of connection via SQL*Net. I.e. I would check if connection can be made using SQLPlus, check environment variables (ORACLE_HOME etc.) of 9iAS instance, check version of JDBC classes and their readme.txt. There are also some settings in sqlnet.ora file which might affect this (like default domain - try to use full name of alias - OCRL.WORLD or whatever alias you have there). You may also want to switch tracing for SQLNet and/or listener on (it's not easy to find in doc how to do it, though) to check if there is at least some traffic between klient and server...
    Myrra

  • JDBC Thin driver connection

    Hi,
    I am trying to open a connection from Java using JDK 1.1.6 and the Oracle JDBC Thin drivers. My Oracle drivers register just fine. However, I get an exception which I catch saying "Security.couldn't connect to HOST with origin from." HOST is my local server name where I'm running Oracle 8.0.4.0.0 and OAS 4.0.8. My connection statement in my .java code is:
    Connecttion conn =
    DriverManager.getConnection("jdbc:oracle:thin@HOST:1521:orcl,"scott","tiger")
    I can connect just fine using sqlplus with the scott/tiger@orcl descriptor.
    How can I resolve this?

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by JDBC Development Team:
    Not sure whether this is the cause of the problem. There should be a ":" before the "@" sign in the connect string. That is,
    "jdbc:oracle:thin:@host"
    Please do let us know if this doesn't fix the problem
    <HR></BLOCKQUOTE>
    Thank you for pointing out the missing : before the @ symbol. I made that change. Still, I get the same message when the applet loads in my browser page. If I load the applet in appletviewer then I get the error message "checkconnect.networkhost1".

  • Error Code Definition for JDBC Thin driver

    Would like to know where I can find the definition of error codes
    for JDBC thin driver to Oracle 7 database. Right now, when I have
    database errors, I get SQL execption with CODE=XXXXXX. Need to
    know the definition of the error codes in order to decide whether
    the application shall retry or quit or do something else. Thank
    you in advance.
    null

    Hi,
    thin client session Language is controlled by java Locale.
    Based on testing code, ORA- messages are localized after the connection is successfully established. ORA- messages returned in the middle of connecting are in instance language.
    So, as far as I can say, you need to catch exceptions from DriverManager.getConnection(url, info); and translate them on your own.
    Once the connection is successfully returned, ORA- message language is defined by java Locale.
    Tests were performed on Oracle 10gR2 (both thin driver and DB).

  • JDBC Thin Driver Won't Honor Autocommit=FALSE

    I have the following code, which intializes a JDBC thin driver connection, and sets the autocommit to false. However, as soon as the statement is executed, it commits on its own. What's going wrong here? I can tell that it is committing, because the calendar events all disappear, even if the code is terminated before committing, or in an endless loop.
    odsSecondary = new OracleDataSource();
    odsSecondary.setDatabaseName("####");
    odsSecondary.setDriverType("thin");
    odsSecondary.setUser("####");
    odsSecondary.setPassword("####");
    odsSecondary.setPortNumber(1521);
    odsSecondary.setServerName("####");
    connectionSecondary = odsSecondary.getConnection();
    connectionSecondary.setAutoCommit(false);
    Statement stmtSecondary = connectionSecondary.createStatement();
    stmtSecondary.executeUpdate("truncate table cal_events");

    The truncate command always issues a commit. refer to the oracle SQL documentation

  • Jdbc thin driver to connect oracle as internal

    I need to connect to Oracle as Internal using jdbc driver, is there a way we can do this using jdbc thin driver. Actually I don't want to pass username and password as it will be harcoded in a properties file.
    Please let me know.

    Hi Minol,
    Have a look at this code example that shows how to Connect to Database as internal ( as sysdba ). In this code sample the properties are hard-coded, you can supply these Properties by loading them from a properties file.
    Connecting to Oracle Database with DBA privileges
    http://myjdbc.tripod.com/basic/codeindex.html
    The code snippet to load properties from a properties file
    //Import IO related classes
    import java.io.IOException;
    // Necessary support classes
    import java.util.Properties;
    import java.util.Enumeration;
    import java.util.ResourceBundle;
       * This method reads a properties file which is passed as
       * the parameter to it and load it into a java Properties
       * object and returns it.
       * @param file File path
       * @return Properties The properties object
       * @exception IOException if loading properties file fails
       * @since 1.0
      public static Properties loadParams(String file)
          throws IOException {
        // Loads a ResourceBundle and creates Properties from it
        Properties     prop   = new Properties();
        ResourceBundle bundle = ResourceBundle.getBundle(file);
        // Retrieve the keys and populate the properties object
        Enumeration enum = bundle.getKeys();
        String      key  = null;
        while (enum.hasMoreElements()) {
          key = (String) enum.nextElement();
          prop.put(key, bundle.getObject(key));
        return prop;
      }Regards
    Elango.

Maybe you are looking for