Pooled jdbc connection(s), and server resources

Hello All,
I am curious about the difference between jdbc connections in a connections pool, and 'stand alone' connection. I have Oracle 9.2
To describe...
In my application server (WebLogic) I have a connection pool, with 10 connections. Does this take less server resources than 10 separate connections? I notice that there are still 10 server processes appearing.
thanks!
JM
the jdbc Programmer's Guide and Reference says...
(( start quote ))
A pooled connection instance encapsulates a physical connection to a database. This
database would be the one specified in the connection properties of the connection
pool data source instance used to produce the pooled connection instance.
A pooled connection instance is an instance of a class that implements the standard
javax.sql.PooledConnection interface. The getConnection() method
specified by this interface returns a logical connection instance that acts as a
temporary handle to the physical connection, as opposed to encapsulating the
physical connection, as does a non-pooling connection instance:
(( end quote ))
...I had the impression that a connection pool of 10, results in one 'physical' connection. But it appears not!

No, and yes...
A pool of 10 connections creates 10 physical database connections, which require exactly the same resources as 10 connections from a standalone Java app or 10 connections from SQL*Plus.
The connection pool, however, allows those 10 physical connections to server one the order of 100 logical connections (in an average OLTP application). If you have a JSP page that opens a connection, runs a couple of DML statements, and closes the connection, having a connection pool greatly reduces the load on the database because it does not have to create a new physical connection for every JSP page-- the JSP page gets a connection from the pool, uses it for a bit, and returns it to the pool where it can be assigned to another JSP page. Because each user only needs the connection a small percentage of the time, you can server many physical users with only 1 physical database connection.
Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC

