Jdbc URL & connections properties

Hello all,
i would know if it is possible to add connection properties in a jdbc URL ( something like jdbc:oracle:oci8:user/pass@instance_machine:ResultSetMetaDataOptions=1&anotherProp=itsValue ...).
Thank you in advance
Loïc

Loic,
FAQ that Douglas mentioned is here:
http://www.oracle.com/technology/tech/java/sqlj_jdbc/htdocs/jdbc_faq_0.htm
Good Luck,
Avi.

Similar Messages

  • Junit : how to create JDBC URL connection

    hi folks,
    I am implementing JUnit in my application , for that I have seen srdemo application every thing is fine but i havent get how to configure JDBC URL connection 'SRServiceLocalTesting' ? can any body tell me how to do it.
    Thanks in advance
    Regards
    Pravin

    Hi,
    Have a look,
    http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/odi_11g/odi_project_xml-to-table/odi_project_xml-to-table.htm
    Thanks,
    Guru

  • 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

  • Connection Properties for the BI JDBC Connector

    Hi
    I am trying to configure BW 3.5 java component. In the Connection Properties for the BI JDBC Connector, there are four required properties. (UserName, Password, URL and DRIVERNAME) What should I enter for the URL and DRIVERNAME? I am using Oracle920.
    Please help,
    JW

    I found this info at
    http://www.oracle.com/technology/tech/java/sqlj_jdbc/htdocs/jdbc_faq.htm
    Oracle is replacing the SID mechanism for identifying databases with a new services approach. This has been available in the database since 8.1.7. JDBC now supports services in the connect URL. 
    The basic format of a service URL is:
    jdbc:oracle:thin:[<user>/<password>]@//<host>[:<port>]/<service>
    jdbc:oracle:oci:[<user>/<password>]@//<host>[:<port>]/<service>
    Examples:
    jdbc:oracle:thin:@//myserver.com/customer_db
    jdbc:oracle:oci:scott/tiger@//myserver.com:5521/customer_db

  • Connection with Advanced - custom JDBC URL fails with some valid JDBC-URLs

    Hi,
    I am trying to create a connection with a custom JDBC connection string, but SQL*Developer throws the error message:
    Status : Failure -Test failed: Required property 'hostname' is not set on the DatabaseProvider my tests are:
    <li> with connection via Connection Type set to TNS and a proper alias - it works fine
    <li> with connection via Connection Type set to Advanced and exactly the same values from tns in the url: jdbc:oracle:thin:@(DESCRIPTION=(enable=broken)(ADDRESS=(PROTOCOL=tcp)(HOST=172.24.32.113)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=RESTSVP_SITE1))) - it fails with Status : Failure -Test failed: Required property 'hostname' is not set on the DatabaseProvider<li> with JDBC URL set to jdbc:oracle:thin:@172.24.32.113:1521/RESTSVP_SITE1 - it works fine
    As my jdbc url is quite close to the example in [url http://docs.oracle.com/cd/E11882_01/java.112/e16548/apxtblsh.htm#CHDBBDDA]Using JDBC with Firewalls maybe someone can help me to fix it?
    Martin
    Edited by: berx on Oct 12, 2012 11:32 AM - fixed typos

    Hi Martin,
    1/oci/thick
    2/RAC options
    3/TNS connection
    1/oci/thick
    OCI driver has a slightly different set of features than thin:
    -try oci/thick (requires Oracle Client, server or instant client) (It requires SQLDeveloper java and .dll, .so libraries to match)Re: SQL developer 3.1 shows error Incompatible version of libocijdbc
    jdbc:oracle:oci:@(DESCRIPTION=(enable=broken)(ADDRESS=(PROTOCOL=tcp)(HOST=your_host_name)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=your_service_name)))
    2/RAC options
    More speculatively:
    -Try sid instead of service name (will disable some networking features on that connection), try switching load balancing off.
    From: Unable to access RAC from SQL Developer!
    In general and especially for RAC database you should use SERVICE_NAME to connect and not SID (because only SERVICE_NAME can use load balancing and failover features):
    3/TNS connection
    with connection via Connection Type set to TNS and a proper alias - it works fine(Which Connection Type TNS did you use? TNS Connect Identifier = oci/thick, TNS Network alias (can be thin (I should check, might depend on oci/thick checkbox))
    Is this issue stopping your work i.e. is this workaround unacceptable?
    -Turloch
    SQLDeveloper team

  • CR4E - JDBC Connection Properties - How do I set GenericJDBCDriver to Yes

    Hi,
    I need to setup my JDBC connection in CR4E like I would in my CRConfig.xml
    For example, I need to add this to my connection properties:
    <GenericJDBCDriver>
      <Option>Yes</Option>
      <DatabaseStructure>catalogs,schemas,tables</DatabaseStructure>
      <StoredProcType>Standard</StoredProcType>
      <LogonStyle>SQLServer</LogonStyle>
    </GenericJDBCDriver>
    Without setting these properties for my JDBC connection things do not work. I guess I need to use the Optional properites, but I do not know what the syntax would be for what I want.
    Please help.
    Thanks,
    Nick

    Please find below an example of setting the JDBC tags for Ms Sql 2000 (sp4)
    <JDBC>
         <CacheRowSetSize>100</CacheRowSetSize>
         <JDBCURL>jdbc:microsoft:sqlserver://vm-5akouassiwk2:1433</JDBCURL>
         <JDBCClassName>com.microsoft.jdbc.sqlserver.SQLServerDriver</JDBCClassName>
         <JDBCUserName>sa</JDBCUserName>
         <JNDIURL></JNDIURL>
         <JNDIConnectionFactory></JNDIConnectionFactory>
         <JNDIInitContext>/</JNDIInitContext>
         <JNDIUserName>weblogic</JNDIUserName>
         <GenericJDBCDriver>
              <Option>No</Option>
              <DatabaseStructure>catalogs,tables</DatabaseStructure>
              <StoredProcType>Standard</StoredProcType>
              <LogonStyle>SQLServer</LogonStyle>
         </GenericJDBCDriver>
    </JDBC>

  • Can I pass username & password in JDBC URL in Crystal Reports 2008?

    Hi,
    I tried to put this URL in the CRConfig.xml file : jdbc:postgresql://hostname:5432/db_name?user=user_name&password=pw
    Without the user and password parameters, it works fine but I always have to enter the database information when I create a new report or refresh an existing report.
    With the parameters, when I create a new report, if I click on "Create new connection", Crystal Reports freezes. If I click on the connection in "My connections", then I get an "Invalid argument" error message.
    How can I configure the database information so that I don't always need to enter it manually?
    Thanks,
    Marianne

    Hi Marianne,
    We don't recommended you do that. The text is in the clear so anyone could use your log on info. You may be able to add your user name to the Report by editing the connection properties from the Set Location dialog box but to add your password would give anyone who opened your report your log on info.
    And the info would be passed to the DB over the network in the clear so someone could hack your info.
    Thank you
    Don

  • What are the correct parameter names for a JDBC pool connection?

    Looking in the admin console I notice the differences in the properties name (type casting) of PointBasePool and __TimerPool pool connections properties and the create wizard properties.
    PointBasePool and __TimerPool uses this name parameters: User,Password, and DatabaseName.
    Create wizard uses these: databaseName, user, password.
    So, then, what is the standard names for a connection in SOA8? What is the standard for JDBC?
    For example, Tomcat 4 uses username, password, url, driverClassName as parameters names.
    Please help,
    This is getting more and more confising,
    Thanks,
    Lorenzo Jimenez

    The properties that you specify when creating the connection pool are unique to the vendor.
    Any or the properties that you specify user,password, url...etc we expect to have setters (setUser, setPassword, setUrl)
    let me know if need more info

  • Personal Oracle8 and JDBC:URL

    I am trying to use Oracle8 Personal Edition with Weblogic7.0. I tried to setup
    the connection pool but I couldn't figure out the JDBC:URL value correctly. I
    know the format is supposed to be jdbc:oracle:thin:@server:port:sid
    The server in my case is the localhost. I have created an instance called FBN.
    I don't know the port number. Can anyone help me to setup the Connection Pool
    properly? Thanks a lot.

    Here is an sample node to use oracle thin JDBC driver:
    <JDBCConnectionPool CapacityIncrement="5"
    DriverName="oracle.jdbc.driver.OracleDriver" InitialCapacity="5"
    MaxCapacity="40" Name="RFIDPool"
    Password="{3DES}FslOVhEO+VkeNVHoDdRxpw=="
    Properties="user=dwschema" Targets="myserver" URL="jdbc:oracle:thin:@localhost:1522:scisidw
    "/>
    Please note this one works with weblogic 6.1.
    Yong
    "Sai S Prasad" <[email protected]> wrote:
    >
    I am trying to use Oracle8 Personal Edition with Weblogic7.0. I tried
    to setup
    the connection pool but I couldn't figure out the JDBC:URL value correctly.
    I
    know the format is supposed to be jdbc:oracle:thin:@server:port:sid
    The server in my case is the localhost. I have created an instance called
    FBN.
    I don't know the port number. Can anyone help me to setup the Connection
    Pool
    properly? Thanks a lot.

  • JDBC URL or not JDBC URL

    Hello experts,
    I have two WLS 10.3.5.0 running in dev mode: WLS_A and WLS_B.
    They both have the same database resource, with the same name, and the same JNDI as well. Each WLS resides on a different Linux machine.
    If I set, in the Applictation properties in Jdeveloper, the database properties as JDBC Datasource, I can only deploy on WLS_A, while If I set the database properties as JDBC URL, I can only deploy on WLS_B.
    Why on hearth I get this different behavior, even if the WLS servers do have the same version, and the database is declared in the same way on both ?
    Is there any other setting on the WLS I'm missing ? I would like to have the same behavior for both server..
    Regards,
    Sergio.

    Yeah sorry, I try to give a more detailed explanation:
    - The deployment are in both cases successful, but I get for both server, in the log file - the one generated by startWebLogic.sh - the following warning message:
    <17.02.2012 07:21 Uhr MEZ> <Warning> <oracle.adf.share.jndi.ReferenceStoreHelper> <BEA-000000> <Incomplete connection reference object for connection:myConn>
    After this message, on the WLS_A the application runs and continue without connection problems, while on WLS_B, after this message the application does not start, and the WLS complains that it can not resolve the JNDI connection.
    I have the same connection description on both servers, with the same JNDI name.
    From within JDeveloper, where I have the application, I set in the AppModule.xml the values for the configurations: AppModuleShared and AppModuleLocal.
    If I set AppModuleShared and AppModuleLocal to JDBC Datasource, I can deploy on both servers, and the application works on both WLS_A and WLS_B.
    If I set AppModuleShared and AppModuleLocal to JDBC URL, I can still deploy on both servers, but the application works only on WLS_A.
    Thanks so far for the answers, but I'm still baffled by this WLS behavior..
    Sergio.

  • JDBC SSL connection to Oracle

    Hi All,
    I have been trying to connect to Oracle using a self signed certificate from a simple Java class. I am getting the below error.
    main, handling exception: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
    main, SEND TLSv1 ALERT: fatal, description = handshake_failure
    I have searched many forums but couldnt find the information of my help.
    Below are the steps I have followed as per the documentation in wp-oracle-jdbc-thin-ssl-130128.pdf.
    First Step: Created a self signed certificate and a truststore with the below commands using JDK 1.6.0_16
    Create a Keystore:
    keytool -genkey -keyalg RSA -alias MyKey -keystore keystore.jks -validity 360
    Extracting the public key:
    keytool -export -rfc -alias MyKey -keystore keystore.jks -file public.cert
    Creating the Truststore:
    keytool -import -alias MyKey -file public.cert -storetype JKS -keystore keystore.truststore
    Second Step: Added the following in listener.ora and sqlnet.ora
    listerner.ora :
    # listener.ora Network Configuration File: D:\oracle\product\11.2.0\dbhome_1\NETWORK\ADMIN\listener.ora
    # Generated by Oracle configuration tools.
    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = CLRExtProc)
    (ORACLE_HOME = D:\oracle\product\11.2.0\dbhome_1)
    (PROGRAM = extproc)
    (ENVS = "EXTPROC_DLLS=ONLY:D:\oracle\product\11.2.0\dbhome_1\bin\oraclr11.dll")
    SSL_CLIENT_AUTHENTICATION = FALSE
    LISTENER =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCPS)(HOST = localhost)(PORT = 2484))
    ADR_BASE_LISTENER = D:\oracle
    WALLET_LOCATION =
    (SOURCE =
    (METHOD = FILE)
    (METHOD_DATA =
    (DIRECTORY = E:\misc\Secure-jdbc\OracleCertificates)
    sqlnet.ora :
    # sqlnet.ora Network Configuration File: D:\oracle\product\11.2.0\dbhome_1\NETWORK\ADMIN\sqlnet.ora
    # Generated by Oracle configuration tools.
    ENCRYPTION_WALLET_LOCATION =
    (SOURCE =
    (METHOD = FILE)
    (METHOD_DATA =
    (DIRECTORY = E:\misc\Secure-jdbc\OracleCertificates)
    # This file is actually generated by netca. But if customers choose to
    # install "Software Only", this file wont exist and without the native
    # authentication, they will not be able to connect to the database on NT.
    SQLNET.AUTHENTICATION_SERVICES= (BEQ, TCPS, NTS)
    NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
    SSL_CLIENT_AUTHENTICATION = FALSE
    WALLET_LOCATION =
    (SOURCE =
    (METHOD = FILE)
    (METHOD_DATA =
    (DIRECTORY = E:\misc\Secure-jdbc\OracleCertificates)
    ADR_BASE = D:\oracle\product\11.2.0\dbhome_1\log
    Third Step: Created an empty auto logon wallet and added the above created certificate as a Trusted Certificate. (Imported the .cert file into the Trusted Certificates section in Wallet Manager)
    Fourth Step: Used the below Java code to connect to the database using the truststore
    public static void main(String[] args) { try { Class.forName("oracle.jdbc.driver.OracleDriver"); String url = "jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=localhost)(PORT=2484))(CONNECT_DATA=(SERVICE_NAME=ORCL11)))"; Properties props = new Properties(); props.setProperty("user", "system"); props.setProperty("password", "oracle"); props.setProperty("javax.net.ssl.trustStore","E:\\misc\\Secure-jdbc\\Keys and Certificates\\keystore.truststore"); props.setProperty("javax.net.ssl.trustStoreType","JKS"); props.setProperty("javax.net.ssl.trustStorePassword","sudhir123#"); Connection conn=DriverManager.getConnection(url,props); System.out.println("conn:"+conn); conn.close(); } catch(Exception e) { e.printStackTrace(); } }
    Any help would be appreciated.
    Thanks.
    Edited by: user10569290 on 20-Feb-2013 22:02

    Hi EJP,
    Please find the below code changes I have done to set the properties as part of System properties instead of Connection properties. I am still getting the same error.
    Code:
    Class.forName("oracle.jdbc.driver.OracleDriver");
              String url = "jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=localhost)(PORT=2484))(CONNECT_DATA=(SERVICE_NAME=ORCL11)))";
              Properties systemProps = System.getProperties();
              systemProps.put("javax.net.ssl.trustStore","E:\\misc\\Secure-jdbc\\Keys and Certificates\\keystore.truststore");
              systemProps.put("javax.net.ssl.trustStoreType","JKS");
              systemProps.put("javax.net.ssl.trustStorePassword","sudhir123#");
              System.setProperties(systemProps);
              Properties props = new Properties();
              props.setProperty("user", "system");
              props.setProperty("password", "oracle");
              /*props.setProperty("javax.net.ssl.trustStore","E:\\misc\\Secure-jdbc\\Keys and Certificates\\keystore.truststore");
              props.setProperty("javax.net.ssl.trustStoreType","JKS");
              props.setProperty("javax.net.ssl.trustStorePassword","sudhir123#");
              Connection conn=DriverManager.getConnection(url,props);
             System.out.println("conn:"+conn);
             conn.close();Please find the below output with the SSL debug enabled.
    adding as trusted cert:
    Subject: CN=Sudhir Reddy, OU=FCDMS, O=3i, L=Hyd, ST=AP, C=IN
    Issuer: CN=Sudhir Reddy, OU=FCDMS, O=3i, L=Hyd, ST=AP, C=IN
    Algorithm: RSA; Serial number: 0x511e1ebc
    Valid from Fri Feb 15 17:10:44 GMT+05:30 2013 until Mon Feb 10 17:10:44 GMT+05:30 2014
    trigger seeding of SecureRandom
    done seeding SecureRandom
    %% No cached client session
    *** ClientHello, TLSv1
    RandomCookie: GMT: 1361369602 bytes = { 14, 223, 155, 241, 143, 72, 188, 240, 205, 158, 201, 133, 217, 192, 95, 82, 61, 244, 93, 100, 12, 9, 232, 164, 116, 206, 30, 142 }
    Session ID: {}
    Cipher Suites: [SSL_RSA_WITH_RC4_128_MD5, SSL_RSA_WITH_RC4_128_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_DSS_WITH_AES_128_CBC_SHA, SSL_RSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA, SSL_RSA_WITH_DES_CBC_SHA, SSL_DHE_RSA_WITH_DES_CBC_SHA, SSL_DHE_DSS_WITH_DES_CBC_SHA, SSL_RSA_EXPORT_WITH_RC4_40_MD5, SSL_RSA_EXPORT_WITH_DES40_CBC_SHA, SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA, SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA]
    Compression Methods: { 0 }
    main, WRITE: TLSv1 Handshake, length = 73
    main, WRITE: SSLv2 client hello message, length = 98
    main, received EOFException: error
    main, handling exception: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
    main, SEND TLSv1 ALERT: fatal, description = handshake_failure
    main, WRITE: TLSv1 Alert, length = 2
    main, called closeSocket()
    main, called close()
    main, called closeInternal(true)
    java.sql.SQLRecoverableException: IO Error: Remote host closed connection during handshake
         at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:466)
         at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:535)
         at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:218)
         at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:29)
         at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:528)
         at java.sql.DriverManager.getConnection(DriverManager.java:582)
         at java.sql.DriverManager.getConnection(DriverManager.java:154)
         at SecureJDBC.getSecureConnection(SecureJDBC.java:52)
         at SecureJDBC.main(SecureJDBC.java:15)
    Caused by: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:808)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1096)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:623)
         at com.sun.net.ssl.internal.ssl.AppOutputStream.write(AppOutputStream.java:59)
         at oracle.net.ns.Packet.send(Packet.java:421)
         at oracle.net.ns.ConnectPacket.send(ConnectPacket.java:170)
         at oracle.net.ns.NSProtocol.connect(NSProtocol.java:302)
         at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1407)
         at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:328)
         ... 8 more
    Caused by: java.io.EOFException: SSL peer shut down incorrectly
         at com.sun.net.ssl.internal.ssl.InputRecord.read(InputRecord.java:333)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:789)
         ... 16 more

  • Parameters on Oracle JDBC URL

    I wonder if anyone can help.
    I am writing a Java class which uses a JDBC PreparedStatement object to call a stored procedure on an Oracle database.
    To create the PreparedStatement object I use the prepareStatement method of the Connection object.
    I do not create the Connection object - this is important - it is passed into my method by another piece of code I cannot change.
    I need to specify some connection properties - specifically 'SetBigStringTryClob'. All the documentation I can find says that properties such as this can be passed to the Connection when it is created via a Properties object like this:
    // Load the database details into the variables.
    String url = "jdbc:oracle:thin:@localhost:1521:orcl";
    String user = "scott";String password = "tiger";
    // Create the properties object that holds all database details
    Properties props = new Properties();
    props.put("user", user );
    props.put("password", password);
    props.put("SetBigStringTryClob", "true");
    // Load the Oracle JDBC driver class.
    DriverManager.registerDriver(new OracleDriver());
    // Get the database connection
    Connection conn = DriverManager.getConnection( this.url, this.props );
    I cant do this as I dont create the Connection object. What I can do is specify the URL, so I'm thinking I should be able to specify my connection properities as url parameters - but I cant get it to work and I cant find anything anywhere that tells me how to do it.
    Any ideas?
    Alternatively I'm thinking that maybe there is a method of Connection where I can specify these properties - essentially after its been created - but again, I cant find anything
    Any help with this would be very much appreciated;
    Cheers
    Nathan

    Can you use the 11g drivers?
    See http://download.oracle.com/docs/cd/B28359_01/java.111/b31224/oralob.htm#CHDGJJDD
    Specifically the Input section
    Otherwise, is there any reason not to use the Oracle specific extensions? i.e. setStringForClob()

  • JDBC URL helper class

    Hi,
    Was trying use third party(Caucho) jdbc type 4 driver for MySQL. I updated the
    jdbcdrivers.xml to include the details for the new driver. However, when using
    Config wizard, how (or where) do i provide a JDBC url helper class, so that the
    config wizard can connect the database using the jdbc url?
    Amit.

    Amit wrote:
    Joe Weinstein <[email protected]> wrote:
    Actually, all you need to do is get the driver you want into the weblogic
    classpath, and then tell the pool the class name you want for the driver,
    and give it the URL and properties it needs.
    Joe
    Hi. In order to implement a custom default, you would need to have
    a URLHelper class, as the other entries refer. I don't know that we
    offer a way to create Defaults, but you should be able to create a pool
    from the console by specifically typing in the class name and the URL.
    Is that not true?
    Joe
    >
    >
    Thanks Joe,
    But i wanted to see the jdbc url changed in the config wizard screen (as pointed
    in the pic). Caucho jdbc driver has url like "jdbc:mysql-caucho://hostname:port/database".
    Others mysql drivers have url like "jdbc:mysql://hostname:port/database. So where
    exactly could i tweek that property, since all that is editable is hostname, port,
    and database?

  • Java.lang.StringIndexOutOfBoundsException when trying to create a JDBC pool connection.

    Hi, I get a java.lang.StringIndexOutOfBoundsException when making a JDBC
    pool connection via the console of WLS 7.0. I use SQL Server 2000 in Win2K
    SP2 environment. Exactly the same configuration works perfectly in WinXP
    Pro. Can anyone advise me what might cause this problem? Thanks a lot.
    Log message
    ####<May 13, 2002 5:15:52 PM CEST> <Error> <JDBC> <abcdefgh> <vtsserver>
    <ExecuteThread: '1' for queue: '__weblogic_admin_html_queue'> <kernel
    identity> <> <001060> <Cannot startup connection pool
    "ejbTestConnectionPool" java.lang.StringIndexOutOfBoundsException: String
    index out of range: -1>
    Exception
    java.lang.NullPointerException
    at
    weblogic.management.console.utils.MBeans.getMBeanClassNameFor(MBeans.java:11
    53)
    at
    weblogic.management.console.actions.mbean.EditMBeanAction.getMBeanClass(Edit
    MBeanAction.java:210)
    at
    weblogic.management.console.actions.mbean.EditMBeanAction.getDialogTypeKey(E
    ditMBeanAction.java:188)
    at
    weblogic.management.console.actions.internal.InternalActionContext.setAction
    (InternalActionContext.java:158)
    at
    weblogic.management.console.actions.internal.ActionServlet.doAction(ActionSe
    rvlet.java:170)
    at
    weblogic.management.console.actions.internal.ActionServlet.doPost(ActionServ
    let.java:85)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at
    weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(Servle
    tStubImpl.java:945)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
    :332)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
    :242)
    at
    weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(W
    ebAppServletContext.java:5363)
    at
    weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManage
    r.java:721)
    at
    weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
    ntext.java:3043)
    at
    weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
    :2466)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:152)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:133)
    --------------- nested within: ------------------
    weblogic.utils.NestedRuntimeException - with nested exception:
    [java.lang.NullPointerException]
    at
    weblogic.management.console.utils.MBeans.getMBeanClassNameFor(MBeans.java:11
    56)
    at
    weblogic.management.console.actions.mbean.EditMBeanAction.getMBeanClass(Edit
    MBeanAction.java:210)
    at
    weblogic.management.console.actions.mbean.EditMBeanAction.getDialogTypeKey(E
    ditMBeanAction.java:188)
    at
    weblogic.management.console.actions.internal.InternalActionContext.setAction
    (InternalActionContext.java:158)
    at
    weblogic.management.console.actions.internal.ActionServlet.doAction(ActionSe
    rvlet.java:170)
    at
    weblogic.management.console.actions.internal.ActionServlet.doPost(ActionServ
    let.java:85)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at
    weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(Servle
    tStubImpl.java:945)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
    :332)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
    :242)
    at
    weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(W
    ebAppServletContext.java:5363)
    at
    weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManage
    r.java:721)
    at
    weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
    ntext.java:3043)
    at
    weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
    :2466)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:152)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:133)
    --------------- nested within: ------------------
    weblogic.management.console.actions.ActionException - with nested exception:
    [weblogic.utils.NestedRuntimeException - with nested exception:
    [java.lang.NullPointerException]]
    at weblogic.management.console.actions.ErrorAction.(ErrorAction.java:38)
    at
    weblogic.management.console.actions.internal.ActionServlet.doAction(ActionSe
    rvlet.java:190)
    at
    weblogic.management.console.actions.internal.ActionServlet.doPost(ActionServ
    let.java:85)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at
    weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(Servle
    tStubImpl.java:945)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
    :332)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
    :242)
    at
    weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(W
    ebAppServletContext.java:5363)
    at
    weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManage
    r.java:721)
    at
    weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
    ntext.java:3043)
    at
    weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
    :2466)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:152)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:133)
    Current Date
    Mon May 13 17:15:52 CEST 2002
    Console Release Build
    null
    Console Build
    null
    Server Release Build
    7.0.0.0
    Server Build
    WebLogic Server 7.0 Thu Apr 25 17:16:22 PDT 2002 180709
    All Server Product Versions
    WebLogic Server 7.0 Thu Apr 25 17:16:22 PDT 2002 180709
    WebLogic XMLX Module 7.0 Thu Apr 25 17:26:07 PDT 2002 180709
    Request Info
    Protocol: HTTP/1.1
    ServerName: localhost
    ServerPort: 7001
    Secure: false
    ContextPath: /console
    ServletPath: /common/error.jsp
    QueryString:
    MBean=vtsdomain%3AName%3DejbTestConnectionPool%2CType%3DJDBCConnectionPool
    PathInfo: null
    PathTranslated: null
    RequestURI: /console/common/error.jsp
    AuthType: null
    ContentType: application/x-www-form-urlencoded
    CharacterEncoding: null
    Locale: en_US
    Method: POST
    Session:
    weblogic.servlet.internal.session.MemorySessionData@1926bd
    RequestedSessionId:
    8fMghRfnkcOls1wsW0vIRS8PuQKquWoYcnt6ciUG5uznDJiLr1ZA!-37849198!1021299872710
    RequestedSessionIdFromCookie: true
    RequestedSessionIdFromURL: false
    UserPrincipal: vts
    RemoteUser: vts
    RemoteAddr: 127.0.0.1
    RemoteHost: 127.0.0.1
    Parameters
    MBean = vtsdomain:Name=ejbTestConnectionPool,Type=JDBCConnectionPool
    chosen_wl_control_weblogic.management.configuration.JDBCConnectionPoolMBean.
    Targets-Server = vtsdomain:Name=vtsserver,Type=Server
    weblogic.console.submit_form = dataposted
    wl_control_weblogic.management.configuration.JDBCConnectionPoolMBean.Targets
    -Server = vtsdomain:Name=vtsserver,Type=Server
    Attributes
    wlinternalaction =
    weblogic.management.console.actions.internal.InternalActionContext@4372d8
    java.util.Locale = en_US weblogic.management.console.catalog.Catalog =
    weblogic.management.console.catalog.XmlCatalog@3ca759
    weblogic.management.console.helpers.BrowserHelper = User-Agent: Mozilla/4.0
    (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705) IE: true Netscape:
    false Supported: true JavscriptHrefs: false TableCellClick: true
    DocumentReloadedOnResize: false DropdownStretchable: true CellSpacingBlank:
    false EmptyCellBlank: false ImgOnclickSupported: true TableBorderFancy: true
    PartialToWideTables: false DisabledControlSupported: true
    weblogic.management.console.helpers.DebugHelper =
    weblogic.management.console.helpers.DebugHelper@16ed83
    weblogic.management.console.helpers.UnitsHelper =
    weblogic.management.console.helpers.UnitsHelper@ae2d9
    weblogic.management.console.helpers.UrlHelper =
    weblogic.management.console.helpers.UrlHelper@28fd41
    Headers
    Accept = image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
    application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword,
    */* Accept-Encoding = gzip, deflate Accept-Language = en-us Cache-Control =
    no-cache Connection = Keep-Alive Content-Length = 304 Content-Type =
    application/x-www-form-urlencoded Cookie =
    ADMINCONSOLESESSION=8fMghRfnkcOls1wsW0vIRS8PuQKquWoYcnt6ciUG5uznDJiLr1ZA!-37
    849198 Host = localhost:7001 Referer =
    http://localhost:7001/console/actions/mbean/DoEditMBeanAction?MBean=vtsdomai
    n%3AName%3DejbTestConnectionPool%2CType%3DJDBCConnectionPool User-Agent =
    Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705)
    BrowserInfo
    User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0;
    .NET CLR 1.0.3705)
    IE: true
    Netscape: false
    Supported: true
    JavscriptHrefs: false
    TableCellClick: true
    DocumentReloadedOnResize: false
    DropdownStretchable: true
    CellSpacingBlank: false
    EmptyCellBlank: false
    ImgOnclickSupported: true
    TableBorderFancy: true
    PartialToWideTables: false
    DisabledControlSupported: true

    Thanks, Joe. It works now!
    "Joseph Weinstein" <[email protected]> wrote in message
    news:[email protected]...
    >
    Vladimir wrote:
    Here are the definitions of the two pools - both encounter the same
    problem:
    <JDBCConnectionPool DriverName="weblogic.jdbc.mssqlserver4.Driver"
    Name="ejbTestConPool"
    Properties="db=ejbTest;user=sa;port=1433;password=test;server=localhost"
    TestConnectionsOnRelease="true" TestConnectionsOnReserve="true"
    TestTableName="accounts" URL="weblogic:jdbc:mssqlserver4"/>yep, as I thought. A JDBC URL always starts with 'jdbc'. It should be
    'jdbc:weblogic:mssqlserver4'. Also, make TestConnectionsOnRelease="false"
    (it's a waste of cycles).
    Joe
    <JDBCConnectionPool DriverName="weblogic.jdbc.mssqlserver4.Driver"
    Name="ejbTestConnectionPool" Password="{3DES}sCmdDszi61I="
    Properties="user=sa;db=ejbTest;port=1433;password=test;server=localhost"
    Targets="vtsserver" TestTableName="accounts"
    URL="weblogic:jdbc:mssqlserver4"
    XAPassword="{3DES}sCmdDszi61I="/>
    >>
    Vladimir
    "Joseph Weinstein" <[email protected]> wrote in message
    news:[email protected]...
    show us your pool definitions from the config.xml file. There's
    probably a
    problem
    with the URL or properties.
    Joe
    Vladimir wrote:
    Hi, I get a java.lang.StringIndexOutOfBoundsException when making a
    JDBC
    pool connection via the console of WLS 7.0. I use SQL Server 2000in
    Win2K
    SP2 environment. Exactly the same configuration works perfectly in
    WinXP
    Pro. Can anyone advise me what might cause this problem? Thanks alot.
    >>>>
    Log message
    ####<May 13, 2002 5:15:52 PM CEST> <Error> <JDBC> <abcdefgh><vtsserver>
    <ExecuteThread: '1' for queue: '__weblogic_admin_html_queue'><kernel
    identity> <> <001060> <Cannot startup connection pool
    "ejbTestConnectionPool" java.lang.StringIndexOutOfBoundsException:String
    index out of range: -1>
    Exception
    java.lang.NullPointerException
    at
    weblogic.management.console.utils.MBeans.getMBeanClassNameFor(MBeans.java:11
    53)
    at
    weblogic.management.console.actions.mbean.EditMBeanAction.getMBeanClass(Edit
    MBeanAction.java:210)
    at
    weblogic.management.console.actions.mbean.EditMBeanAction.getDialogTypeKey(E
    ditMBeanAction.java:188)
    at
    weblogic.management.console.actions.internal.InternalActionContext.setAction
    (InternalActionContext.java:158)
    at
    weblogic.management.console.actions.internal.ActionServlet.doAction(ActionSe
    rvlet.java:170)
    at
    weblogic.management.console.actions.internal.ActionServlet.doPost(ActionServ
    let.java:85)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at
    weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(Servle
    tStubImpl.java:945)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
    :332)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
    :242)
    at
    weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(W
    ebAppServletContext.java:5363)
    at
    weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManage
    r.java:721)
    at
    weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
    ntext.java:3043)
    at
    weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
    :2466)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:152)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:133)
    --------------- nested within: ------------------
    weblogic.utils.NestedRuntimeException - with nested exception:
    [java.lang.NullPointerException]
    at
    weblogic.management.console.utils.MBeans.getMBeanClassNameFor(MBeans.java:11
    56)
    at
    weblogic.management.console.actions.mbean.EditMBeanAction.getMBeanClass(Edit
    MBeanAction.java:210)
    at
    weblogic.management.console.actions.mbean.EditMBeanAction.getDialogTypeKey(E
    ditMBeanAction.java:188)
    at
    weblogic.management.console.actions.internal.InternalActionContext.setAction
    (InternalActionContext.java:158)
    at
    weblogic.management.console.actions.internal.ActionServlet.doAction(ActionSe
    rvlet.java:170)
    at
    weblogic.management.console.actions.internal.ActionServlet.doPost(ActionServ
    let.java:85)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at
    weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(Servle
    tStubImpl.java:945)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
    :332)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
    :242)
    at
    weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(W
    ebAppServletContext.java:5363)
    at
    weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManage
    r.java:721)
    at
    weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
    ntext.java:3043)
    at
    weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
    :2466)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:152)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:133)
    --------------- nested within: ------------------
    weblogic.management.console.actions.ActionException - with nestedexception:
    [weblogic.utils.NestedRuntimeException - with nested exception:
    [java.lang.NullPointerException]]
    atweblogic.management.console.actions.ErrorAction.(ErrorAction.java:38)
    at
    weblogic.management.console.actions.internal.ActionServlet.doAction(ActionSe
    rvlet.java:190)
    at
    weblogic.management.console.actions.internal.ActionServlet.doPost(ActionServ
    let.java:85)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at
    weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(Servle
    tStubImpl.java:945)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
    :332)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
    :242)
    at
    weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(W
    ebAppServletContext.java:5363)
    at
    weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManage
    r.java:721)
    at
    weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
    ntext.java:3043)
    at
    weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
    :2466)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:152)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:133)
    Current Date
    Mon May 13 17:15:52 CEST 2002
    Console Release Build
    null
    Console Build
    null
    Server Release Build
    7.0.0.0
    Server Build
    WebLogic Server 7.0 Thu Apr 25 17:16:22 PDT 2002 180709
    All Server Product Versions
    WebLogic Server 7.0 Thu Apr 25 17:16:22 PDT 2002 180709
    WebLogic XMLX Module 7.0 Thu Apr 25 17:26:07 PDT 2002 180709
    Request Info
    Protocol: HTTP/1.1
    ServerName: localhost
    ServerPort: 7001
    Secure: false
    ContextPath: /console
    ServletPath: /common/error.jsp
    QueryString:
    MBean=vtsdomain%3AName%3DejbTestConnectionPool%2CType%3DJDBCConnectionPool
    PathInfo: null
    PathTranslated: null
    RequestURI: /console/common/error.jsp
    AuthType: null
    ContentType: application/x-www-form-urlencoded
    CharacterEncoding: null
    Locale: en_US
    Method: POST
    Session:
    weblogic.servlet.internal.session.MemorySessionData@1926bd
    RequestedSessionId:
    8fMghRfnkcOls1wsW0vIRS8PuQKquWoYcnt6ciUG5uznDJiLr1ZA!-37849198!1021299872710
    RequestedSessionIdFromCookie: true
    RequestedSessionIdFromURL: false
    UserPrincipal: vts
    RemoteUser: vts
    RemoteAddr: 127.0.0.1
    RemoteHost: 127.0.0.1
    Parameters
    MBean = vtsdomain:Name=ejbTestConnectionPool,Type=JDBCConnectionPool
    chosen_wl_control_weblogic.management.configuration.JDBCConnectionPoolMBean.
    Targets-Server = vtsdomain:Name=vtsserver,Type=Server
    weblogic.console.submit_form = dataposted
    wl_control_weblogic.management.configuration.JDBCConnectionPoolMBean.Targets
    -Server = vtsdomain:Name=vtsserver,Type=Server
    Attributes
    wlinternalaction =
    weblogic.management.console.actions.internal.InternalActionContext@4372d8
    java.util.Locale = en_US weblogic.management.console.catalog.Catalog=
    weblogic.management.console.catalog.XmlCatalog@3ca759
    weblogic.management.console.helpers.BrowserHelper = User-Agent:Mozilla/4.0
    (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705) IE: trueNetscape:
    false Supported: true JavscriptHrefs: false TableCellClick: true
    DocumentReloadedOnResize: false DropdownStretchable: trueCellSpacingBlank:
    false EmptyCellBlank: false ImgOnclickSupported: true
    TableBorderFancy:
    true
    PartialToWideTables: false DisabledControlSupported: true
    weblogic.management.console.helpers.DebugHelper =
    weblogic.management.console.helpers.DebugHelper@16ed83
    weblogic.management.console.helpers.UnitsHelper =
    weblogic.management.console.helpers.UnitsHelper@ae2d9
    weblogic.management.console.helpers.UrlHelper =
    weblogic.management.console.helpers.UrlHelper@28fd41
    Headers
    Accept = image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
    application/vnd.ms-excel, application/vnd.ms-powerpoint,application/msword,
    */* Accept-Encoding = gzip, deflate Accept-Language = en-usCache-Control =
    no-cache Connection = Keep-Alive Content-Length = 304 Content-Type =
    application/x-www-form-urlencoded Cookie =
    ADMINCONSOLESESSION=8fMghRfnkcOls1wsW0vIRS8PuQKquWoYcnt6ciUG5uznDJiLr1ZA!-37
    849198 Host = localhost:7001 Referer =
    http://localhost:7001/console/actions/mbean/DoEditMBeanAction?MBean=vtsdomai
    n%3AName%3DejbTestConnectionPool%2CType%3DJDBCConnectionPoolUser-Agent
    =
    Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR
    1.0.3705)
    BrowserInfo
    User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; WindowsNT
    5.0;
    .NET CLR 1.0.3705)
    IE: true
    Netscape: false
    Supported: true
    JavscriptHrefs: false
    TableCellClick: true
    DocumentReloadedOnResize: false
    DropdownStretchable: true
    CellSpacingBlank: false
    EmptyCellBlank: false
    ImgOnclickSupported: true
    TableBorderFancy: true
    PartialToWideTables: false
    DisabledControlSupported: true

  • Jdbc derby connectivity

    Hi I m new to java database connectivity part.
    I have written one program to connect with Derby database but whenever i execute the program i get following error:
    What could be the problem
    C:\Documents and Settings\milindk\Desktop>java TestDB
    java.sql.SQLException: No suitable driver found for jdbc:derby://localhost:1527/
    fmgdb;user=fmguser;password=fmguser
            at java.sql.DriverManager.getConnection(Unknown Source)
            at java.sql.DriverManager.getConnection(Unknown Source)
            at TestDB.runTest(TestDB.java:28)
            at TestDB.main(TestDB.java:12)Source Code is as below
    import java.sql.*;
    import java.io.*;
    import java.util.*;
    class TestDB
    public static void main(String args[])
    try
    runTest();
    catch (SQLException ex)
    for (Throwable t : ex)
    t.printStackTrace();
    catch (IOException ex)
    ex.printStackTrace();
    public static void runTest() throws SQLException, IOException
    Connection conn=DriverManager.getConnection("jdbc:derby://localhost:1527/fmgdb;user=fmguser;password=fmguser");
    try
    Statement stat = conn.createStatement();
    stat.executeUpdate("CREATE TABLE Greetings (Message CHAR(20))");
    stat.executeUpdate("INSERT INTO Greetings VALUES ('Hello, World!')");
    ResultSet result = stat.executeQuery("SELECT * FROM Greetings");
    if (result.next())
    System.out.println(result.getString(1));
    result.close();
    stat.executeUpdate("DROP TABLE Greetings");
    finally
    conn.close();
    }

    I have modified my souce code accordingly
    but still i m getting following error.
    C:\>java TestDB
    java.lang.ClassNotFoundException: org.apache.derby.jdbc.ClientDriver
            at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
            at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
            at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
            at java.lang.Class.forName0(Native Method)
            at java.lang.Class.forName(Class.java:169)
            at TestDB.runTest(TestDB.java:33)
            at TestDB.main(TestDB.java:12)Source Code
    import java.sql.*;
    import java.io.*;
    import java.util.*;
    class TestDB
    public static void main(String args[])
    try
    runTest();
    catch (SQLException ex)
    for (Throwable t : ex)
    t.printStackTrace();
    catch (IOException ex)
    ex.printStackTrace();
    catch (ClassNotFoundException ex)
    ex.printStackTrace();
    public static void runTest() throws SQLException, IOException,ClassNotFoundException
    //Connection conn = getConnection();
    Class.forName("org.apache.derby.jdbc.ClientDriver");
    Connection conn=DriverManager.getConnection("jdbc:derby://localhost:1527/fmgdb;user=fmguser;password=fmguser");
    try
    Statement stat = conn.createStatement();
    System.out.println("Creating a table");
    stat.executeUpdate("CREATE TABLE Greetings (Message CHAR(20))");
    stat.executeUpdate("INSERT INTO Greetings VALUES ('Hello, World!')");
    ResultSet result = stat.executeQuery("SELECT * FROM Greetings");
    if (result.next())
    System.out.println(result.getString(1));
    result.close();
    stat.executeUpdate("DROP TABLE Greetings");
    finally
    conn.close();
    /*public static Connection getConnection() throws SQLException, IOException
    Properties props = new Properties();
    FileInputStream in = new FileInputStream("database.properties");
    props.load(in);
    in.close();
    String drivers = props.getProperty("jdbc.drivers");
    if (drivers != null) System.setProperty("jdbc.drivers", drivers);
    String url = props.getProperty("jdbc.url");
    String username = props.getProperty("jdbc.username");
    String password = props.getProperty("jdbc.password");
    return DriverManager.getConnection(url, username, password);
    }

Maybe you are looking for