Connecting to AW using AWConnection from java

Hi all,
I have some java code which performs some AW manipulation based on relational tables, the code works perfectly both inside the database and externally.
The problem I have is that I don't want to have to pass the username, password, and connectstring into the java procedure. I want to take advantage of the "kprb" type connection, i.e. I want to be able to use the defaultConnection method of the Oracle driver like I would with jdbc: the session has already been connected by sqlplus
I can't work work out if this is possible via the AWConnection method, I guess it must be using a loopback type connection based on the tnsnames.
Anyone know if it can be done?
Cheers,
Mark...

Hi Mark,
The AWXML api has a mode which does exactly what you want, you should create an Interaction object which contains a set of actions you want to perform. This object can then be serialized into xml by calling the writeToXML method on it. At this point, you can use the returned string to create a clob which is then passed to a pl/sql procedure called sys.interactionexecute. This procedure takes the xml as a clob and executes it in the internal jvm using the connection information from the envoker of the pl/sql procedure.

Similar Messages

  • Connect to MS Sql Server from Java Source

    Hi,
    Is there any way I could connect to ms sql server from Java source? I know I can call java source from function thats easy but what I really want is capability to connect to non-oracle(MS SQL server) from my java source and then call it from function.
    I don't know if JDBC driver for SQL server is even installed/available. Is there a way I could find it out form my IDE? I know sqlJ does compile but I have never used sqlj. help!!!
    Sinha

    You'll probably have better luck in a Java forum or a Microsoft forum.

  • Can't connect to Oracle XE instance from Java web application

    I'm a long-time Java developer but can't figure this out.
    I've been pouring over the forum for over a week and can't
    find the solution that will let me connect.
    Hardware: Intel/Vista.
    DB: Oracle Express 10G.
    Application: Java web application (Jakarta Struts)
    Application Server: Tomcat 5.5
    I copied the latest JDBC driver from OTN into my app server's "/LIB" directory.
    I get no driver errors. ("ojdbc14.JAR)"
    I can connect locally from my TOAD client, using SYSTEM/PASSWORD/XE.
    My listeners seem to be OK.
    Depending on which connection string I use from my Java application,
    I get one of two messages.
    "ORA-01017: invalid username/password; logon denied"
    OR
    "Io exception: The Network Adapter could not establish the connection"
    ------------ lsnrctl status ---------------------------------------------------
    Service "CLRExtProc" has 1 instance(s).
    Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service...
    Service "PLSExtProc" has 1 instance(s).
    Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
    Service "XEXDB" has 1 instance(s).
    Instance "xe", status READY, has 1 handler(s) for this service...
    Service "XE_XPT" has 1 instance(s).
    Instance "xe", status READY, has 1 handler(s) for this service...
    Service "xe" has 1 instance(s).
    Instance "xe", status READY, has 1 handler(s) for this service...
    The command completed successfully
    ------------ SOURCE CODE ------------------------------------------------------
    OracleDataSource ods = new OracleDataSource();
    ods.setURL(" jdbc:oracle:thin:@localhost");
    conn = ods.getConnection("system", "password");
    //ods.setURL("jdbc:oracle:thin:@rsosborn-PC:1521:XE");
    //conn = ods.getConnection("system", "password");
    String query = "select * from books;";
    Statement st = conn.createStatement();
    ResultSet rs = st.executeQuery(query);

    Using the code you supplied I was able to reproduce your errors. I've adjusted it accordingly and can connect to one of my 10.2 test databases.
    import java.sql.*;
    import oracle.jdbc.*;
    import oracle.jdbc.pool.*;
    class Conn {
      public static void main (String args []) throws SQLException
        Connection conn = null;       
        OracleDataSource ods = new OracleDataSource();
        // ods.setURL(" jdbc:oracle:thin:@localhost:1521:TEST");
        // conn = ods.getConnection("scott", "tiger");
        ods.setURL("jdbc:oracle:thin:@localhost:1521:TEST");
        conn = ods.getConnection("scott", "tiger");
        Statement stmt = conn.createStatement();
        ResultSet rset = stmt.executeQuery("select BANNER from SYS.V_$VERSION");
        while (rset.next())
            System.out.println (rset.getString(1));   // Print col 1
        stmt.close();
    }There are several different ways to configure OracleDataSources:
    http://download.oracle.com/docs/cd/B19306_01/java.102/b14355/urls.htm#BEIDBFDF
    So, hopefully it's just a mismatch config.

  • ORA-28183 when connect proxy user with password from java

    1. Create user on database 10.2.0.1.0
    create user scott identified by tiger;
    create user jeff identified by secnt;
    grant connect, resource to scott;
    grant create session to jeff;
    alter user jeff grant connect through scott authenticated using password;
    2. Try to open proxy session from java
    DriverManager.registerDriver(new OracleDriver());
    Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@//db.garage:1521/ILINK", "scott", "tiger");
    if (conn != null && conn instanceof OracleConnection) {
         Properties properties = new Properties();
         properties.put(OracleConnection.PROXY_USER_NAME, "jeff");
         properties.put(OracleConnection.PROXY_USER_PASSWORD, "secnt");
         ((OracleConnection)conn).openProxySession(OracleConnection.PROXYTYPE_USER_NAME, properties);
         ((OracleConnection)conn).close(OracleConnection.PROXY_SESSION);
    conn.close();
    3. Got the following error for step 2
    Exception in thread "main" java.sql.SQLException: ORA-28183: proper authentication not provided by proxy
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:138)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:316)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:277)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:272)
         at oracle.jdbc.driver.T4CTTIoauthenticate.receiveOauth(T4CTTIoauthenticate.java:647)
         at oracle.jdbc.driver.T4CConnection.doProxySession(T4CConnection.java:852)
         at oracle.jdbc.driver.PhysicalConnection.openProxySession(PhysicalConnection.java:1548)
         at ch.tie.cluster.Test.run(Test.java:30)
         at ch.tie.cluster.Test.main(Test.java:19)
    4. If i grant connect without using password like:
    alter user jeff grant connect through scott
    everything is fine, but i need password authentication.
    Thanks in advance.

    did you try using the oci driver?

  • Can't connect to IPv6-only host from java on Mac OS

    I have some IPv6-only hosts. I can successfully execute curl request to it by curl
    $ curl -I my.ip.v6.only.host HTTP/1.1 200 OK
    But when I trying to get it from java I have an error:
    HttpGet httpget = new HttpGet("http://my.ip.v6.only.host");
    CloseableHttpResponse response = httpclient.execute(httpget);  
    Stack trace:
    INFO: I/O exception (java.net.NoRouteToHostException) caught when processing request to {}->http://my.ip.v6.only.host: No route to host
    Mar 17, 2015 7:42:23 PM org.apache.http.impl.execchain.RetryExec execute
    INFO: Retrying request to {}->http://my.ip.v6.only.host
    java.net.NoRouteToHostException: No route to host
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    at java.net.Socket.connect(Socket.java:579)
    at org.apache.http.conn.socket.PlainConnectionSocketFactory.connectSocket(PlainConnectionSocketFactory.java:72)
    at org.apache.http.impl.conn.HttpClientConnectionOperator.connect(HttpClientConnectionOperator.java:123)
    at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:318)
    at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:363)
    at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:219) 
    at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:195)
    at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:86)
    at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:108)
    at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:106)
    at MainTest.main(MainTest.java:25)
    Problem has been occured on java v1.7.0_65 and v1.8.0_40, MacOS 10.10.2. On previous version MacOS 10.9.5 it works well.
    What's going on? How it is possible that host is reachable by curl and unreachable from java.
    Also, I've tried to play around -Djava.net.preferIPv6Addresses=true and -Djava.net.preferIPv4Stack=false and it couldn't help.

    Using the code you supplied I was able to reproduce your errors. I've adjusted it accordingly and can connect to one of my 10.2 test databases.
    import java.sql.*;
    import oracle.jdbc.*;
    import oracle.jdbc.pool.*;
    class Conn {
      public static void main (String args []) throws SQLException
        Connection conn = null;       
        OracleDataSource ods = new OracleDataSource();
        // ods.setURL(" jdbc:oracle:thin:@localhost:1521:TEST");
        // conn = ods.getConnection("scott", "tiger");
        ods.setURL("jdbc:oracle:thin:@localhost:1521:TEST");
        conn = ods.getConnection("scott", "tiger");
        Statement stmt = conn.createStatement();
        ResultSet rset = stmt.executeQuery("select BANNER from SYS.V_$VERSION");
        while (rset.next())
            System.out.println (rset.getString(1));   // Print col 1
        stmt.close();
    }There are several different ways to configure OracleDataSources:
    http://download.oracle.com/docs/cd/B19306_01/java.102/b14355/urls.htm#BEIDBFDF
    So, hopefully it's just a mismatch config.

  • How to get connection of the db lite from java stored procedure?

    Hello! All.,
    I have a written java stored procedures to assign sequence keys, and update some tables. The procedure is working as per our need by using the following connection information.
    try {
    int rowFetched = 0;
    Class.forName("oracle.lite.poljdbc.POLJDBCDriver");
    // connect to the database
    Connection conn = DriverManager.getConnection("jdbc:polite:polite",
    "system", "manager");
    My question is, It is possible in db lite to get a default connections like we use in the enterprise database
    conn = new OracleDriver().defaultConnection();
    Could anybody please shed some light on this.
    Thanks in advance.
    Kathir

    Hello Upi! out of curiosity if you happen to know the answer for the following, I do appreciate it.
    Hello! We are using BC/ADF JClient to select and for any DML operation against Oracle Lite database. We may have more than one user(s) log on to our application, so we requires to authenticate oracle lite user credential using JDBC dynamically.
    I am utilizing the features of JCLoginDialog.java and manipulation bc4j.xcfg file. This work real good for accepting username/password credentials dynamically, since we have multiple database in one computer I have to accept DSN name and if possible built my own configuration file.

  • Connecting to Oracle8 Personal Edition from Java

    Hi,
    I have Oracle8 Personal Edition installed on my system. I would like to connect to it using the java test program that comes with Oracle called Employee.java. Whenever I run the program (on the same machine as the database), I get an error message saying "Connection Refused". I am connecting to Oracle running locally using:
    Connection conn =
    DriverManager.getConnection ("jdbc:oracle:thin:@127.0.0.1:1521:orcl",
                        "scott", "tiger");
    Does anybody know what is wrong?

    The problem is fixed. It did not work because I did not have a TNS listener running. Now it works fine.

  • Using XPath from Java

    I've heard that you can use XPath from within Java instead of having to use it within XSLT, but I'm not sure what the syntax is?
    Does anyone know?
    Thanks,
    Oodi

    import org.apache.xerces.parsers.DOMParser;
    import org.apache.xpath.XPathAPI;
    DOMParser parser = new DOMParser();
    parser.parse(inputFile);
    doc = parser.getDocument();
    /* Search using XPATH */
    String xpath = "/XpathToSearch";
    NodeIterator nl = XPathAPI.selectNodeIterator(doc, xpath);
    HTH,
    Joe

  • Using Perl From Java!

    Hi there, i have an assignment for university, part of it is to send data to a perl script through a Java applet. My perl script works, as i have tested it with a HTML form, however when i try it with java, i get nothing, nothing, no errors or warnings. Im using JBuilder6.
    I am convinced that there is a problem with my code and a connection is not being opened, my lecturer cant see what the problem is (im not too impressed!) so i come to you.
    All the perl does is create a file called test.txt and print within it the name, email..etc from the applet.
    Thanks in Advance, Dave Williams.
    JAVA:
    void btnSendPosting_actionPerformed(ActionEvent e) { //Send Posting Event
    name = txtName.getText();
    email = txtEmail.getText();
    message = txtareaText.getText();
    path = txtFilePath.getText();
    String url = "http://localhost/cgi-bin/diag.pl";
    System.out.println("Url entered");
    try
    theURL = new URL(url);
    System.out.println("Url prepaired");
    catch (MalformedURLException f)
    System.out.println("Bad URL: " + theURL);
    try
    System.out.println("Beggining Connection...");
    URLConnection connection = theURL.openConnection();
    connection.setDoOutput(true);
    PrintWriter out = new PrintWriter(connection.getOutputStream());
    out.print("txtName="+name +"&txtEmail="+ email +"&txtMessage="+ message +"&txtPath="+path);
    out.close();
    System.out.println("End of Connection");
    catch (IOException f)
    System.out.println("Error Opening Connection");
    } //Send Posting Close bracket

    Hi All heres the code with the propper tags i think, as for smorgasbords comment, I realise the security issue with java, but my lecturer seems to think its a good idea. Now the java applet opens a stream to my perl script and sends it parameters which the perl script uses to create the file. So java isnt making the file on any computer, perl is creating it on the server (EasyPHP actually). The example code given by my lecturer does actually work however for reasons which neither myself or the lecturer cannot see, it just doesnt create the file (or even open the perl script for that matter, as i used a file monitor to check if the 'diag.pl' file was accessed). I hope ive cleared up any questions.
    Thanks
    Dave
    void btnSendPosting_actionPerformed(ActionEvent e) { //Send Posting Event
    name = txtName.getText();
    email = txtEmail.getText();
    message = txtareaText.getText();
    path = txtFilePath.getText();
    String url = "http://localhost/cgi-bin/diag.pl";
    System.out.println("Url entered");
    try
    theURL = new URL(url);
    System.out.println("Url prepaired");
    catch (MalformedURLException f)
    System.out.println("Bad URL: " + theURL);
    try
    System.out.println("Beggining Connection...");
    URLConnection connection = theURL.openConnection();
    connection.setDoOutput(true);
    PrintWriter out = new PrintWriter(connection.getOutputStream());
    out.print("txtName="+name +"&txtEmail="+ email +"&txtMessage="+ message +"&txtPath="+path);
    out.close();
    System.out.println("End of Connection");
    catch (IOException f)
    System.out.println("Error Opening Connection");
    } //Send Posting Close bracket

  • Could not connect to db using connectring from the server as different user

    Oracle Binary is installed under "oracle" user. if we login using different os user, we could not connect using connectr string.
    we set all env variables including TNS_ADMIN.
    tnsping fails with "TNS-03505: Failed to resolve name"

    Version: 11gR1
    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
    PL/SQL Release 11.1.0.7.0 - Production
    CORE     11.1.0.7.0     Production
    TNS for Linux: Version 11.1.0.7.0 - Production
    NLSRTL Version 11.1.0.7.0 - Production
    There is not problem in the tnsnames configuration. Because if I login as oracle then I can connect to the db using connectring. Developers are not able to connect from the server(Developer have unix account because they are loading data from sql*loader).

  • Using JNDI from Java Stored Procedures

    Hi,
    we want to call external services (mostly via middle tier/J2EE) from within the database (9i Rel. 2) using Java Stored Procedures and JNDI.
    Does anybody have some hints/samples how to do this? Will we have to use oc4jclient.jar? If yes, how? Where can I find some more detailed documentation?
    Lot's of questions...
    Thank
    Matthias

    Uh, not JNI but JNDI you asked. And use of JNI should be generally discouraged unless there is absolutely no other way (like co-located CORBA code for decoupling+speed). Can you direct me to a HOW-TO Oracle DB JVM configuration page? I want to know how to configure the internal DB JVM in a hurry.
    Thank you,
    Bryan

  • Problem in using Timestamp from java.sql.*

    AOA
    i have declared a variable
    private Timestamp entryDate = new Timestamp(8);while using it in my application. it inserts similar time stamp in database , like
    01/01/1970 5:00:00 AM
    How to get current time from it and how to insert it in databse.

    AOA
    i have declared a variable
    private Timestamp entryDate = new Timestamp(8);
    Why? What does that 8 mean to you? Did you read the docs to see what it means to Timestamp?
    >
    while using it in my application. it inserts similar
    time stamp in database , like
    01/01/1970 5:00:00 AM
    How to get current time from it and how to insert it
    in databse.Did you read the docs for Timestamp? There's a constructor and/or a set method that takes a Date or a number of millis. You can get the current time in millis with System.currentTimeMillis. (I think that's the method name. Look at System's docs.)
    As far as inserting it, you'll do something like this: TimeStamp ts = ...;
    Connection con = DriverManager.getConection(...);
    PreparedStatement ps = con.prepareStatement("insert into foo (bar) values (?)");
    ps.setTimestamp(1, ts);
    ps.executeUpdate(); Google for jdbc tutorial for more details.

  • How to connect oracle database using DSN  from jsp

    hello, can any know how can i connect to[b] oracle database using DSN name from jsp .I am using oracle 9i and Tomcat 5
    Using odbc tool i have created the dsn name but ithe connection does not make .here is the code that i have tried
    Connection connection = null;
         try
              Class.forName("oracle.jdbc.driver.OracleDriver");
         catch(ClassNotFoundException Exception)
              out.println("error occoured during loading the driver ");
         try
              out.println("getting the connection");
              connection = DriverManager.getConnection("jdbc:oracle:deepak","scott","tiger");
              out.println("connection getted");
         catch(Exception exception1)
              out.println("error occoured ");
    pls help as soon as possible
    Sorry, for my english

    you are actually using JDBC so the DSN entry does not matter.
    2 things.
    Make sure that your oracle database driver is in your classpath on your tomcat server.
    I.E. copy the file classes12.jar into your common/lib folder of tomcat, or into your WEB-INF/lib folder of your application. and RESTART your server. classes12.jar can be found on the internet or more easily somewhere within your oracle installation. just search for it.
    Make sure your jdbc url is correct. I believe it goes like this.... fill in the blacks
    connection conn = DriverManager.getConnection("jdbc:oracle:thin:scott/tiger@MyOracleHost:1521:MyDB");Note how the username are passed in the first string there fore there is no need to pass additional parameters. This method may be depriciated, but if so, just take out the user and pass from the string and continue to pass them as 3 seperate strings.
    connection conn = DriverManager.getConnection("jdbc:oracle:thin:MyOracleHost:1521:MyDB","scott","tiger");That should get your connection. if not, post your errors.

  • Using COM from java

    hi all,
    I'm trying to find a way to call functions from a C++ COM object (.tlb).
    Since I don't have a clue about C++ I thought about using an API or Tool that will help me to generate the appropriate wrappers and stubs to use with java.
    Does someone have any idea of an API or Tool which is suitable for the above scenario?
    many thanks in advance..........

    See
    http://simtel.net/product.php[id]60701[sekid]0[SiteID]simtel.net

  • JNI : Unsatisfied Link Error using C++ from Java

    Am using JNI to call a C Function which in turn creates a new C++ object and calls a method on it.
    When I run the java program that calls this native method, I get a UnsatisfiedLinkError : No <lib> in java.library.path.
    If I change the C function to do a simple printf instead of creating a new object , it works fine.
    I am printng out the java.library.path before calling the loadLibrary method, the path is correct.
    Am using Java 1.2.2 and compiling with gcc 2.7 on solaris 2.6 (Sun OS 5.6)
    Any help would be appreciated. I have seen some other folks having similar problems but haven't seen any replies that seem to solve the problem.

    Thanks for the ldd suggestion :
    This is the output from ldd
    ldd -sir liba.so
    find library=./liba.so; required by /usr/lib/lddstub
    find library=libe.so; required by ./liba.so
    search path=/user/ajax/jni (LD_LIBRARY_PATH)
    trying path=/user/ajax/jni/libe.so
    libe.so => /user/ajax/jni/libe.so
    symbol not found: strcpy (/user/ajax/jni/libe.so)
    symbol not found: strcpy (/user/ajax/jni/libe.so)
    symbol not found: printf (/user/ajax/jni/libe.so)
    symbol not found: printf (/user/ajax/jni/libe.so)
    symbol not found: __builtin_new (/user/ajax/jni/libe.so)
    symbol not found: printf (/user/ajax/jni/libe.so)
    init library=/user/ajax/jni/libe.so
    init library=./liba.so
    libe.so is in the LD_LIBRARY_PATH
    The 'man' pages for ldd say this :
    Using the -d or -r option with shared objects can give misleading results. ldd does a "worst case" analysis of the shared objects. However, in practice some or all of the symbols reported as unresolved can be resolved by the executable file referencing the shared object.
    Most of them seem ok, but I am wondering about "__builtin_new", anyone know what shared lib that's supposed to be in ?

Maybe you are looking for