Similar Messages

  • Auto-Commit and Pooled JDBC Connections

    Forum Members,
    If I am using Oracle Pooled JDBC Connections in the OC4J container is auto-commit set to "true" by default?
    If I set auto-commit to "false" and then close the logical connection, when that connection is handed out again on a later call to getConnection(), is auto-commit automatically set back to "true"?
    Thanks,
    Richard

    Richard,
    Pardon me if I am stating the obvious, but you could test that in your code by invoking the getAutoCommit() method in interface java.sql.Connection.
    My experience (with OC4J stand-alone versions up to -- and including -- 10.1.2) is that the behaviour depends on which data source you have configured. For example, if you have defined an "ejb-location" attribute in your "data-sources.xml" file, and you use that as your JNDI lookup for your data source, then OC4J handles transactions and you shouldn't deal with "auto-commit" at all. See the following post for more details:
    Re: OC4J 10.1.3 Preview 4 - Global transaction active
    But if you have defined a "location" attribute and use that, then you do need to handle transactions explicitly.
    Hope this helps.
    Good Luck,
    Avi.

  • Obtaining an oracle.sql.STRUCT through a pooled JDBC connection

    Hello,
    I am using WebLogic Server 10 and and Oracle 10 and I am trying to obtain a vendor-specific oracle.sql.STRUCT from a ResultSet using a pooled connection defined in Weblogic. I need the vendor-specific object, rather than simply the java.sql.Struct implementation, because a third party library requires it.
    What gets returned in the ResultSet is a non-exposed WebLogic wrapper object which implements java.sql.Struct, but which cannot be cast to an oracle.sql.STRUCT. I can use reflection on this object to find and call the getVendorObj() method to obtain the oracle.sql.STRUCT, but this solution is not acceptable because this is not a published API and is not guaranteed not to change in future versions.
    How can I reliably obtain a vendor-specific implementation of java.sql.Struct through a WebLogic connection pool in WebLogic Server 10?
    Thanks for any advice,
    -Dan Schwemlein

    dan schwemlein wrote:
    Joe,
    Thanks again. With your guidance, I have arrived at the following approach, which I'll post for the benefit of others, and which I'd be thankful if you would validate:
    1) Import the jar com.bea.core.datasource-1.0.0.0.jar from %BEA_HOME%\modules, which is the only location of the class WLConnection, which is the only class with the getVendorConnection() method you refer to.
    2) Get the logical connection from the pooled data source, cast it to a WLConnection, call getVendorConnection() to obtain an OracleConnection (from the ojdbc jar), and use this connection to obtain the required oracle.sql.STRUCT from an OracleResultSet.
    3) Be aware of the limitations and follow the guidelines in the document http://e-docs.bea.com/wls/docs81/jdbc/thirdparty.html#1043646 regarding security, error handling, releasing resources (close only the logical connection), etc.
    Does this sound like the approach you had in mind?
    Thanks again,
    -Danyes.
    Joe
    >
    Re: Obtaining an oracle.sql.STRUCT through a pooled JDBC connection
    Posted: Jul 16, 2007 3:21 PM
    dan schwemlein wrote:
    Thanks for the quick response!I was working today...
    Thank you for the information about the connection being closed.
    I will look into using this configuration setting.
    You say that you can describe a way to get a handle on an unwrapped
    pool object using some documented WLS-specific code. Are you referring
    here to the getVendorConnection() method?yes.
    This method does not help me
    get the oracle.sql.STRUCT object, because even the connection returned
    by getVendorConnection() returns a wrapped WL java.sql.Struct object
    from a call to getObject().I don't believe it. If you are running in WLS, with a local pool,
    the getVendorConnection() will give you the Oracle connection,
    which will give you an Oracle statement, etc, down to an oracle
    STRUCT object. Once you have a direct reference to the oracle connection,
    we're not in the picture when it returns something to you.
    It would be great if getVendorObj() were
    documented and could be counted on in future versions. To use this
    method, one would still have to access it via Java reflection, because
    the wrapper class and its getVendorObj() method would be exposed in an
    API, correct? Could this method be exposed in the API, so that reflection
    doesn't need to be used, or it is exposed somewhere that isn't documented?getVendorObj() is not yet exposed or therefore supported for the general
    wrapped object, so you would have to start from the connection and
    derive all subobjects from it.
    Thanks again,
    -Dan Schwemlein
    Hello,
    I am using WebLogic Server 10 and and Oracle 10 and I am trying to obtain a
    vendor-specific oracle.sql.STRUCT from a ResultSet using a pooled connection
    defined in Weblogic. I need the vendor-specific object, rather than simply
    the java.sql.Struct implementation, because a third party library requires it.
    What gets returned in the ResultSet is a non-exposed WebLogic wrapper object
    which implements java.sql.Struct, but which cannot be cast to an oracle.sql.STRUCT.
    I can use reflection on this object to find and call the getVendorObj() method to
    obtain the oracle.sql.STRUCT, but this solution is not acceptable because this is
    not a published API and is not guaranteed not to change in future versions.Understood. We all benefit from sticking to the J2EE standards,
    but we could also wish Oracle had done so with it's driver objects.
    I will assume your code is running in the WebLogic server, because
    an external JVM can never access the real driver object, which will
    always really be in the WLS JVM. No active JDBC object is serializable.
    How can I reliably obtain a vendor-specific implementation of java.sql.Struct
    through a WebLogic connection pool in WebLogic Server 10?There is no way to get a handle on an unwrapped pool object without using some
    WLS-specific code, though I can describe a way with documented methods,
    and/or I can get our documentation altered to say we'll support the
    getVendorObj() method. We introspect every vendor object, and for those
    implementations that have done the wise thing, projecting any non-standard
    methods as an Interface, we are able to also project that Interface so
    the vndor example code should work. However, in some poorly-done
    cases, such as for some Oracle stuff, there is either no Interface,
    or the Oracle code has extensions that take java.sql objects as input,
    (at least that's the signature of the method) but two lines into the
    method, the Oracle code assumes and casts the java.sql object to a concrete
    Oracle object. In these use cases you need the direct unwrapped object.
    We provide and document Connection.getVendorConnection(), and intend
    getVendorObj() to serve the same for subobjects, but note the dangers
    and responsibilities: We rely on our wrappers to implement the security
    and thread-safety of our pooling system. Because user code can get
    unrestricted access to the actual connection from most JDBC objects,
    we can never trust that we have complete control once a vendor object
    is exposed. Therefore, by default we will close and replace every JDBC
    connection so exposed, as soon as the current thread is finished with
    the pool connection. This hurts performance. We also document a pool
    config setting that will tell us that you take responsibility for any such
    problems, and not to close connections just because they've been exposed.
    HTH,
    Joe
    Thanks for any advice,
    -Dan Schwemlein

  • Enable SSL between oracle JDBC Connection in weblogic server.

    Hi ALL,
    I have an requirement to enable SSL Mechanism in weblogic JDBC Connection Pool.we are using Oracle9i Enterprise Edition Release 9.2.0.7.0 - 64bit Production and Driver as "jdbc:oracle:thin@..." / oracle.jdbc.OracleDriver.
    weblogic server 8.1 SP4
    can anybody know what are the steps / configuration has to be done for enable Oracle Advanced Security encryption on the JDBC Oracle Thin driver with a WebLogic JDBC Connection Pool.
    Thanks,
    Karthik,

    Hi,
    I changed the code as given below. Still getting the same error. Can I migrate my question to jdbc section? I am new to this forum.
    import java.sql.*;
    public class jdbc {
    public static void main(String[] args) throws ClassNotFoundException, SQLException
    Class.forName("oracle.jdbc.driver.OracleDriver");
    String url = "jdbc:oracle:thin:@localhost:1521:xe";
    Connection conn =
    DriverManager.getConnection(url,"jestin","jj");
    conn.setAutoCommit(false);
    Statement stmt = conn.createStatement();
    ResultSet rset =
    stmt.executeQuery("select BANNER from SYS.V_$VERSION");
    while (rset.next()) {
    System.out.println (rset.getString(1));
    stmt.close();
    System.out.println ("Ok.");
    jestinjoy@debian:~/java$ javac -classpath /usr/lib/java/ jdbc.java
    jestinjoy@debian:~/java$ java jdbc
    Exception in thread "main" java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
         at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Class.java:169)
         at jdbc.main(jdbc.java:7)
    same error when I give the command without classpath

  • Can not deploy a report using JDBC connection on CR2008 Server

    Hi Group,
    I have a report created with JDBC connection. When I tried to add it to CR2008 server, it gives an error - "An unexpected error has occurred ". Basically I want to add a report to a public folder via CMC. I am using adminstrator account.
    Then I thought I need to add JDBC driver into CR2008 server. so I put oracle jdbc jar into CR2008 server classpath and add JDBC connection info into CRConfig.xml. but I still got the same error.
    I also tried:
    - Change the report to use native Oracle driver rather than JDBC. The deployment succeeded (but this is not what I want)
    - Add a data source connection via Business View Manager, but no luck.
    I know how to use/change jdbc connection with programtic way, but I just want to know if I want to use built-in components in CR2008 server without any coding the reports can be deployed and managed.
    Thanks in advance.
    Dennis

    Hello Will,
    Crystal Reports supports connections to JDBC/JNDI out of the box, and have done so for a while, whether stand-alone or published to Enterprise.
    To specify where the server would search for the JDBC driver jar files, you'd change the classpath tag found in the CRConfig.xml file found on the machine where the Crystal Reports Page or Job Server is running. 
    For early Crystal Enterprise 10 and before, it used Java Native Interface (JNI) to start the Java process to retrieve the data from the JDBC connection.
    For later Crystal Enterprise 10 and later, it starts off a "Java Server" process, and communicates to the Crystal Reports process via CORBA TCP/IP connection.
    Commonissues that may arise:  (1) CRConfig.xml not configured properly, (2) unable to start or communicate to the "Java Server" because of permissions or firewall.
    Note that this is a separate connectivity map from using ADO or ADO.NET.
    Sincerely,
    Ted Ueda

  • Cant create JDBC Connections in RMI Server

    I am having a pretty weird problem which I am struggling with for the last three days. In the main method of the Server object, following three things are supposed to happen:
    1) Creation of a JDBC Connection
    2) Creation of a Remote Object and then publishing the same to Registry.
    3) Creation of another JDBC Connection (exactly same as in step1)
    step 1 and 2 successfully executes and the third one always errors out. I just simply get a NullPointerException.
    If I comment out step 2, step 3 executes successfully. Can someone please tell me the mystery? I need your response really urgently so please help me.
    TIA
    Code Snippet:
     public static void main(String[] args) {
      System.setSecurityManager(new RMISecurityManager());
      try {
       Properties dbProps = new Properties();
       dbProps.put("user", "SDAWOODI");
       dbProps.put("password", "SDAWOODI");
       java.sql.Connection connection =    java.sql.DriverManager.getConnection("jdbc:oracle:thin:@wonder.cisco.com:1521:ODSDEV", dbProps);
      catch (Exception sqle) {
       System.out.println("[11111]"+sqle.toString());
      Properties props = new Properties();
      props.put("java.rmi.server.codebase", rmiCodeBase);
      System.setProperties(props);
      try {
       SchedulerRImpl schedulerR = new SchedulerRImpl(ssce_sch1);
       String nameStr = "s-sce-scheduler";
       try {
        Naming.bind(nameStr, schedulerR);
        if (Scheduler.m_debug_flag) System.out.println("[Scheduler.main] Scheduler bound with RMI registry!!!");
       catch (AlreadyBoundException abe) {
        if (Scheduler.m_debug_flag) System.out.println("[Scheduler.main] Scheduler is already bound with RMI registry ... trying RE-bind ...");
        try {
         Naming.rebind(nameStr, schedulerR);
         if (Scheduler.m_debug_flag) System.out.println("[Scheduler.main] Scheduler RE-bound with RMI registry!!!");
        catch (Exception e) {
         if (Scheduler.m_debug_flag) System.out.println("[Scheduler.main] Rcheduler RE-binding failed :(((");
      catch (Exception e) {
       if (Scheduler.m_debug_flag) System.out.println("[Scheduler.main] SchedulerR instantiation failed:((( : "+e.toString());
      Properties dbProps2 = new Properties();
      dbProps2.put("user", "SDAWOODI");
      dbProps2.put("password", "SDAWOODI");
      try {
       java.sql.Connection connection2 = java.sql.DriverManager.getConnection("jdbc:oracle:thin:@wonder.cisco.com:1521:ODSDEV", dbProps2);
       if (connection2==null) {
       System.out.println("connection is NULL");
      else {
       System.out.println("connection is NOT null");
     catch (Exception sqle2) {
      System.out.println("[22222]"+sqle2.toString());
    }

    In reply to reply #4:
    You can also quote the other part of my reply when it comes to snippets. There are so many pieces of code missing from your snippet that I simply cannot guess what is wrong. (Please do not put your entire class structures here.)
    We get connections in many different classes at many different times. It is after all an application that does user work and the user work involves database accesses. Some of those accesses are before RMI (to establish repositories, etc). Most are after.
    This URL (jdbc:oracle:thin:@wonder.cisco.com:1521:ODSDEV) appears to use a network connection (yes?). Is the 1521 a port? Are you trying to reuse this port? (the first conn uses the same URL). What port does RMI use?
    There is nothing in your snippet that stands out obviously as "this is wrong".
    RMI uses networking. JDBC uses networking.
    Try substituting some other networking code in place of the RMI code and see if you still get a null trying the second connection. As you say, if you leave out the RMI code the second get.conn works.
    Try leaving out the first get.conn. Do the RMI and second get.conn.
    Try this and try that and try some more. I once had this problem with a network printer that would not print. The code was fine. The URL was fine. The response from the network and printer were both fine. The damn thing just wasn't printing. Turns out there was this bit, yes a single bit, in one word of a property called the "start print bit". If this bit wasn't on, nothing happened. I tried every combination until I finally found it.
    I wish you the best.

  • JDBC connection to SQL Server 2000 Service Pack 4

    Hello Everyone,
    I'm trying to do a simple application which save some values into a MS SQL Server 2000 Database's Table.
    The source code I've written is:
    package Logging;
    import com.brekeke.net.sip.sv.session.*;
    import com.brekeke.net.sip.sv.session.plugins.*;
    import java.io.*;
    import java.util.*;
    import java.sql.*;
    public class Logging extends AccountingBase {
    public int eventSessionStart( EventStat evstat, String[] argprm )
    int ris =0;
    int line=999;
    try {
    EventStat a;
    a = evstat ;
    String username;
    username=a.urlCaller;
    String callee;
    callee=a.urlCallee;
    Statement stmt = null;
    try {
    line=1;
    Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
    line=2;
    Connection conn = DriverManager.getConnection("jdbc:microsoft:sqlserver://BSSQL:1433;DataBaseName=Test;User=sa;Password=biesse");
    line=3;
    // Create and execute an SQL statement that returns some data.
    String SQL = "INSERT INTO log VALUES ('" + a.urlCaller + "','" + a.urlCallee + "')";
    line=4;
    stmt = conn.createStatement();
    line=5;
    line=stmt.executeUpdate(SQL);
    line=10;
    catch (Exception e) {
    e.printStackTrace();
    finally {
    if (stmt != null) try { stmt.close(); } catch(Exception e) {}
    File f = new File("c:/prova.txt");
    FileOutputStream fos=new FileOutputStream(f);
    PrintStream ps=new PrintStream(fos);
    ps.println(line);
    ps.println(a.urlCaller);
    ps.println(a.urlCallee);
    fos.close();
    catch ( Exception ex ) {
    return ris;
    The problem is that into the Table no value is written, no problem compiling it and into the file prova.txt I can see only the value line=1 written!
    So there should be something wrong in the connection.
    I've already installed the JDBC drivers for SQL Server 2000 and I've addedd into the libraries the "msbase.jar, the mssqlserver.jar and the msutil.jar".
    But nothjng written into the Database :-(
    Can you help me please?
    Thank you very much in advance,
    Best Regards
    Francesco

    Hi,
    Yes i am able to connect from ISQL. Only connecting from JDBC is a problem.

  • Some times on Tomcat start up it creates SSL error while JDBC connection to SQL server

    We are using Apache Tomcat 6 and SQL server 2008 on production. In the application in ServletContextListner we make DB connection to read some property from DB. When we restart the Tomcat 6.0 in that case sometimes it does not gets DB connection till 5 to
    10 minutes. It does not happen every time. We are using JNDI for getting the Datasource objectand using SQL JDBC 3.0 driver. We get following error in log
    org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "Connection reset by peer: socket write error".)
    at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1225)
    at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
    at com.rightwave.util.RWDBConnectionManager.getConnection(RWDBConnectionManager.java:145)
    at com.rightwave.util.RWDataBaseDAO.executeQuery(RWDataBaseDAO.java:306)
    at com.rightwave.util.RWDataBaseDAO.executeQuery(RWDataBaseDAO.java:289)
    at com.rightwave.admin.RWApplicationContext.setMConfigurationProperties(RWApplicationContext.java:226)
    at com.rightwave.admin.RWAdminApplicationContext.initialize(RWAdminApplicationContext.java:85)
    at com.rightwave.admin.RWServletContextListener.contextInitialized(RWServletContextListener.java:186)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
    at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:627)
    at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)
    at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
    at org.apache.catalina.core.StandardService.start(StandardService.java:516)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
    Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "Connection reset by peer: socket write error".
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:1368)
    at com.microsoft.sqlserver.jdbc.TDSChannel.enableSSL(IOBuffer.java:1412)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1058)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:833)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:716)
    at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:841)
    at org.apache.tomcat.dbcp.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38)
    at org.apache.tomcat.dbcp.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:294)
    at org.apache.tomcat.dbcp.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1247)
    at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1221)
    ... 31 more
    Caused by: java.io.IOException: Connection reset by peer: socket write error
    at com.microsoft.sqlserver.jdbc.TDSChannel$SSLHandshakeInputStream.ensureSSLPayload(IOBuffer.java:500)
    at com.microsoft.sqlserver.jdbc.TDSChannel$SSLHandshakeInputStream.readInternal(IOBuffer.java:570)
    at com.microsoft.sqlserver.jdbc.TDSChannel$SSLHandshakeInputStream.read(IOBuffer.java:562)
    at com.microsoft.sqlserver.jdbc.TDSChannel$ProxyInputStream.readInternal(IOBuffer.java:757)
    at com.microsoft.sqlserver.jdbc.TDSChannel$ProxyInputStream.read(IOBuffer.java:745)
    at com.sun.net.ssl.internal.ssl.InputRecord.readFully(Unknown Source)
    at com.sun.net.ssl.internal.ssl.InputRecord.read(Unknown Source)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(Unknown Source)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(Unknown Source)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(Unknown Source)
    at com.microsoft.sqlserver.jdbc.TDSChannel.enableSSL(IOBuffer.java:1379)
    ... 39 more
    Urgent help will be appreciated. 

    So, you've got a network error.. Check your physical layer.

  • JDBC connection w/Japanese server

    I have an English client doing the following JDBC connection to a Japanese server:
    m_connection = DriverManager.getConnection(
    m_connectionStr,
    m_user, m_password );
    This always results in a SQL exception with the following three messages:
    [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]???? 'MSSQL' ???????????????????????????????
    SQL State: HY000
    SQL Code: 4060
    [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]???? 'sa' ??????????????
    SQL State: 28000
    SQL Code: 18456
    [Microsoft][SQLServer 2000 Driver for JDBC]An error occured while attempting to log onto the database.
    SQL State: 08001
    SQL Code: 0
    What do I need to do to get a connection and to send queries that are stored in English?
    Thanks,
    pds2

    The connection string is:
    jdbc:microsoft:sqlserver://10.4.10.34:1433;databaseName=MSSQL;
    I tried the following with the same bad results as before:
    java.util.Properties prop = new java.util.Properties();
    prop.setProperty( "user", m_user );
    prop.setProperty( "password", m_password );
    prop.setProperty( "characterEncoding", "utf8" );
    prop.setProperty( "useUnicode", "true" );
    m_connection = DriverManager.getConnection(
    m_connectionStr, prop );
    Will some variation of this work?

  • Unable to create dynamic JDBC Connections in RMI Server

    Hi,
    Goal: Using Swing client to connect to a variety of JDBC databases via RMI dynamically....
    J2SE : 1.4.2
    J2EE: 1.31
    Databases: Oracle 9i(R2), MySQL 4.0, MS Access 2000
    Platform : Windows 2000 SP4 (Professional and Server)
    I have a working client-server application using RMI to connect to a single database. I want the ability
    to create JDBC connections dynmically by invoking a RMI method after it has been bound. Presently
    I am getting null pointers. Anybody offer any solutions or work arounds?

    Goal: Using Swing client to connect to a variety of
    JDBC databases via RMI dynamically....Actually what u want from the client swing is to form a Form using the datamodel from the database, invoke query as the client is allowed and wants and update changes. I hope I got it right, thats what u want.
    Actually as per my knowledge goes thats what any Database 3-tier program should do.
    I have a working client-server application using RMI
    to connect to a single database. I want the ability
    to create JDBC connections dynmically by invoking a
    RMI method after it has been bound. Presently
    I am getting null pointers. Anybody offer any
    solutions or work arounds?Database connections are only needed as long as the query to the database are being processed. So for ur solution if u have a RMI method that, will invoke first, the database connection and then process the query and then disconnect it , would be enough. When multiple clients will call the method there will be multiple connections to the database as they can have threads working or if u want one process at a time u can sycronize the method. This RMI method will only return the result set of the query and that would be enough for ur solution. Now to be able to say why ur getting null pointers I would need the code u r using.

  • ABAP statement for JDBC connection to SQL server

    Hi Gurus,
    i need to connect a WebDynpro abap to a SQL server.
    My OS is Unix so i cannot use a ODBC connection.
    Can anyone help me to know if it's possible to write an abap statement to connect the SQL server by JDBC connection?
    thanks a lot
    Regards
    Claudio.

    Hi,
          ELSEIF SCREEN-GROUP2 = 'PRO'.
          clear: list.
          if screen-name = 'ZAVBAK-ZZPROMO_ID'.
            exec sql.
       commit
              set connection :'CBREPOSITORYPRD'
            endexec.
            exec sql.
              CONNECT TO :'CBREPOSITORYPRD'
            endexec.
            exec sql.
              COMMIT
            endexec
          EXEC SQL.
              OPEN C1 FOR
              SELECT CutterRewardsUserListid,
                     SAPAccountNumber,
                     PromoID,
                     FirstName,
                     LastName
                     FROM CutterRewardsUserList
                     WHERE SAPAccountNumber = :XVBPA-KUNNR ORDER BY PromoID
            ENDEXEC.
            DO.
              EXEC SQL.
                FETCH NEXT C1 INTO :WA5
              ENDEXEC.
              IF SY-SUBRC = 0.
                PERFORM UPDATE_LIST.
              ELSE.
                EXIT.
              ENDIF.
            ENDDO.
            EXEC SQL.
              CLOSE C1
            ENDEXEC.

  • JDBC connection for SQL Server 2000

    How to connect SQL Server 2000 from java?
    If i can get any sites where i can get examples also fine.
    Thanks in advance
    Praveen.

    Developer's Daily  Java Education 
      front page | java | perl | unix | DevDirectory 
      Front Page
    Java
    Education
    Pure Java
       Articles
    JDBC 101: How to connect to an SQL database with JDBC
    Introduction
    If you're interested in connecting your Java applets and applications to standard SQL databases like Oracle, Informix, Sybase, and others, JDBC is your ticket to paradise.  The combination of Java's JDBC and standard SQL makes a simple and powerful database solution. JDBC makes the simple things easy -- without making the complex tasks too difficult either.
    In this first article in our series, we'll show you step-by-step how to establish a connection from your Java programs to an SQL database using JDBC. In the process we'll show you how to connect to two different databases -- Mini SQL (mSQL), and Interbase -- just so you can see how the code changes when you switch from one database to another.
    Obtaining the JDBC driver
    Before you start working with JDBC, you'll need a copy of the Java JDK. If you don't have it already, you can get the JDK for free at Sun's Java web site, or it will also be included with many IDE's that you can purchase, such as JBuilder or Visual Cafe.
    Once you have the JDK, the next thing you need to do is to get the correct JDBC driver for your database. In most cases the JDBC driver will be provided by your database vendor. For instance, if you purchase the Interbase database, the driver will be provided with the software, or you can obtain the most recent version at http://www.interbase.com/.
    (An exception to this rule is Mini SQL, or mSQL. Because it's a very low-cost database, the JDBC driver has actually been developed by a separate group of people, led by George Reese at imaginary.com. You can download the mSQL JDBC driver from the imaginary.com web site.)
    Once you have the correct JDBC driver for your database, install it according to the instructions that came with it. Installation instructions will vary somewhat for each vendor.
    Establishing a connection is a two-step process
    Once you have the correct JDBC driver installed, establishing a connection from your Java programs to your SQL database is pretty easy.
    Regardless of whether you're trying to connect to Oracle, Sybase, Informix, mSQL, or Interbase (or any other JDBC data source), establishing a connection to an SQL database with Java JDBC is a simple two-step process:
    Load the JDBC driver.
    Establish the connection.
    We'll show you two examples just so you can see how easy it is, and how little the code changes when you migrate from one database server to another.
    A Mini SQL Example
    Listing 1 provides the full source code required to establish a connection to a mSQL database on a server named "www.myserver.com".
      //  Establish a connection to a mSQL database using JDBC. 
    import java.sql.*; 
    class JdbcTest1 { 
        public static void main (String[] args) { 
            try { 
                // Step 1: Load the JDBC driver. 
                Class.forName("com.imaginary.sql.msql.MsqlDriver"); 
                // Step 2: Establish the connection to the database. 
                String url = "jdbc:msql://www.myserver.com:1114/contact_mgr"; 
                Connection conn = DriverManager.getConnection(url,"user1","password");  
            } catch (Exception e) { 
                System.err.println("Got an exception! "); 
                System.err.println(e.getMessage()); 
      Listing 1: This source code example shows the two steps required to establish a connection to a Mini SQL (mSQL) database using JDBC. 
    An Interbase Example
    Listing 2 provides the full source code required to establish a connection to an Interbase database. In this example, we're connecting to a local Interbase server (i.e., the server is running on the same PC that we're running the Java code on).
      //  Establish a connection to an Interbase database using JDBC. 
    import java.sql.*; 
    class JdbcTest1 { 
        public static void main (String[] args) { 
            try { 
                // Step 1: Load the JDBC driver. 
                Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); 
                // Step 2: Establish the connection to the database. 
                String url = "jdbc:odbc:contact_mgr"; 
                Connection conn = DriverManager.getConnection(url,"user1","password");  
            } catch (Exception e) { 
                System.err.println("Got an exception! "); 
                System.err.println(e.getMessage()); 
      Listing 2: This source code example shows the two steps required to establish a connection to an Interbase database using JDBC. 
    What's the difference?
    The difference between the two source code listings is very small, so we highlighted them in a dark blue color. The only difference between connecting to the two databases is:
    The name of the JDBC driver.
    The URL used to connect to the database.
    Everything else in the two source code listings -- except for the comment at the top -- is identical. Here's a slightly more detailed discussion of the two differences:
    1. The JDBC Driver
    The name of the JDBC driver will be supplied to you by your database vendor. As you can see in the class.forName() statements, these names will vary. In the first case we're using the mSQL-JDBC driver. In the second case we're using the JDBC-ODBC Bridge driver supplied with the Interbase server.
    2. The URL
    The syntax of the DriverManager.getConnection() method is:
    DriverManager.getConnection(String url, String username, String password);
    The username and password are the normal names you use to log into your database. The URL you use will again vary with the database you use. In both examples shown, we're establishing a connection to a database named contact_mgr. (We'll use this database for all of our examples in this series of JDBC articles.)
    If you stick with standard SQL commands, it can be very easy to switch from one database server to another. In fact, I've heard from several developers who are using mSQL to prototype their software (because it's so inexpensive), and then switching to another commercial vendor when it's time to take their product "live".
    Conclusion
    Establishing a connection to an SQL database with Java JDBC is a simple, two-step process. The process is nearly identical for all SQL databases, and the only real differences are (a) the driver name, and (b) the URL used to connect to the database. Your database vendor will provide this information in their documentation.
    Resources mentioned in this article
    Here are a few links to resources we mentioned in this article:
    Interbase
    The Mini SQL (mSQL) database
    The mSQL-JDBC driver at imaginary.com
      [an error occurred while processing this directive]
     

  • Problem in jdbc connection to sql server

    I hv some problem in connection. i am not sure hv to use this line of code. My server name is YC\YC and i m using window autentic usr name and passwd. How to i solve the problem? Thanks!
    Connection connection = DriverManager.getConnection(
    "jdbc:microsoft:sqlserver://<Host>:1433",<"UID>","<PWD>");

    Is it means that add a new user?
    Now i add a new user name "boon" passwd "abc123"
    SQL service manager there state my server running is YC\YC, is it that one my server name and instance?
    Connection connection = DriverManager.getConnection(
    "jdbc:microsoft:sqlserver://YC\\YC:1433", "boon", "abc123");

  • JDBC connection to SQL Server 2000

    Hi,
    I am new to Java programming. I am using Websphere Studio Site Developer 5.1 and I am having issues connecting to SQL 2000.
    This is what I have done so far:
    1. Downloaded the SQL Server 2k JDBC service pack 3 driver from Microsoft.
    2. Ran the executable. Seems like the JDBC driver was installed successfully.
    3. Created a user w/ dbo permissions on the DB that I want to access.
    Here is a snippet of my java code so far:
    Connection con = DriverManager.getConnection("jdbc:microsoft:sqlserver://DEV01:1433;DatabaseName=NG_RFQ;SelectMethod=cursor", "username", "password");
    Statement stmt = con.createStatement();
    ResultSet rs = stmt.executeQuery("SELECT * FROM Customer");
    if(rs.next()){
    customerName = rs.getString("CustomerName");
    buyerName = rs.getString("BuyerName");
    con.close();
    I have been working on this for days and can NOT get a connection established.
    Here are some of the error messages that I have been receiving thru WSSD.
    java.sql.SQLException: No suitable driver
    [8/11/04 18:11:54:815 EDT] 5e5c8f29 SystemErr R      at java.sql.DriverManager.getConnection(DriverManager.java:558)
    Can anyone please tell me what I am doing wrong? Or point me in the right direction.
    I have searched hi and lo for the answer but still no luck.
    Any help would be greatly appreciated.
    Thanks!
    -JML

    "No suitable driver" means one of two things:
    1. You forgot the Class.forName() part (quite uncommon, but if I look at the original post, this might just be the cause).
    2. The URL is wrong (usually a typo, look for colons, semicolons, parameter names etc.)
    Alin.

  • JDBC Connectivity for SQL Server 2005 Windows Authentication Mode

    Hi Everyone,
    In my Scenario we are using SQL Server 2005 with Mixed Mode Authentication. Now we are planning to move only with Windows Authentication Mode.
    We have configured DB with Window authentication mode & user id have been configured in PI channels however we are getting error. We checked microsoft site, which says Windows Authentication mode DB can not be connected using JDBC drivers.
    http://support.microsoft.com/kb/313100
    In this above link see Basic Connectivity Troubleshooting Section.
    Please let me know if someone confirued JDBC Channel Successfuly with Windows Authentication Mode.
    Thanks In Advance
    Regards,
    Bharathi.

    I think this issue is related to the way that Vista, Windows 7 and Windows 2008 / 2008 R2 treat users who are logged on to the system with an account that is a member of the local administrators group when SQL is running locally.
    If your SQL setup has left you with BUILTIN\Administrators being a member of the sysadmin server role and you start up SQL Management Studio you'd expect to be mapped to the sysadmin role if your user account is in the local administrators group, however
    these OS disable this ability and when you try to connect to the database engine SQL server doesn't know you are a member of the local administrators group.
    To get round this, close all your open SQL management studio windows and then start a new window by right clicking the icon in the start menu and chosing to run as administrator. This time when you try to connect to the SQL database engine, windows doesn't
    "hide" the fact that you are an administrator. If you need to do this a lot you can go to the compatibility tab on the properties of the shortcut and set it to always run as administrator.
    Alternatively you can install the admin tools remotely and you don't get this effect.
    Tim

Maybe you are looking for