About jdbc url question

the questions:
i want to make a connect to mysql database sever.
i use jdbc:odbc dirver
and it works like following;
String url = "jdbc:odbc:mysql_dsn";
..here i define mysql_dsn in windows control panel->ocbc
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
i want to ask if i want to use an other URL format
like
jdbc:odbc://localhost:3306/mysql
it does not work!
please be kind to answer the question.it confuse me for a long time.
and if possible please give me more example for the URL format..
thanks in advance.
niko

In your particular case (where you're using the JDBC/ODBC bridge), the java pieces don't have any knowledge about how your real driver (the ODBC driver) connects to the database. Java doesn't know if there is a file-based DB (like MS Access or Paradox) or a Server database (such as SQL Server) behind the bridge. What java (or the bridge) DOES know is how to 'talk ODBC'. Even then, the BRIDGE doesn't know all the settings for the ODBC driver (only the driver itself knows, because it pulls it from the DSN configuration).
You might be able to tweak the connection by using the Properties object that you pass along, as the bridge may pass these to the ODBC driver and you might be able to override the DSN settings.

Similar Messages

  • A JDBC url question

    Hi
    I use the url jdbc:odbc:mydb.mdb to connect to database locally.
    Now I need to access the machine remotely.
    The ip of the machine is 192.168.0.7
    What is the url I need to use to connect to the machine.
    Thanks

    What is the url I need to use to connect to the machine.There is no such url.
    You can't connect to MS Access 'remotely'. MS SQL Server and Oracle (to name two) are 'server' application databases. When you set those up, a program runs on the server machine. And a jdbc driver (or any driver) connects to those machines and talks to the application.
    MS Access does not have an application that runs. When you use ODBC the driver interacts with the file directly - which is why you have to specify the file name.
    So your choices are:
    -Use a different database.
    -Expose the file the network (this is a REALLY BAD idea for the internet.) Basically you share the directory where the file. Each client must have a mapped drive. Each client machine will have to have MS Access or something else which provides the MS Access ODBC driver (which is not part of java.)
    -Use a proxy solution. You can get a commercial version of that via the sun jdbc driver search or you can use RmiJdbc which is free (search this site for that name to find the url.)

  • ####a question about jdbc driver

    A question about jdbc driver: for Oracle JDBC drivers which will not allow O/R
    tools to access columns over 4 kb. This affects some of the functionality of my
    application.A workaround is to use the my JDBC driver that acts as a wrapper to
    ensure that columns over 4 kb read and persist properly. my JDBC driver determines
    which actual driver to load based on the connection URL. If you pass in a URL
    that contains the string jdbc:oracle:thin, it will know to load oracle.jdbc.driver.OracleDriver.
    If the URL contains the string jdbc:db2, it will know to load COM.ibm.db2.jdbc.net.DB2Driver,
    and so on.
    now i have set CLASSPATH for my jdbc wapper,when I Creating and Configuring a
    JDBC Connection Pool,i have to input my driver name such com.lawrence.driver.....then
    i did,all
    is well,then i restart my WLS,when load config.xml,some errors such as "No registered
    driver accept URL:jdbc:oracle:thin:@localhost:1521:lawrence",if i set driver name
    is oracle.jdbc.driver.OracleDriver,all is good,no any errors.
    I find some questions like:
    1.for WLS8.1 ,it is only find some registed driver?
    2.why it cannot load my driver wapper when it is loading jdbc Connection Pool,but
    when the WLS start is finished, i Creating and Configuring a JDBC Connection Pool
    then it is right?

    my JDBC driver like this:
    public class myDriver implements Driver {
         public static String DB2_DRIVER = "COM.ibm.db2.jdbc.net.DB2Driver";
         public static String DB2_URL = "jdbc:db2:";
         public static String HYPERSONIC_DRIVER = "org.hsqldb.jdbcDriver";
         public static String HYPERSONIC_URL = "jdbc:hsqldb:";
         public static String MYSQL_DRIVER = "com.mysql.jdbc.Driver";
         public static String MYSQL_URL = "jdbc:mysql:";
         public static String ORACLE_DRIVER = "oracle.jdbc.driver.OracleDriver";
         public static String ORACLE_URL = "jdbc:oracle:";
         public static String POSTGRESQL_DRIVER = "org.postgresql.Driver";
         public static String POSTGRESQL_URL = "jdbc:postgresql:";
         public static String SQLSERVER_DRIVER =
              "com.microsoft.jdbc.sqlserver.SQLServerDriver";
         public static String SQLSERVER_URL = "jdbc:microsoft:";
         public boolean acceptsURL(String url) throws SQLException {
              return true;
         public synchronized Connection connect(String url, Properties props)
              throws SQLException {
              if (_driver == null) {
                   Class driverClass = null;
                   try {
                        if (url.startsWith(DB2_URL)) {
                             driverClass = Class.forName(DB2_DRIVER);
                        else if (url.startsWith(HYPERSONIC_URL)) {
                             driverClass = Class.forName(HYPERSONIC_DRIVER);
                        else if (url.startsWith(MYSQL_URL)) {
                             driverClass = Class.forName(MYSQL_DRIVER);
                        else if (url.startsWith(ORACLE_URL)) {
                             driverClass = Class.forName(ORACLE_DRIVER);
                        else if (url.startsWith(POSTGRESQL_URL)) {
                             driverClass = Class.forName(POSTGRESQL_DRIVER);
                        else if (url.startsWith(SQLSERVER_URL)) {
                             driverClass = Class.forName(SQLSERVER_DRIVER);
                        _driver = (Driver)driverClass.newInstance();
                   catch (Exception e) {
                        throw new SQLException(e.getMessage());
              Connection con = _driver.connect(url, props);
              return new myConnection(con);
         public int getMajorVersion() {
              return _driver.getMajorVersion();
         public int getMinorVersion() {
              return _driver.getMinorVersion();
         public DriverPropertyInfo[] getPropertyInfo(String url, Properties props)
              throws SQLException {
              return _driver.getPropertyInfo(url, props);
         public boolean jdbcCompliant() {
              return _driver.jdbcCompliant();
         private Driver _driver;

  • Jdbc.url newbie question

    Hi there,
    Apologies for this very begginerish question.
    I have been working with oracle in college for the last year. Have been conecting from java using these settings
    jdbc.driver=oracle.jdbc.driver.OracleDriver
    jdbc.url=jdbc:oracle:thin:@nc-oracle-2.students.collegename.ie:1521:orcl
    jdbc.username=username
    jdbc.password=password
    I am trying to finish up project at home for the weekend and have installed oracle 9.20.10.
    I am not sure what these settings should be or how to find out. I have user name and password set up and can work away in sqlplus. How do I find out what the jdbc.url is?
    Thanks in advance
    stuart.

    thanks, I ran those commands and now have this
    jdbc.url=jdbc:oracle:thin@localhost:1521:stuart
    When I run my app I am getting this message:
    java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
    Any suggestions?
    Message was edited by:
    newbie101
    Message was edited by:
    newbie101
    Message was edited by:
    newbie101

  • Wrong SID in JDBC URL

    Hi all,
    I'm developing a java program in OAF context to generate a pdf from a xdo data template and template. this is already working, there is only one issue.
    The DataProcessor needs a connection, therefore I've specified hardcoded a JDBC URL.
    Connection conn = DriverManager.getConnection("jdbc:oracle:thin:apps/apps@(DE.............");
    and then pass conn to the DataProcessor.
    dataprocess.setConnection(conn);
    But i want to get rid of this hardcoded connection.
    So I did the following:
    OAApplicationModuleImpl am = (OAApplicationModuleImpl)pageContext.getRootApplicationModule();
    String JDBCURL = am.getOADBTransaction().getConnectionMetadata().getJdbcURL();
    System.out.println(JDBCURL");
    as result a wrong connectionstring: ....com)(PORT=1533)))(CONNECT_DATA=(SID=1533)))
    he takes for SID the port number....
    questions I have:
    - the way I work is correct?
    - where does he gets his jdbc url from? becuase I already checked my database in jdev and it works (with correct SID) and also my dbc file is correct...
    Thanks in advance!
    Stijn

    Stijn ,
    You can get connection from OADBTransactionImpl in AM.Here is the sample code:
    import oracle.apps.fnd.framework.server.OADBTransaction;
    import oracle.apps.fnd.framework.server.OADBTransactionImpl;
    import oracle.jdbc.driver.OracleConnection;
    OADBTransactionImpl oadbtransactionimpl = (OADBTransactionImpl)getOADBTransaction();
    OracleConnection conn = (OracleConnection)oadbtransactionimpl.getJdbcConnection();
    --Mukul                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • JDBC URL problem

    hello to all!
    Im a newbie in database programming using JDBC. I would like to ask for the format of URL of Sun's JDBC. I would also would like to know if it is possible to create a database from native java code. that would be my questions for now.
    jeff

    I would like to ask for the format of URL of Sun's JDBC. Depends on the DB and the JDBC driver used. If you use for example a MySQL DB [1] with the MySQL's own Connector/J driver [2], then the JDBC URL format is: jdbc:mysql://localhost:3306/databasename [3].
    [1] http://www.mysql.com
    [2] http://www.mysql.com/products/connector/j/
    [3] http://dev.mysql.com/doc/refman/5.0/en/connector-j.html
    I would also would like to know if it is possible to create a database from
    native java code.Java EE 5 provides JPA, the Java Persistence API [4].
    [4] http://java.sun.com/javaee/overview/faq/persistence.jsp

  • Trying to switch from JDBC URL - JDBC DataSource

    I have built and run a JHeadstart 10.1.2 application using JDBC URL defined database connections.
    I am now trying to switch to use JDBC DataSource definitions to make the database connection independant from the application so that the same ear file can be deployed to different application servers (dev vs test environments).
    I have tried changing the Connection Type of the Business Component:
    Configurations > Edit > Connection Type
    from the previously defined JDBC URL to a JDBC Datasource defined within the embedded OC4j Application server. After making the change, rebuilding and restarting the server it still retrieves information from the previously defined URL.
    Is there something I need to regenerate/rebuild/reconfigure?
    Thanks,
    Kevin

    Hi Steven,
    I've seen that article. It's quite detailed and certainly helped until I ran into a VerifyError something like:
    java.lang.VerifyError: (class: oracle/ord/im/OrdDocBase, method: create signature: (Loracle/ord/im/OrdDocBase;Loracle/sql/Datum;I)Loracle/sql/CustomDatum;) Incompatible object argument for function call at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:140) at oracle.jheadstart.util.BindingUtils.class$(BindingUtils.java:66) at oracle.jheadstart.util.BindingUtils.isIntermediaBinding(BindingUtils.java:169) at oracle.jheadstart.controller.strutsadf.action.JhsDataAction.setBindingInputHandlers(JhsDataAction.java:1159) at oracle.jheadstart.controller.strutsadf.action.JhsDataAction.processUpdateModel(JhsDataAction.java:622) at oracle.adf.controller.struts.actions.DataAction.processUpdateModel(DataAction.java:508) at oracle.adf.controller.lifecycle.PageLifecycle.handleLifecycle(PageLifecycle.java:112)
    I found this forum posting helped me...
    Re: JHeadstart Deployment Issue
    I couldn't run the application in a standalone instance of oc4j 9.0.4 even after following the deployment instructions found in this and other posts. It wasn't until I came upon a JavaWorld article from 2001 about VerifyError...
    http://www.javaworld.com/javaworld/jw-06-2001/jw-0615-howto.html
    I added -noverify to the startup arguments and the application ran fine.
    I admit I am a little concerned that I need to run without jar verification. Have you seen this before? Is there another way to deal with this?
    thanks,
    Kevin

  • Can't use JDBC URL for multiple LDAPs

    ColdFusion 8,0,1,195765 Enterprise (Trial)
    We use Oracle OID (LDAP) instead of tnsnames.ora to resolve database connection strings. This is how I specify one LDAP JDBC URL. On the CF admin page, Server Settings, Java and JVM, ColdFusion Class Path is set to C:\oracle\product\10.2.0\db_1\jdbc\lib\ojdbc14.jar. Under Data & Services, Data Sources, create a new source. Set JDBC URL to
    jdbc:oracle:thin:@ldap://mdaoid1.mycompany.com:389/mdad2,cn=OracleContext,dc=mycompany,dc= com
    where mdaoid1 is one of the two Oracle OID servers that resolve connection strings, and mdad2 is an entry in the two OID's sync'ed to each other. That works.
    According to many sources based on Google search for "space separated LDAP URLs", I should be able to add another LDAP server separated by space. Now I append " ldap://mdaoid2.mycompany.com:389/mdad2,cn=OracleContext,dc=mycompany,dc=com" (no quotes, added to indicate leading space) to that string. Upon clicking Submit, I get
    Connection verification failed for data source: orcl10g3
    java.sql.SQLException: For input string: "389 ldap:"
    The root cause was that: java.sql.SQLException: For input string: "389 ldap:"
    (orcl10g3 is the CF data source name I'm creating) Some say I need to replace space with %20 in the double LDAP URL. With %20, I get error
    Connection verification failed for data source: orcl10g3
    java.sql.SQLException: Io exception: JNDI Package failurejavax.naming.InvalidNameException: Invalid name: mdad2,cn=OracleContext,dc=mycompany,dc=com ldap://mdaoid2.mycompany.com:389
    The root cause was that: java.sql.SQLException: Io exception: JNDI Package failurejavax.naming.InvalidNameException: Invalid name: mdad2,cn=OracleContext,dc=mycompany,dc=com ldap://mdaoid2.mycompany.com:389
    Question: How do I add more than one LDAP server to the JDBC URL so I can achieve failover and load balance?
    Yong Huang
    yong321 at yahoo.com

    The message above was posted by me two years ago and was brought to my attention today. Here's a short update: The network team added a load balancer mdaoid in front of, and resolved to, mdaoid1 and mdaoid2 (in round-robin fashion). The problem described in this thread is bypassed because the JDBC URL can simply use one-OID format, in which mdaoid is used as the LDAP server.

  • Jdbc urls and when does load balancing and failover work?

    I you use a jdbc url with OracleDriver not OracleDataSource because we use dbcp for our connection pooling. What can we expect by putting in two connection descriptors one for each host when an 11g RAC node goes away?
    I know all about ONS and FCF etc but when you are not using OracleDataSource and friends what benefit is there is having mulitple hosts in the jdbc url?
    What is that recognises the other host in the jdbc url when a RAC node goes away? Is that integral to OracleDataSource or anything outside of OracleDriver?
    right now we only have one HOST = in your jdbc url but I'm not sure how we would benefit by adding the second if we are not using OracleDataSource.

    Best I can suggest - step up and become the expert.
    You are dealing with RAC which most people do not have and do not use (based on postings I have seen) so you already have that advantage.
    The dbcp pool doesn't mean anything since it just acts as a wrapper around the Oracle driver.

  • Deployment using JDBC DataSource instead of JDBC URL

    Hello,
    I've noticed some strange behaviour when deploying an ADF application (11g, latest release) to a WLS (integrated or stand-alone), when using JDBC DataSource as a connection type for the application module.
    Normally, when you create your Business Components, a Database Connection is added to the Application Resources panel, eg MyConnection. If you then set your AM to JDBC DataSource instead of JDBC URL, the default datasource would be jdbc/MyConnectionDS. To make the application use the DataSource defined on the WLS, I then uncheck "Auto Generate and Synchronize weblogic-jdbc.xml Descriptors during deployment" in the Application Properties > Deployment tab.
    So far so good: after deployment to the WLS, the application uses the DataSource defined on the WLS server (jdbc/MyConnectionDS). When changing it on the server to another database, the application indeed uses this other database. Also, the following is automatically added to the web.xml during deployment to .ear file:
      <resource-ref>
        <res-ref-name>jdbc/MyConnectionDS</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <res-auth>Container</res-auth>
      </resource-ref>Now the part that doens't make sense to me: if I delete the password in the Database Connection under Application Resources, I can still deploy the application, but the jdbc/MyConnectionDS on the WLS is not found anymore. While it is still there. I get the following error message:
    Unable to lookup Data Source at context java:comp/env/jdbc/MyConnectionDS
    oracle.jbo.DMLException: JBO-27200: JNDI failure. Unable to lookup Data Source at context java:comp/env/jdbc/MyConnectionDS
    I made the JDev connection (used at development) invalid, and the deployed application stops working (at runtime). While it should just be using the JDBC DataSource defined on the WLS, that is still there. The reason appears to be that when there is no password in the Database Connection in JDev, the entry in the web.xml (see above) is not made during deployment.
    I am doing something wrong? Or is this "expected" behaviour?
    The reason why it bothers me: I have made a reusable component (a Data Control, let's call it A) from a model project, by deploying it to a ADF library JAR. I've set the AM of this project to use a certain jdbc datasource, which will be defined on the WLS.
    When importing the library JAR of A inside another application (B), the connection of the A is added to B. But ofcourse, without the password for security reasons, so we're in the situation described above: When I deploy the new application B, the web.xml is not updated with the DataSource of A, and the application doens't work. And what I would like to avoid, is that whenever someone uses component A, that they have to update the connection details of component A in application B. Because when I fill in the password of application A's Database Connection in application B, all works well again.
    I hope this question makes sense. :-)
    Thanks in advance,
    Chris

    Arun and Krithika,
    Thanks for your replies. I have already done what both of you suggested:
    Chris Schryvers wrote:
    I then uncheck "Auto Generate and Synchronize weblogic-jdbc.xml Descriptors during deployment" in the Application Properties > Deployment tab.I can get it to work, both for deployment on the internal WLS as on a stand-alone WLS.
    My only question is: why does a property at development time (the empty password of the JDev connection) influence the runtime behaviour (the JDBC DataSource not being found after deployment).
    Ofcourse, setting the password for the connection in JDev "solves" the problem. But I want to avoid that everyone who uses the reusable component needs to fill in the password for its database connection. In my opinion, that's the whole point of using a JDBC datasource instead of a JDBC URL: the reusable component just states that there needs to be a jdbc/MyConnectionDS on the server and it can be used as is. Wihtout any modifications at development time.
    What's more:
    Suppose I import the reusable JAR and its connection is added to JDev, without password.
    *) Leaving the password empty: DS not found after deployment (web.xml not adjusted, as mentioned in my original post)
    *) Entering the correct password: DS found, web.xml adjusted at deploy time.
    *) Entering an incorrect password: DS found, web.xml adjusted at deploy time.
    It even works when I enter an incorrect password, which proves that the JDBC DataSource on the server is used, instead of the JDev connection. Then why is the web.xml not adjusted when the password remains empty?
    Arun, I'll check the documention that you linked to, but this just seems like an weird decision in the implementation of JDev/ADF. :-)

  • Creating a service ; What needs to be added to tnsnames.ora and JDBC url?

    DB version: 11.2.0.2
    OS platform : Solaris 10
    We have a 2 node RAC.
    DB name   = mbsprd
    Instance1  = mbsprd1
    Instance2  = mbsprd2I want Instance 1 (mbsprd1) to be used for our OLTP application and Instance 2 (mbsprd2) to be used for another application of DSS nature.
    Based on the syntax
    srvctl add service -d <dbname> -s <ServiceName> -r <Preferred Instance> -a <Available Instance>I am going to create 2 services
    -- Creating a service called OLTP
    srvctl add service -d mbsprd -s OLTP  -r mbsprd1 -a mbsprd2-- Creating a service called DSS
    srvctl add service -d mbsprd -s DSS  -r mbsprd2 -a mbsprd1-- Starting the services
    srvctl start service -d mbsprd -s OLTP
    srvctl start service -d mbsprd -s DSSI guess the above steps are enough to configure a service at the server side.
    I would like to know what needs to be done at the client side.
    Currently the tnsnames.ora file and JDBC url used by our clients are shown below. What needs to be added to tnsnames.ora file and jdbc URL to start using services configured above?
    -- SCAN based TNS entry
    mbsprd =
      (DESCRIPTION =
        (ADDRESS_LIST =
          (ADDRESS = (COMMUNITY = tcp.world)
            (PROTOCOL = TCP)(Host = p148149-scan.tpam.net) (Port = 36964))
        (CONNECT_DATA =
          (SERVER       = DEDICATED)
          (SERVICE_NAME = mbsprd)
          (FAILOVER_MODE=(TYPE=SELECT)(METHOD=BASIC))
    -- TNS entry based on local listener
    -- Instance 1
    mbsprd1 =
    (DESCRIPTION =
       (ADDRESS_LIST =
       (ADDRESS =(PROTOCOL = TCP)(HOST = hsolarp148-vip)(PORT = 36973))
       (CONNECT_DATA =
             (SERVICE_NAME = mbsprd)
             (INSTANCE_NAME = mbsprd1)
    -- Instance 2
    -- TNS entry based on local listener
    mbsprd2 =
    (DESCRIPTION =
       (ADDRESS_LIST =
       (ADDRESS =(PROTOCOL = TCP)(HOST = hsolarp149-vip)(PORT = 36973))
       (CONNECT_DATA =
             (SERVICE_NAME = mbsprd)
             (INSTANCE_NAME = mbsprd2)
    )JDBC entry for RAC
    jdbc:oracle:thin:@p148149-scan.tpam.net:36964:mbsprd -- Alternative version used by some clients because the above had 'some issues'
    jdbc:oracle:thin:@(DESCRIPTION=(LOAD_BALANCE=on)(ADDRESS=(PROTOCOL=TCP)(HOST=p148149-scan.tpam.net) (PORT=36964))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=mbsprd)(FAILOVER_MODE =(TYPE = SELECT)(METHOD = BASIC)(RETRIES = 180)(DELAY = 10))))

    OLTP =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = p148149-scan.tpam.net)(PORT = your_port_number))
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = OLTP)
    DSS =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = p148149-scan.tpam.net)(PORT = your_port_number))
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = DSS)
      )JDBC entry for RAC
    jdbc:oracle:thin:@p148149-scan.tpam.net:36964:service_name
    jdbc:oracle:thin:@new_tns_entry_description(if you would like to connect the database with particular service)
    try this and let us know any issues,

  • Driver Class name and JDBC URL Format

    Hi,
    I'm trying to use the oracle jdbc driver to connect to an (what a surprise) oracle database.
    I need a 'driver class name' and the JDBC URL Format. But I cannot find these anywhere.
    Can anyone help me out here?
    Regards,
    Laurens

    http://myjdbc.tripod.com/basic/jdbcurl.html

  • Dynamic JDBC URls at Runtime

    Hi Experts,
    I did my application in jdev 11.1.1.6 and deployed using Jdbc Url connections and it worked successfully (Actually I m working with 2 diff Database connectiosn in my application)
    But the thing is my company need me to do something like I should be able to dynamically use Jdbc url connections at runtime so that they want to have QA db and PROD db inside the application
    and dynamically change them itseems. (i.e I will have 4 Db in which 2 for QA and 2 for PROD)
    Is there a way where I can achieve them. If so help me out.
    Thanks,
    933601

    Hi,
    You could store the database URLs in a properties file in the app server filesystem, then look them up in the dynamic JDBC code before setting the session attributes. So your QA app server has a properties file containing the URLs for the 2 QA databases and the PROD app server has a properties file containing the URLs for the 2 PROD databases.
    If you want a single app server to talk to multiple sets of databases you could pass a parameter to the login screen. Based on this you decide which database(s) to connect to.
    Kevin

  • REDIRECT JDBC URL WHEN USING DYNAMIC JDBC CREDENTIALS SO NOT HARDCODED

    I have taken over an application that uses row-level security and ADF (using
    dynamic JDBC Credentials). I have been able to set the internal_connection to
    a JDBCDatasource, but cannot set the Connection Type in the Oracle Business
    Component Configuration to a JDBCDatasource. When I do, I receive errors that
    tables are not found. When I set the value back to a JDBC URL, everything
    works fine again.
    I am looking for a solution where the userid and password are not hardcoded in
    the BC4J.xcfg or a way to redirect this information, as we change our system
    passwords every nighty days. Otherwise, I will have to redeploy the
    application every nighty days.
    I did not create this application, but I am sure that you could simply follow
    the "How to Support Dynamic JDBC Credentials" article. From that point, you
    will probably be where I am, where I have the internal_connection set to a
    JDBCDataSource and working properly, but cannot set the Connection Type to
    anything where the userid and password will not be hardcoded or cause failure.
    I wanted to let you know that I have
    found the updated How to Support Dynamic JDBC Credentials
    (http://www.oracle.com/technology/products/jdev/howtos/bc4j/howto_dynamic_jdbc.h
    tml) and was going to run through the "Advanced: Supporting Dynamic JDBC URLs",
    but once I was done keying in
    env.remove(ConnectionStrategy.DB_CONNECT_STRING_PROPERTY); I received a
    depreciation message on the DB_CONNECT_STRING_PROPERTY. (Note: I am coding in
    JDeveloper 10.1.3, so this may be depreciated as of then, but the ADF Libraries
    for JDeveloper 10.1.3 are on our Oracle 10gAS 10.1.2 server.)
    I thought maybe this would resolve my issue, but I can't be sure as the
    deprecation message leads me to believe that this solution may not be viable in
    the future.
    UPDATE
    =======
    The article you are referencing is definitely an older version.
    There is a newer article for 10g at:
    http://www.oracle.com/technology/products/jdev/howtos/10g/dynamicjdbchowto.html
    Please see if that helps.
    I have already reviewed this article.
    In fact, I have reviewed many versions of this document. I have not seen one
    created yet for 10.1.3 though (especially without JSF as our 10.1.2 AS server
    will not support it). I need to find an example or documentation that shows
    how we can keep from having the JDBC URL stored in the BC4J.xcfg or a way to
    use dynamic JDBC credentials with a JDBCDataSource. We do not want to store
    the userid and password in the application, rather, we would like to setup
    something that can be configurable from the application server.
    I think we need to use the dynamic JDBC credentials because we are using the
    row-level security, where we setup a database context for the user and only
    allow certain records of a database table to be returned to the browser based
    on that context.
    Might there be a way to still use the JDBCDataSource?

    I understand that the user provides the userid and password and that these values are setup using the Configuration class.
    However, when I am to deploy the ADF Business Module with my application, I have to specify either a JDBC URL or a JDBC DataSource in the Oracle Business Component Configuration.
    When I use JDBC DataSource, the code does not work properly, almost like the user's credentials are not used for the connection (I get errors like table or view does not exist).
    When I use the JDBC URL, the bc4j.xcfg stores a reference in the JDBCName attribute to a ConnectionDefinition in the same file. It is in this tag of the bc4j.xcfg where the userid, sid, and password (encrypted) is stored and used when retrieving the initial context of the ADF business components.
    It is these values that I want to have stored else where so that the application does not have to be redeployed in order for the password (or sid, or other connection information) to be change.

  • Strange problem with JDBC URL

    Hi All,
    I don't know whether this is a known issue which has a workaround or I am doing something wrong. But this is the problem.
    I have a nice GUI application which takes the JDBC URL, Driver, User name and password and then takes the input and tries to establish a connection with the Database. I was trying it on MySQL and I encountered a problem.
    The general format of the JDBC URL for MySQL is "jdbc:mysql://<ip_address>:<port>/<db_name> and if I have MySQL running on 3306 and if I give the URL as:
    "jdbc:mysql://localhost:9001" (where my HSQL is running), then, it never gets the connection and the application stays there forever (the call never returns after the DriverManager.getConnection() statement). And if I give the port as something else (say 9898) where nothing is running, then the getConnection() doesn't send me a SQLException.
    What could be the problem?

    Are you saying that you're connecting using the
    MySQL driver to an HSQL database, and
    that this results in a hang (rather than a timeout)?
    Just to clarify that I've understood the problem.
    If so, it should be fairly easy to get a simple test
    scenario up and running independent from your "real"
    application. Have you tried this, and could you post
    the code if so?
    Dave.Hi Dave,
    Thank you very much trying,
    Sorry if my English was poor. I am not trying to connect to HSQLDB using the MySQL Driver.
    Actually, I am trying to connect to MySQL db using the MySQL driver, but the DriverManager.getConnection() method hangs when I...
    1. Give a wrong URL e.g(jdbc:mysql://localhost:9001/")
    2. Run my MySQL on default port (3306)
    3. And If I have HSQL or any other program that is listening at port 9001.
    The problem seems to be very strange. here's the code below, you can try out yourself...
    import java.sql.DriverManager;
    import java.sql.SQLException;
    public class Demo {
         public static void main(String[] args) {
              try {
                   Class.forName("com.mysql.jdbc.Driver");
                   DriverManager.getConnection("jdbc:mysql://localhost:9001/", "user", "password"); // <-- The call hangs here
              } catch (SQLException e) {
                   e.printStackTrace();
              } catch (ClassNotFoundException e) {
                   e.printStackTrace();
    }Remember to have your mysql*.jar file in your classpath while running. :)
    Thank you....

Maybe you are looking for