Can I ? - XSQL dynamic database connection

[raised this a couple of days ago on the 9iJDeveloper forum - but that's vanished]
How do you write XSQL without knowledge of username and passwords.
The physical user will be supplying their DbUser and DbPassword in a
web login
page and these are to be used throughout the web application.
XSQL requires a connection alias. i.e. "demo"
<page xmlns:xsql="urn:oracle-xsql" connection="demo" >
<xsql:query max-rows="-1" null-indicator="no" row-element="USER"
rowset-element="" tag-case="upper">
select user from sys.dual
</xsql:query>
</page>
But I need to set the username and password for "demo" in runtime.
(Reason: Each database user has specific roles and limits on viewable
information)
Chris Wilson

Not with the default implementation of oracle.xml.xsql.XSQLConnectionManager and oracle.xml.xsql.XSQLConnectionManagerFactory, however I've worked with customers who have written a custom XSQL Connection Manager to handle connections in any way that's appropriate for your application. Some have used Oracle8i OCI8 JDBC's proxy connection feature, others have implemented a custom strategy.
The online documentation for XSQL (part of the doc for the XDK for Java on OTN that ships with the database documentation set) talks about the two interfaces above that your implementation must implement.

Similar Messages

  • Can i use single database connection in a hole java application?

    can i use single database connection in a hole java application?.I have so many forms to use database connection.

    Theoretically you can. Not only theoretically. I've seen lots of application which only uses one database connection (they were using, oracle or mysql)
    The first reply given here assumed that the answer to
    your question depends only on the design of your
    application. That is not true.Yes it's true. Nothing in the original questions says that you aren't allowed to open or close the single connection that you have. It's looks more like the OP is interested in sharing a connection (i.e having a singleton or a connection pool with only one connection)
    It does also depend on the behaviour of the database
    in the background.
    Most databases have a time out for connections that
    are idle Not a problem. Most implementations of connection pools and applications which keeps a connection open have a timer which calls e.g. select * from dual (if you are using oracle) when the connection has been idle for X minutes.
    (some, like db2 on z/OS, even cancel
    connections, that are not idle, if they are open a
    certain amount of time or have reached a given limit
    of cpu seconds.)You would also have that problem if you had a connection pool with several connections.
    In essence: If you have no control over the time
    your application runs (and therefore your connection
    is open) or over type or the configuration of the
    database you are accessing, you can't do it.See above.
    The closest thing to what you want would be using
    PooledConnections, iif those are supported for the
    database you want to access.Not true.
    Kaj

  • How can I create a database connection to Cloudscape database in 9iJDeveloper?

    How can I create a database connection to Cloudscape database in
    9iJDeveloper?
    thanks.

    Hi,
    I assume you have a JDBC driver for Cloudscape.
    1. In the IDE System Navigator, expand the Connections Node.
    2. Right-click on the Database Connection and choose New
    Connection .. .
    3. Click pass the welcome screen.
    4. In Step 1, name your connection and choose "3rd party JDBC
    Driver"
    5. Follow the rest of the steps and provide username/password,
    class name and URL, test and you should be ready to go.
    Good luck.

  • Creating dynamic database connection (SQL server 2008) from Adf application

    Hello,
    I am creating an ADF Fusion Application. I use Jdev. 11.1.2.3.0 , WebLogic 10.3 and MS SQL server 2008 database. My question is that how can I create a database connection configuration file, now I connect to the database through hard coding, there should be a way to do this with sql server I think.
    my database name is : testDatabase
    my database username is : testUser
    my database password is : testPassword
    Anybody can help me please.
    Thanks,
    Shahe

    Hello Frank,
    The database schema is the same for all the users, but the location of the database differs, for example: I have set the hostname of the database to localhost because the database is installed on the local pc, but to other clients the database is installed on a managed server so in the hostname I should put the server's ip address or name. So I need an external file where I can set these options.
    Thanks,
    Shahe

  • Dynamic database connection using JNDI

    How to pass the userid and password in get the database connection in weblogic 8.1 app server?
    The following method throws exception while getting the database connection from oracle.
    DataSource.getConnection(String username,String password)
    Please advise if I need to use any other weblogic's method to get the dynamic connection. Every user of this application uses their own useid and password to connect to the database.
    Any help is appreciated.

    ANITA BERDIN wrote:
    Hi,
    I upgraded from WL8.1sp2 to sp4 and basically had to redo everything.
    But since my understanding is that all patches and fixes are already
    incorporated in this version, so I did not apply any patches. Now my
    application which was previously working is getting an error with my
    stateless session bean that I have not had before. This is the error
    I get: I wonder why I would get oracle.jdbc.driver.Accessor.isNull
    error now. Am I missing something in my install? Thanks for any help.
    at oracle.jdbc.driver.Accessor.isNull(I)ZAccessor.java:1682)
         at oracle.jdbc.driver.OracleStatement.wasNullValue()Z(OracleStatement.java:3026)
         at oracle.jdbc.driver.OracleResultSetImpl.wasNull()Z(OracleResultSetImpl.java:111)Hi. You should not have had to redo everything.... Yes, sp4 should contain
    most all of the patches you may have been running for sp2, except for any
    that you may have gotten fairly recently (found recently in sp2, but not
    fixed in time for sp4)...
    The exception above is an internal Oracle thin driver bug (it seems), so
    the difference between sp2 and sp4 may have to do with the version of Oracle's
    thin driver installed. If you want, you can try swapping out the sp4 version of
    the thin driver, and trying the one from sp2, or the latest from oracle etc.
    What is the full stacktrace of the exception? Is that it? No message?
    Joe
         at weblogic.jdbc.wrapper.ResultSet_oracle_jdbc_driver_OracleResultSetImpl.wasNull()Z(Unknown Source)
         at com.merial.wwppsv1.client.ejb.UserDetailListBean.getItems()Ljava.util.List;(UserDetailListBean.java:222)
         at com.merial.wwppsv1.client.ejb.UserDetailListBean_i8as44_ELOImpl.getItems()Ljava.util.List;(UserDetailListBean_i8as44_ELOImpl.java:99)
         at com.merial.wwppsv1.client.action.SearchMenu.execute(Lorg.apache.struts.action.ActionMapping;Lorg.apache.struts.action.ActionForm;Ljavax.servlet.http.HttpServletRequest;Ljavax.servlet.http.HttpServletResponse;)Lorg.apache.struts.action.ActionForward;(SearchMenu.java:76)
         at org.apache.struts.action.RequestProcessor.processActionPerform(Ljavax.servlet.http.HttpServletRequest;Ljavax.servlet.http.HttpServletResponse;Lorg.apache.struts.action.Action;Lorg.apache.struts.action.ActionForm;Lorg.apache.struts.action.ActionMapping;)Lorg.apache.struts.action.ActionForward;(RequestProcessor.java:484)
         at org.apache.struts.action.RequestProcessor.process(Ljavax.servlet.http.HttpServletRequest;Ljavax.servlet.http.HttpServletResponse;)V(RequestProcessor.java:274)
         at org.apache.struts.action.ActionServlet.process(Ljavax.servlet.http.HttpServletRequest;Ljavax.servlet.http.HttpServletResponse;)V(ActionServlet.java:1482)
         at org.apache.struts.action.ActionServlet.doGet(Ljavax.servlet.http.HttpServletRequest;Ljavax.servlet.http.HttpServletResponse;)V(ActionServlet.java:507)
         at javax.servlet.http.HttpServlet.service(Ljavax.servlet.http.HttpServletRequest;Ljavax.servlet.http.HttpServletResponse;)V(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(Ljavax.servlet.ServletRequest;Ljavax.servlet.ServletResponse;)V(HttpServlet.java:853)
         at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run()Ljava.lang.Object;(ServletStubImpl.java:1006)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Ljavax.servlet.ServletRequest;Ljavax.servlet..ServletResponse;Lweblogic.servlet.internal.FilterChainImpl;)V(ServletStubImpl.java:419)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Ljavax.servlet.ServletRequest;Ljavax.servlet.ServletResponse;)V(ServletStubImpl.java:315)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run()Ljava.lang.Object;(WebAppServletContext.java:6718)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Lweblogic.security.subject.AbstractSubject;Ljava.security.PrivilegedAction;)Ljava.lang.Object;(Optimized Method)
         at weblogic.security.service.SecurityManager.runAs(Lweblogic.security.acl.internal.AuthenticatedSubject;Lweblogic.security.acl.internal.AuthenticatedSubject;Ljava.security.PrivilegedAction;)Ljava.lang.Object;(Optimized Method)
         at weblogic.servlet.internal.WebAppServletContext.invokeServlet(Lweblogic.servlet.internal.ServletRequestImpl;Lweblogic.servlet.internal.ServletResponseImpl;)V(WebAppServletContext.java:3764)
         at weblogic.servlet.internal.ServletRequestImpl.execute(Lweblogic.kernel.ExecuteThread;)V(ServletRequestImpl.java:2644)
         at weblogic.kernel.ExecuteThread.execute(Lweblogic.kernel.ExecuteRequest;)V(Optimized Method)
         at weblogic.kernel.ExecuteThread.run()V(ExecuteThread.java:178)
         at java.lang.Thread.startThreadFromVM(Ljava.lang.Thread;)V(Unknown Source)

  • JPA using dynamic database connection

    Hello everybody.
    My current project requires JPA to use dynamic datasource connection. And I need to register the database connection implementation in JNDI. For the dynamic part, the idea is that if user A logs in, JPA should use A's id and pw to create a datasource connection. When user B logs in, JPA should use B's credentials to create a datasource connection instead. I poked around a bit in the forum and found out that DataNucleus supports Dynamic datasource for JPA.
    But, could any one tell me if JPA supports dynamic datasource connection out of the box? If it does, could you point me to some samples.
    Thanks!

    Hello,
    I am using an implementation of OpenJPA.
    I can now overwrite the database user id/password defined in a data source with Persistence.createEntityManagerFactory(name, props). However, the props (java.util.Map) needs openjpa.ConnectionUserName and openjpa.ConnectionPassword key/value pairs.
    My issue now is that the user authentication will be through LDAP, so I won't be able to know the password of any user ( therefore no value for openjpa.ConnectionPassword). I am wondering if there is any way that JPA can use LDAP for the data source authentication. I guess Datanucleus framework could probably do that, but is there any way other than using Datanucleus?
    Thank you.

  • I can't get a database connection.

    Background: I've already built two sites with databases using DW CS6, PHPMySQL, and the same hosting company, so I know they allow remote connections. (I'm developing using the remote host because I've never found a tutorial for how to move it all from local XAMPP to my host - but hey, it's been working fine so far.)
    I set up the database using CPanel Databases, added the user and password, no problem. Went into PHP MySQL and added a table, logged out and back in, the table is there as defined.
    In DW, I double-checked the testing server, tested the connection, and it connected successfully.
    Then I opened a page for editing and added a database connection (all as I had done on the previous two sites that work fine). I named the connection, entered the user, the password and tried to SELECT a database. No luck. HTTP Error 404. I manually added the database (the only one) and clicked test. Again no luck. HPPT Error 404.
    I double checked the testing server, double checked the DB information, and nothing seems to work.
    Any clue what I'm doing wrong? Thanks so much if you can help.

    UPDATE:
    Okay, this is really getting weird. As a typcial computer nerd, I know there are many roads to success, so if one doesn't work, try another.
    Trying a different solution, I opened a test.php page and wrote the following code:
    <?php
    echo "<p>Now testing database connection.</p>\n";
    $db_server = "localhost";
    $db_username = "mcsb831_mbradmin";
    $db_password = "***(redacted)***";
    $link = mysql_connect($db_server, $db_username, $db_password);
    if (!$link) {
        echo "Could NOT connect.<br />\n";
    }else{
        echo "Connected Successfully.<br />\n";
        mysql_close($link);
    I loaded the page to the server and guess what? I got the message "Connected Successfully."
    Hooray! Now I know the database server is running, and the database and user name and password are valid.
    I went to the DW MbrConnect01.php file (the name of the CONNECTION file that Dreamweaver creates when I tried to make the connection through DW), and verified the database name, user name, and password were correct -- I copied and pasted them from the code above to make absolutely certain there were no transcription errors. Here's that file:
    <?php
    # FileName="Connection_php_mysql.htm"
    # Type="MYSQL"
    # HTTP="true"
    $hostname_MbrConnec01 = "localhost";
    $database_MbrConnec01 = "mcsb831_members";
    $username_MbrConnec01 = "mcsb831_mbradmin";
    $password_MbrConnec01 = "***(redacted)***";
    $MbrConnec01 = mysql_pconnect($hostname_MbrConnec01, $username_MbrConnec01, $password_MbrConnec01) or trigger_error(mysql_error(),E_USER_ERROR);
    ?>
    And guess what?
    I GOT THE STINKING ERROR MESSAGE AGAIN!!
    (See previous post for the full text of the message.
    Yes, I checked the server using an FTP browser for the presence of the required files, and they are there.
    Does anyone have a clue what's going on here? I would absolutely love to use DW's DB automation tools, but none of them will work if I can't get a DW connection to work.
    I notice that my code uses mysql_connect while the DW-generated code uses mysql_pconnect (which is deprecated), could that be the culprit? How do I fix it if so?
    PLEASE, can someone help?

  • XSQL-007 Database connection error.

    I got following message when click sample heloworld.xsql:
    Oracle XSQL Servlet Page Processor 0.9.9.1 (Technology Preview)
    XSQL-007: Cannot acquire a database connection to process page.
    Invalid Oracle URL specified: OracleDriver.connect
    We're using RH Linux 6.1, Apache Tomcat 3.1 Beta and XSQL 0.9.9.1. The database connection string in XSQLConfig.xml is:
    <connection name="demo">
    <username>scott</username>
    <password>tiger</password>
    <dburl>jdbc:oracle:jdbc:@home:1521:home</dburl>
    <driver>oracle.jdbc.driver.OracleDriver</driver>
    </connection>
    null

    <dburl> as posted is incorrect.
    A sample that is correct for the JDBC thin
    driver is:
    <connection name="demo">
    <username>scott</username>
    <password>tiger</password>
    <dburl>jdbc:oracle:thin:@localhost:1521:xml</dburl>
    <driver>oracle.jdbc.driver.OracleDriver</driver>
    </connection>
    Note "jdbc:oracle:thin" and not "jdbc:oracle:jdbc"
    hope this helps.

  • XSQL-007: Database connection refused

    I am running Demos on JavaWebServer, IE 5.0, Oracle Lite database. When I am trying to access http://Computer:port/xsql/demo/helloworld.xsql
    it is giving me this error, any thoughts...
    XSQL-007: Cannot acquire a database connection to process page.
    Connection refused
    null

    Now my XSQLConfig.xml settings are:
    <connectiondefs dumpallowed="no">
    <connection name="demo">
    <username>SYSTEM</username>
    <password>234khan</password>
    <dburl>jdbc:Polite:POlite</dburl>
    <driver>oracle.lite.poljdbc.POLJDBCDriver</driver>
    </connection>
    <connection name="lite">
    <username>system</username>
    <password>manager</password>
    <dburl>jdbc:Polite:POlite</dburl>
    <driver>oracle.lite.poljdbc.POLJDBCDriver</driver>
    </connection>
    </connectiondefs>
    and I am getting this error:
    500 Internal Server Error
    The servlet named oracle.xml.xsql.XSQLServlet at the requested URL
    http://nw601250:8080/xsql/demo/helloworld.xsql
    reported this exception: java/util/HashMap. Please report this to the administrator of the web server.
    java.lang.NoClassDefFoundError: java/util/HashMap at oracle.lite.poljdbc.OracleConnection.(Unknown Source) at oracle.lite.poljdbc.POLJDBCDriver.connect(Compiled Code) at java.sql.DriverManager.getConnection(Compiled Code) at java.sql.DriverManager.getConnection(DriverManager.java:126) at oracle.xml.xsql.XSQLConnectionPool.newConnection(XSQLConnectionPool.java:256) at oracle.xml.xsql.XSQLConnectionPool.(Compiled Code) at oracle.xml.xsql.XSQLConnectionManager.getPool(XSQLConnectionManager.java:270) at oracle.xml.xsql.XSQLConnectionManager.getPool(XSQLConnectionManager.java:250) at oracle.xml.xsql.XSQLConnectionManager.getConnection(XSQLConnectionManager.java:63) at oracle.xml.xsql.XSQLPageRequestImpl.setConnectionName(XSQLPageRequestImpl.java:189) at oracle.xml.xsql.XSQLPageProcessor.process(Compiled Code) at oracle.xml.xsql.XSQLServlet.doGet(XSQLServlet.java:124) at javax.servlet.http.HttpServlet.service(HttpServlet.java:715) at javax.servlet.http.HttpServlet.service(Compiled Code) at com.sun.server.ServletState.callService(Compiled Code) at com.sun.server.ServletManager.callServletService(Compiled Code) at com.sun.server.ProcessingState.invokeTargetServlet(Compiled Code) at com.sun.server.http.HttpProcessingState.execute(Compiled Code) at com.sun.server.http.stages.Runner.process(Compiled Code) at com.sun.server.ProcessingSupport.process(Compiled Code) at com.sun.server.Service.process(Compiled Code) at com.sun.server.http.HttpServiceHandler.handleRequest(Compiled Code) at com.sun.server.http.HttpServiceHandler.handleRequest(Compiled Code) at com.sun.server.HandlerThread.run(Compiled Code)
    I hope this would be the final step. Please reply thanks
    null

  • Can JDBC specify dynamic Database

    Now we have two DB2 database, with different IP address.
    One of those is running in normal situation, if it is down, the other will automatically start.
    Why this happened, how can the XI get information from the other DB? Is it possible to specify dynamic database destination in JDBC Adapter?
    Thanks in advance.

    Hi YiNing,
    look at my answers in
    Re: JDBC Problem in a Productive Sys!!!
    There is also a further link to a similar problem.
    Regards Mario

  • Can i change the database connections through MAXL Scripts?

    Hi,
    just want to know whether i can change the database connections through MAXL Scripts. i am using essbase 9.3.1.

    Hi John,
    I have built my rulefile by connecting to a database & now i want to change the database connections. I know i can change the database connections through frontend. ( File--> open file). I want to know whether i can change the database connections by writing any MAXL Scripts.

  • Dynamic database connections at Runtime dbAdapter

    Hi
    I need to connect to a database defined a runtime in a BPEL process using the dbadapter. All the configuration parameters for making the connection are provided at runtime (connectionURL, User, Password) and i need a way to configure them in the dbAdapter make the connection and execute some SQLStatements.
    Until now we were testing with some bpelx Properties changing dynamically the name of the jndi (jca.jndi) that works fine, but we cant define a datasource for every database. We also tried with another set of properties for setting the connection at runtime (jca.mcf.ConnectionString, jca.mcf.Password,jca.mcf.UserName) unsuccessfully.
    Do you know a way to define connections parameters at runtime in dbAdapter? Is that possible with SOA version 11.1.1.6 ?
    If this is not possible what alternative do you suggest for making dynamic connections to a database.?
    Regards
    Sergio

    You can try using the function query-database and formulate the 4th parameter which is JDBC connect string at runtime.
    oraext:query-database()
    Returns a node-set by executing the sql-query against the specified database. The second parameter rowset indicates if the rows should be enclosed in a element. The third parameter row indicates if each row should be enclosed in a element. The fourth parameter datasource is either a JDBC connect string (jdbc:oracle:thin:USER-NAME/PASSWORD@HOST:PORT:SID) or a JNDI name for the database. Only Oracle Thin Driver is supported if JDBC connect string is used. Usage: oraext:query-database(sqlquery as string, rowset as boolean, row as boolean, datasource as string). Example: oraext:query-database('select last_name from employee where id=1234',false(),false(),'jdbc:oracle:thin:scott/tiger@localhost:1521:ORCL'.
    This does not require a database adapter .

  • Can't create a database connection

    I've downloaded and installed a trial version of BusinessObjects Edge BI to see if my company should use it, but I'm having a problem figuring out how exactly to create a connection to a database.  I've used the Windows (I'm running Windows 7) ODBC tool to create a connection to a PostgreSQL 8.4 database server, and can use Excel and a trial of Crystal Reports 2011 to run queries against it, so I don't believe the problem is with the ODBC connection.  I've read as much as I could of the documentation and guides and tutorials on this site, and I'm pretty sure that I first need to create a universe in which I then create a connection to the database; I keep being referred to the Information Design Tool (IDT), but I can't seem to find it on my machine. So my questions are:
    1) Am I pointed in the correct direction, or do I need to be looking in a completely different place to create a connection?
    2) Is this Information Design Tool a desktop application? (if so, where should it have been installed?) or a webapp? (if so, what is the url?)
    3) Is this tool not included with the trial version of the software? (if so, is there a way to connect to a database with the trial version?)
    Any help at all would be most appreciated.  Thanks.

    Hi
    Could you please let me know if you have created that odbc connection for crystal report  in 32bit ODBC driver or 64 bit ODBC driver
    If your using 64bit odbc driver for that crystal report, then please change the ODBC driver connection to 32 bit ODBC driver and test the issue
    Regards,
    Raja

  • SSIS - Make a "dynamic" database connection tutorial (step-by-step) ?

    I want to make one connection ONLY to loop over a list of servers. This connection should be able to connect to databases located on different servers ie different IP addresses. After connecting to a database, it should run some SQL code. The result set
    of this code should be transferred to a central database. After that, it should do the same for another server.
    Can someone give me a step by step tutorial to do this ? I want hand holding/spoon feeding tutorial because no tutorial on the net worked for me so far. 
    Tutorials i tried , but did not work -
    http://www.rafael-salas.com/2010/01/ssis-loop-through-multiple-database.html
    http://www.codeproject.com/Articles/14341/Using-the-Foreach-ADO-Enumerator-in-SSIS
    and many others which i cannot even remember. NONE of them are step by step. I have also not found a SINGLE book which covers this. All books only loop through files, but not through remote databases.
    I need your help.
    Thanks

    Please see if these help -
    http://www.sanssql.com/2011/08/looping-through-sql-servers-using-ssis.html
    https://www.simple-talk.com/sql/ssis/consolidating-sql-server-error-logs-from-multiple-instances-using-ssis/
    http://sql-ution.com/dba-repository-create-the-server-list/
    - Aalam | (Blog)
    1st one not good. Many steps are missing. Cannot understand than one. Will try the others also.

  • Can't disconnect from database connection

    Hello,
    One of our application has been running for over a year on a client network, a windows desktop executable connected to an Oracle Standard One Edition, rel. 10.1.0.2., on a Linux server. Now the executable hangs when the users exit the app. It is build using Oracle Objects For OLE and the culprit is the close method of the ODatabase object. Strangely however, we found out that other applications can’t disconnect anymore:
    Both SQL*Plus and Toad will hang when exiting.
    Also, doing a connection test with the Net Manager hangs when a valid login is used. If I put an non-existing user or a locked one (scott/tiger for example), the server does report the problem.
    I've enabled local client tracing on a user desktop but there are no errors reported, which makes sense since it seems like nothing is coming back.
    The network admin over there swears nothing has change on the network config. So I’m hunting possible cause for this. There are several logs file cluttering up disk space in various folders and this file:
    /home/oracle/OraHome_1/sqlnet.log is now up to 3.1 Mb. I believe I can safely delete this one from other messages I found in various newsgroup. I would be surprise however that disk space is the problem since the windows app works fine, doing query in SQL*Plus works fine. (I only tried Toad to check the disconnect “feature”, not familiar with this tool, but it was showing the schema correctly)
    As a developper, I am however curious on whats happening when a disconnect is sent to the server and what are the expected responses, which don’t seem to be coming back anymore. It really looks like some packets are lost on their way back.
    Thanks in advance,
    Eric

    Many thanks! You hit the problem right on!
    Oddly, I can't even drop or disablee the trigger, SQL*Plus freeze. The network admin will perform a shutdown tonite when nobody is using the software. I'll see if I can drop it then.
    Regards,
    Eric

Maybe you are looking for