BLOB support in standard postgresql jdbc driver - OutOfMemoryError

Hi all,
I have a problem with PostgreSQL and BLOBs.
Small BLOBs work, but with BLOBs of a certain size my code throws a java.lang.OutOfMemoryError.
The file I tried has about 2-3 MB.
Environment:
- PostgreSQL 7.2 on i686-pc-linux-gnu, compiled by GCC 2.96
- Mandrake 8.2
- 192 MB RAM
- blob column created as datatype "bytea" (maybe that is the problem)
- code posted below (BlobPostgresTest.java)
- console output posted below
- java command to run program:
    java -verbose:gc -Xmx128m -classpath .:pgjdbc2.jar BlobPostgresTest- java version as follows from "java -version" command:
    java version "1.4.0_01"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0_01-b03)
    Java HotSpot(TM) Client VM (build 1.4.0_01-b03, mixed mode)do you have an idea how to solve this problem ?
Console output (including GC activities):
=========================================
java -verbose:gc -Xmx128m -classpath .:pgjdbc2.jar BlobPostgresTest
BLOB/PostgreSQL Demo started
[GC 511K->230K(1984K), 0.0163708 secs]
preparing statement
setting binary stream
[GC 402K->273K(1984K), 0.0092325 secs]
[Full GC 273K->273K(1984K), 0.0771294 secs]
[GC 4351K->4058K(4908K), 0.0046329 secs]
[Full GC 4058K->3770K(4908K), 0.0831070 secs]
[GC 4922K->4922K(6860K), 0.0009556 secs]
[Full GC 4922K->4346K(6860K), 0.0890570 secs]
[GC 6650K->6650K(7820K), 0.0011110 secs]
[Full GC 6650K->5496K(7820K), 0.1420860 secs]
[GC 10104K->10104K(14480K), 0.0012827 secs]
[Full GC 10104K->7800K(14480K), 0.1236744 secs]
[GC 17016K->17016K(24084K), 0.0015421 secs]
[Full GC 17016K->12408K(24084K), 0.1688843 secs]
[GC 30840K->30840K(43224K), 0.0020800 secs]
[Full GC 30840K->21624K(43224K), 0.2547274 secs]
[GC 76920K->74616K(81500K), 0.0041685 secs]
[Full GC 74616K->49272K(81500K), 0.5688448 secs]
[GC 67704K->67704K(88332K), 0.0033407 secs]
[Full GC 67704K->58488K(88332K), 0.2558231 secs]
executing update
[GC 95352K->95352K(104844K), 0.0932741 secs]
[Full GC 95352K->40056K(104844K), 0.9644251 secs]
[GC 69245K->69245K(104844K), 0.0036631 secs]
[Full GC 69245K->69245K(104844K), 0.0814962 secs]
[Full GC 69245K->66324K(129728K), 1.1439123 secs]
Exception in thread "main" java.lang.OutOfMemoryError
BlobPostgresTest.java
=====================
import java.sql.*;
import java.io.*;
drop table blobdemo;
drop sequence blobdemo_id_seq;
create table blobdemo(
  id serial not null primary key,
  name varchar(50),
  content bytea);
public final class BlobPostgresTest {
    private final static String NAME = "TEST";
    //private final static String FILE_NAME = "/tmp/blob/2mb.xxx";
    private final static String FILE_NAME = "BlobPostgresTest.java";
    public final static void main(String[] args) throws Throwable {
     Connection con = null;
     Statement statement = null;
     PreparedStatement insertStatement = null;
     ResultSet rs = null;
     File file = null;
     FileInputStream fis = null;
     BufferedInputStream bis = null;
     try {
         System.out.println("BLOB/PostgreSQL Demo started");
         Class.forName("org.postgresql.Driver");
         con = DriverManager.getConnection
          ("jdbc:postgresql://localhost/template1",
           "postgres", "");
         con.setAutoCommit(true);
         statement = con.createStatement();
         // cleanup
         statement.executeUpdate("delete from blobdemo");
         // file
         file = new File(FILE_NAME);
         fis = new FileInputStream(file);
         bis = new BufferedInputStream(fis);
         // insert one record
         System.out.println("preparing statement");
         insertStatement = con.prepareStatement
          ("insert into blobdemo ( name, content ) values ( ?, ? )");
         insertStatement.setString(1, NAME);
         System.out.println("setting binary stream");
         insertStatement.setBinaryStream(2, bis, (int)file.length());
         System.out.println("executing update");
         insertStatement.executeUpdate();
         // retrieve
         rs = statement.executeQuery
          ("select id, name, content from blobdemo");
         while(rs.next()) {
          System.out.println("id=" + rs.getObject(1));
          System.out.println("name=" + rs.getObject(2));
          byte[] bytes = rs.getBytes(3);
          String content = new String(bytes);
          //System.out.println(content);
          System.out.println("retrieved " + bytes.length +  " bytes");
     } finally {
         if(rs != null) rs.close();
         if(statement != null) statement.close();
         if(insertStatement != null) insertStatement.close();
         if(con != null) con.close();
         if(fis != null) fis.close();
         if(bis != null) bis.close();
     System.out.println("BLOB/PostgreSQL Demo complete");
}

FYI: I'm in contact with the postgres team to work on the problem. it is caused by the way blobs are implemented in the jdbc driver.
http://archives.postgresql.org/pgsql-jdbc/2002-08/msg00096.php

Similar Messages

  • Is it supported to use Microsoft JDBC driver use in Java 7 (and 8) multithreaded applications?

    Hello everone
    is it supported to use Microsoft JDBC driver (the latest version) with Java 7 multithreaded application?
    I am planning to use standard Java 7 threads library and use separate JDBC objects per each thread, i.e. Java threads will not share any JDBC objects among them, only the thread-safe Java collections/data structures will be shared between threads (such as
    ConcurrentHashMap etc). The JDBC connections, resultsets, statements, etc will be created and dedicated per each individual thread.
    If it is supported - do you expect this design to scale-up well or am I better off using multiple but single-threaded Java/JBDC programs to access SQL Server 2012/2014 from Microsoft JDBC driver?
    Thanks
    Yuri Budilov
    Yuri Budilov Melbourne Australia

    >is it supported to use Microsoft JDBC driver (the latest version) with Java 7 multithreaded application?
    Yes, so long as:
    > Java threads will not share any JDBC objects among them,
    >do you expect this design to scale-up well or am I better off using multiple but single-threaded Java/JBDC programs >to access SQL Server 2012/2014 from Microsoft JDBC driver?
    Using threads should scale better than using processes (at least on Windows), as there is quite a bit of overhead with a process.  Each process has it's own JRE, it's own GC heap, its own threads...
    The bigger question, though, is how this scales on the SQL Server.  Your throughput may be limited by resources on your database server, and the thread's workloads may not be able to run concurrently because of locking. 
    David
    David http://blogs.msdn.com/b/dbrowne/

  • Installing Postgresql JDBC Driver WLS 8.1

    Hi,
    Can somebody explain how I install the JDBC Driver for postgresql? I have WLS
    8.1.2 on Win XP. I think the solution would be to set the CLASSPATH to the appropriate
    location. But how do I do this permanently?
    Thanks,
    Oliver

    Oliver wrote:
    Hi,
    Can somebody explain how I install the JDBC Driver for postgresql? I have WLS
    8.1.2 on Win XP. I think the solution would be to set the CLASSPATH to the appropriate
    location. But how do I do this permanently?
    Thanks,
    OliverHi. Read the startWeblogic script to see how it constructs the -classpath argument for
    the weblogic JVM. You can either add the postgres classes to an environment variable
    PRE_CLASSPATH, or edit the startup script etc.
    Joe

  • XA transaction support in Times Ten JDBC Driver

    Hi Chris,
    Could you confirm if the JDBC driver that comes with TimesTen 7.0, supports XA transactions. XA capability is required by the JTA inorder to coordinate the transaction context between JMS and DB transactions in our J2EE application server.
    The TimesTen is accessed over client-server mode (not embedded/collocated)
    If the answer is yes, could you confirm the respective jar file of the jdbc driver, to make sure we have the right one.
    Regards
    VInod

    Chris,
    It seems, the TimesTen jdbc driver may not be fully XA compliant.
    I used following class from "ttjdbc5.jar":
    "com.timesten.jdbc.xa.TimesTenXADataSource" as javax.sql.XADataSource but it resulted in BEA WebLogic complaining about non transaction datasource while setting up datasource in weblogic:
    BEA LOGs
    <<<<<<
    weblogic.common.ResourceException: DataSource 'vkd.test.xaDS' can not be created. It is non-transactional and so can not use XA-aware pool 'vkd.test.xaDS' at weblogic.jdbc.common.internal.DataSourceManager.checkDataSource(DataSourceManager.java:239) at weblogic.jdbc.module.JDBCModule.prepare(JDBCModule.java:258) at
    >>>>>>>>
    ANy comments?
    In case of other drivers (pointbase etc) BEA automatically detects that the driver is XA and does not show following screen/option to use GlobalDatasource for non-XA drivers etc. But in case on TimesTen driver, it does not consider it to be a XA driver and prompts for GlocalDatasource for non-XA driver etc...
    I suspect, sumething is not right either in the way we are setting up TimesTen datasource in BEA WLS or TimesTen's support XA
    Is there any writeup stating how to use TimesTen with BEA/WLS?
    Please provide your expert opinion.
    Regards
    VInod

  • PostgreSql JDBC from Red Hat Linux works on Windows not on Linux

    I started using ODI from a Windows XP box in development and Beta, and was successfully connecting to and loading data from several different database platforms including a PostgreSql database. I copied the PostgreSql JDBC driver to the ODI drivers folder, set up the connection information and it worked. When I moved from Windows XP to "Red Hat Enterprise Linux AS release 4 (Nahant Update 6)", I could no longer connect to this PostgreSql database. I put the same driver jar file "postgresql-8.3-603.jdbc3.jar" in the drivers folder and used the same connection string. All of the other drivers (Oracle, MS SQL, etc.) in that driver folder work correctly on this Linux box. I can even tell ODI to connect to the PostgreSql through the agent on the Windows XP machine and it works. That suggests that the URL must be OK, but for some reason it can't connect from the Linux box. I also tried updating to the newest driver"postgresql-8.3-604.jdbc3.jar" with no success.
    Any Ideas on what I may have missed?

    I started using ODI from a Windows XP box in development and Beta, and was successfully connecting to and loading data from several different database >>>>platforms including a PostgreSql database. I copied the PostgreSql JDBC driver to the ODI drivers folder, set up the connection information and it worked.
    When I moved from Windows XP to "Red Hat Enterprise Linux AS release 4 (Nahant Update 6)", I could no longer connect to this PostgreSql database. I >>>>put the same driver jar file "postgresql-8.3-603.jdbc3.jar" in the drivers folder and used the same connection string.
    All of the other drivers (Oracle, MS SQL, etc.) in that driver folder work correctly on this Linux box. I can even tell ODI to connect to the PostgreSql through >>>>the agent on the Windows XP machine and it works.
    That suggests that the URL must be OK, but for some reason it can't connect from the Linux box. I also tried updating to the newest driver
    "postgresql-8.3-604.jdbc3.jar" with no success.
    Any Ideas on what I may have missed?Hi,
    I'm having a problem in connecting to a PostGreSQL database, I was just wondering how you did it? I'm using a Windows Server 2003 R2 Standard Edition.
    Thanks,
    Randy

  • Sql Exception on Testing Configuration with SQL Server JDBC driver for XA

    I have a requirement of analyzing the behavior of SQL Server JDBC data sources for XA transactions in our application.We have been using Non-XA drivers for both Oracle and SQL Server as we had no requirement for transactions spanning across multiple databases in past.I have setup and tested the XA driver for Oracle (Oracle Driver (Thin XA) for Instance Connections 9.0.1,9.2.0,10,11) in Weblogic 11g and its working perfectly for transactions spanning across two databases.No when I am trying to configure weblogic 11g R1 for Sql server JDBC driver to support XA transactions with driver details as follows,
    Server:Weblogic 11g R1
    Driver Type: MS Sql Server
    Database Driver :Oracle's MS SQL Server Driver(Type 4 XA) Version:7.0,2000,2005)
    Database:SQL Server 2005(Single Instance)
    and try to create a new data source and select "Test Configuration" and following error is thrown ,
    <Mar 17, 2011 4:49:49 PM GMT+05:30> <Error> <Console> <BEA-240003> <Console encountered the following error java.sql.SQLException: [OWLS][SQLServer JDBC Driver][SQLServer]xa_open (0) returns -3
    at weblogic.jdbc.sqlserverbase.BaseExceptions40.createAppropriateSQLExceptionInstance(Unknown Source)
    at weblogic.jdbc.sqlserverbase.BaseExceptions40.createSQLException(Unknown Source)
    at weblogic.jdbc.sqlserverbase.BaseExceptions.createException(Unknown Source)
    at weblogic.jdbc.sqlserverbase.BaseExceptions.getException(Unknown Source)
    at weblogic.jdbc.sqlserver.tds.TDSRequest.processErrorToken(Unknown Source)
    at weblogic.jdbc.sqlserver.tds.TDSRequest.processReplyToken(Unknown Source)
    at weblogic.jdbc.sqlserver.tds.TDSRPCRequest.processReplyToken(Unknown Source)
    at weblogic.jdbc.sqlserver.tds.TDSRequest.processReply(Unknown Source)
    at weblogic.jdbc.sqlserver.SQLServerImplStatement.getNextResultType(Unknown Source)
    at weblogic.jdbc.sqlserverbase.BaseStatement.commonTransitionToState(Unknown Source)
    at weblogic.jdbc.sqlserverbase.BaseStatement.postImplExecute(Unknown Source)
    at weblogic.jdbc.sqlserverbase.BasePreparedStatement.postImplExecute(Unknown Source)
    at weblogic.jdbc.sqlserverbase.BaseStatement.commonExecute(Unknown Source)
    at weblogic.jdbc.sqlserverbase.BaseStatement.executeUpdateInternal(Unknown Source)
    at weblogic.jdbc.sqlserverbase.BasePreparedStatement.executeUpdate(Unknown Source)
    at weblogic.jdbcx.sqlserver.SQLServerImplXAResource.executeXaRpc(Unknown Source)
    at weblogic.jdbcx.sqlserver.SQLServerImplXAResource.executeXaRpc(Unknown Source)
    at weblogic.jdbcx.sqlserver.SQLServerImplXAResource.open(Unknown Source)
    at weblogic.jdbcx.sqlserverbase.BaseXAConnection.init(Unknown Source)
    at weblogic.jdbcx.sqlserverbase.BaseXAConnection40.init(Unknown Source)
    at weblogic.jdbc.sqlserverbase.BaseClassCreatorForJDBC40.createXaConnection(Unknown Source)
    at weblogic.jdbcx.sqlserverbase.BaseXADataSource.getXAConnection(Unknown Source)
    at com.bea.console.utils.jdbc.JDBCUtils.testConnection(JDBCUtils.java:550)
    at com.bea.console.actions.jdbc.datasources.createjdbcdatasource.CreateJDBCDataSource.testConnectionConfiguration(CreateJDBCDataSource.java:450)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.beehive.netui.pageflow.FlowController.invokeActionMethod(FlowController.java:870)
    at org.apache.beehive.netui.pageflow.FlowController.getActionMethodForward(FlowController.java:809)
    at org.apache.beehive.netui.pageflow.FlowController.internalExecute(FlowController.java:478)
    at org.apache.beehive.netui.pageflow.PageFlowController.internalExecute(PageFlowController.java:306)
    at org.apache.beehive.netui.pageflow.FlowController.execute(FlowController.java:336)
    at org.apache.beehive.netui.pageflow.internal.FlowControllerAction.execute(FlowControllerAction.java:52)
    at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
    at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.access$201(PageFlowRequestProcessor.java:97)
    at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor$ActionRunner.execute(PageFlowRequestProcessor.java:2044)
    at org.apache.beehive.netui.pageflow.interceptor.action.internal.ActionInterceptors$WrapActionInterceptorChain.continueChain(ActionInterceptors.java:64)
    at org.apache.beehive.netui.pageflow.interceptor.action.ActionInterceptor.wrapAction(ActionInterceptor.java:184)
    at org.apache.beehive.netui.pageflow.interceptor.action.internal.ActionInterceptors$WrapActionInterceptorChain.invoke(ActionInterceptors.java:50)
    at org.apache.beehive.netui.pageflow.interceptor.action.internal.ActionInterceptors$WrapActionInterceptorChain.continueChain(ActionInterceptors.java:58)
    at org.apache.beehive.netui.pageflow.interceptor.action.internal.ActionInterceptors.wrapAction(ActionInterceptors.java:87)
    at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.processActionPerform(PageFlowRequestProcessor.java:2116)
    at com.bea.console.internal.ConsolePageFlowRequestProcessor.processActionPerform(ConsolePageFlowRequestProcessor.java:261)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
    at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.processInternal(PageFlowRequestProcessor.java:556)
    at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.process(PageFlowRequestProcessor.java:853)
    at org.apache.beehive.netui.pageflow.AutoRegisterActionServlet.process(AutoRegisterActionServlet.java:631)
    at org.apache.beehive.netui.pageflow.PageFlowActionServlet.process(PageFlowActionServlet.java:158)
    at com.bea.console.internal.ConsoleActionServlet.process(ConsoleActionServlet.java:256)
    at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
    at com.bea.console.internal.ConsoleActionServlet.doGet(ConsoleActionServlet.java:133)
    at org.apache.beehive.netui.pageflow.PageFlowUtils.strutsLookup(PageFlowUtils.java:1199)
    at com.bea.portlet.adapter.scopedcontent.ScopedContentCommonSupport.executeAction(ScopedContentCommonSupport.java:686)
    at com.bea.portlet.adapter.scopedcontent.ScopedContentCommonSupport.processActionInternal(ScopedContentCommonSupport.java:142)
    at com.bea.portlet.adapter.scopedcontent.PageFlowStubImpl.processAction(PageFlowStubImpl.java:106)
    at com.bea.portlet.adapter.NetuiActionHandler.raiseScopedAction(NetuiActionHandler.java:111)
    at com.bea.netuix.servlets.controls.content.NetuiContent.raiseScopedAction(NetuiContent.java:181)
    at com.bea.netuix.servlets.controls.content.NetuiContent.raiseScopedAction(NetuiContent.java:167)
    at com.bea.netuix.servlets.controls.content.NetuiContent.handlePostbackData(NetuiContent.java:225)
    at com.bea.netuix.nf.ControlLifecycle$2.visit(ControlLifecycle.java:180)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:324)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walk(ControlTreeWalker.java:130)
    at com.bea.netuix.nf.Lifecycle.processLifecycles(Lifecycle.java:395)
    at com.bea.netuix.nf.Lifecycle.processLifecycles(Lifecycle.java:361)
    at com.bea.netuix.nf.Lifecycle.processLifecycles(Lifecycle.java:352)
    at com.bea.netuix.nf.Lifecycle.runInbound(Lifecycle.java:184)
    at com.bea.netuix.nf.Lifecycle.run(Lifecycle.java:159)
    at com.bea.netuix.servlets.manager.UIServlet.runLifecycle(UIServlet.java:388)
    at com.bea.netuix.servlets.manager.UIServlet.doPost(UIServlet.java:258)
    at com.bea.netuix.servlets.manager.UIServlet.service(UIServlet.java:199)
    at com.bea.netuix.servlets.manager.SingleFileServlet.service(SingleFileServlet.java:251)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at com.bea.console.utils.MBeanUtilsInitSingleFileServlet.service(MBeanUtilsInitSingleFileServlet.java:47)
    at weblogic.servlet.AsyncInitServlet.service(AsyncInitServlet.java:130)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3592)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2202)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2108)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1432)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    I followed the instruction in weblogic jdbc drivers guide to configure the JTA Transactions to support XA on SQL Server machine and weblogic server which included,
    1.Copying sqljdbc.dll copied to SQL_Server_Root/bin directory from WL_HOME\server\lib.
    2.Copied instjdbc.sql to sql server machine and executed the script with following output,
    Changed database context to 'master'.
    Msg 3701, Level 11, State 5, Server SQLDB, Procedure sp_dropextendedproc, Line 16
    Cannot drop the procedure 'xp_jdbc_open', because it does not exist or you do not have permission.
    Msg 3701, Level 11, State 5, Server SQLDB, Procedure sp_dropextendedproc, Line 16
    Cannot drop the procedure 'xp_jdbc_open2', because it does not exist or you do not have permission.
    Msg 3701, Level 11, State 5, Server SQLDB, Procedure sp_dropextendedproc, Line 16
    Cannot drop the procedure 'xp_jdbc_close', because it does not exist or you do not have permission.
    Msg 3701, Level 11, State 5, Server SQLDB, Procedure sp_dropextendedproc, Line 16
    Cannot drop the procedure 'xp_jdbc_close2', because it does not exist or you do not have permission.
    Msg 3701, Level 11, State 5, Server SQLDB, Procedure sp_dropextendedproc, Line 16
    Cannot drop the procedure 'xp_jdbc_start', because it does not exist or you do not have permission.
    Msg 3701, Level 11, State 5, Server SQLDB, Procedure sp_dropextendedproc, Line 16
    Cannot drop the procedure 'xp_jdbc_start2', because it does not exist or you do not have permission.
    Msg 3701, Level 11, State 5, Server SQLDB, Procedure sp_dropextendedproc, Line 16
    Cannot drop the procedure 'xp_jdbc_end', because it does not exist or you do not have permission.
    Msg 3701, Level 11, State 5, Server SQLDB, Procedure sp_dropextendedproc, Line 16
    Cannot drop the procedure 'xp_jdbc_end2', because it does not exist or you do not have permission.
    Msg 3701, Level 11, State 5, Server SQLDB, Procedure sp_dropextendedproc, Line 16
    Cannot drop the procedure 'xp_jdbc_prepare', because it does not exist or you do not have permission.
    Msg 3701, Level 11, State 5, Server SQLDB, Procedure sp_dropextendedproc, Line 16
    Cannot drop the procedure 'xp_jdbc_prepare2', because it does not exist or you do not have permission.
    Msg 3701, Level 11, State 5, Server SQLDB, Procedure sp_dropextendedproc, Line 16
    Cannot drop the procedure 'xp_jdbc_commit', because it does not exist or you do not have permission.
    Msg 3701, Level 11, State 5, Server SQLDB, Procedure sp_dropextendedproc, Line 16
    Cannot drop the procedure 'xp_jdbc_commit2', because it does not exist or you do not have permission.
    Msg 3701, Level 11, State 5, Server SQLDB, Procedure sp_dropextendedproc, Line 16
    Cannot drop the procedure 'xp_jdbc_rollback', because it does not exist or you do not have permission.
    Msg 3701, Level 11, State 5, Server SQLDB, Procedure sp_dropextendedproc, Line 16
    Cannot drop the procedure 'xp_jdbc_rollback2', because it does not exist or you do not have permission.
    Msg 3701, Level 11, State 5, Server SQLDB, Procedure sp_dropextendedproc, Line 16
    Cannot drop the procedure 'xp_jdbc_forget', because it does not exist or you do not have permission.
    Msg 3701, Level 11, State 5, Server SQLDB, Procedure sp_dropextendedproc, Line 16
    Cannot drop the procedure 'xp_jdbc_forget2', because it does not exist or you do not have permission.
    Msg 3701, Level 11, State 5, Server SQLDB, Procedure sp_dropextendedproc, Line 16
    Cannot drop the procedure 'xp_jdbc_recover', because it does not exist or you do not have permission.
    Msg 3701, Level 11, State 5, Server SQLDB, Procedure sp_dropextendedproc, Line 16
    Cannot drop the procedure 'xp_jdbc_recover2', because it does not exist or you do not have permission.
    creating JDBC XA procedures
    instxa.sql completed successfully.
    3.Verified that MSDTC service is running on both SQL Server and weblogic machines with XA Transaction enabled and DTC option enabled for both inbound and outbound connections.
    4.Copied sqljdbc.jar (version 3.0 downloaded from msdn portal) to "C:\Oracle\Middleware\wlserver_10.3\server\ext\jdbc\sqlserver" directory and updated weblogic_classpth variable in commEnv.cmd file.
    set WEBLOGIC_CLASSPATH=%JAVA_HOME%\lib\tools.jar;%BEA_HOME%\utils\config\10.3\config-launch.jar;%WL_HOME%\server\lib\weblogic_sp.jar;%WL_HOME%\server\lib\weblogic.jar;%FEATURES_DIR%\weblogic.server.modules_10.3.2.0.jar;%WL_HOME%\server\lib\webservices.jar;%ANT_HOME%/lib/ant-all.jar;%ANT_CONTRIB%/lib/ant-contrib.jar;C:\Oracle\Middleware\wlserver_10.3\server\ext\jdbc\sqlserver\server\ext\jdbc\sqlserver\sqljdbc.jar
    Can some one please provide some input on whats causing this and any other steps needs to be followed to implement XA support using SQL Server JDBC driver.

    You seem to have done everything correctly and diligently. I would ask that you open
    an official support case.

  • Postgresql-jdbc on Suse Linux

    Hi,
    I am writing a Java Swing application on Suse Linux and want to add Embedded SQL to it. The application should interact with a PostgreSQL database running on my local machine. The compiler complains that it cannot find the org.postgresql package included in the code. I'm guessing the problem is that the classpath is not set properly. But when I try to add the postgresql-jdbc driver to the classpath using "export CLASSPATH=$CLASSPATH:/usr/share/pgsql/pg73b1jdbc1.jar", the program stops recognizing the other Java files it uses. How do I set the classpath up properly?
    Code sample:
    import java.awt.*;
    import javax.swing*;
    import java.sql.*;
    import org.postgresql.*;
    public class MyClass
    public static void main (String [] args)
    MyFrame frame = new MyFrame();
    MyPanel panel = new MyPanel();
    // more code here
    MyClass.java:4: package org.postgresql does not exist
    import org.postgresql.*;
    ^
    1 error
    Any help is much appreciated.
    Marina.

    Hi, I figured it out - thanks to JimDinosaur's response, although to a different thread. I am posting a reply in case other people had the same question.
    So, I had two problems: first, the package wasn't recognized; second, the rest of the Java files used by the code.
    Jim suggested to use javac -classpath, listing all the directories needed, for the packages and the files. So I did, with the files directory being my current directory:
    javac -classpath /usr/share/pgsql/pg73b1jdbc1.jar:. CloningGUI.java
    Jim, you rock! :)

  • CLassCastException with oracle.jdbc.driver.OracleCallableStatement

    Hello,
    I get a ClassCastException when I try to execute a Stored Procedure with WL6.1
    and the JDriver.
    I have a servlet who intanciate a Bean and call to his execute() method in this
    way:
    Context ctx = null;
    Hashtable ht = new Hashtable();
    Connection conn = null;
    ht.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
    try {
    ctx = new InitialContext(ht);
    javax.sql.DataSource ds = (javax.sql.DataSource)ctx.lookup(connPool);
    conn = ds.getConnection();
    conn.setAutoCommit(true);
    SvcEmpEstObt empEstObt = new SvcEmpEstObt();
    empEstObt.setMaxRows(100);
    empEstObt.setConnection(conn);
    //Get parameters from Http Get and set the JB
    empEstObt.setEmpRut(request.getParameter("rut"));
    empEstObt.setEmpTimeStamp(request.getParameter("timestamp"));
    //Execute Service
    empEstObt.execute();
    /* ********* the execute() method of the jb is listed here */
    public int execute() throws ClassNotFoundException, SQLException{
    intreturnedRows = 0;
    try {if (connection == null){
    try {Class.forName(driver);
    } catch (ClassNotFoundException e) {
    System.err.println("ClassNotFoundException: " + e);
    throw e;
    connection = DriverManager.getConnection(url, user, password);
    row = -1;
    srv_message = String.valueOf(maxRows);
    String sp = "{call SvcEmpEstObt_Pkg.SvcEmpEstObt(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)}";
    oracle.jdbc.driver.OracleCallableStatement procout = (oracle.jdbc.driver.OracleCallableStatement)
    connection.prepareCall(sp); // The exception is here
    procout.registerOutParameter(1, Types.VARCHAR);
    procout.setString(1, srv_message);
    procout.setString(2, empRut);
    procout.setString(3, empTimeStamp);
    procout.registerOutParameter(4, Types.VARCHAR);
    procout.registerOutParameter(5, Types.VARCHAR);
    procout.registerOutParameter(6, Types.INTEGER);
    int elemSqlType = OracleTypes.INTEGER;
    int elemMaxLen = 0;
    procout.registerIndexTableOutParameter(7, maxRows, elemSqlType, elemMaxLen);
    elemSqlType = OracleTypes.VARCHAR;
    elemMaxLen = 30;
    // register the OUT parameter
    procout.registerIndexTableOutParameter(8, maxRows, elemSqlType, elemMaxLen);
    elemSqlType = OracleTypes.VARCHAR;
    elemMaxLen = 21;
    // register the OUT parameter
    procout.registerIndexTableOutParameter(9, maxRows, elemSqlType, elemMaxLen);
    elemSqlType = OracleTypes.INTEGER;
    elemMaxLen = 0;
    // register the OUT parameter
    procout.registerIndexTableOutParameter(10, maxRows, elemSqlType, elemMaxLen);
    // execute the call
    procout.execute();
    sqlWarning = procout.getWarnings();
    srv_message = procout.getString(1);
    returnStatus = new Integer(srv_message.substring(0,1)).intValue();
    dagMessage = new DagMessage();
    dagMessage.oracleMessage(srv_message);
    // access the value using JDBC default mapping
    empEstTitulo = procout.getString(4);
    empEstUniv = procout.getString(5);
    empEstNivel = procout.getInt(6);
    curCodigo = (BigDecimal[]) procout.getPlsqlIndexTable(7);
    curNombre = (String[]) procout.getPlsqlIndexTable(8);
    curFecha = (String[]) procout.getPlsqlIndexTable(9);
    curDuracion = (BigDecimal[]) procout.getPlsqlIndexTable(10);
    // close the statement
    procout.close();
    if (curCodigo == null) {
    return 0;
    } else {
    return curCodigo.length;
    } catch (SQLException e) {
    SQLException ex = e;
    System.err.println("\n--- SQLException caught ---\n");
    while (ex != null) {
    System.err.println("Message: " + ex.getMessage ());
    System.err.println("SQLState: " + ex.getSQLState ());
    System.err.println("ErrorCode: " + ex.getErrorCode ());
    ex = ex.getNextException();
    System.out.println("");
    throw e;
    Does Someone has an idea why it happens ?

    Hans,
    Could you give us the whole text of exception?
    Regards,
    Slava Imeshev
    "Hans" <[email protected]> wrote in message
    news:[email protected]...
    >
    It Works! Thanx a lot ....
    I was working with a previous version of my App ... I fixed the problemand now
    i can Cast to weblogic.jdbc.vendor.oracle.OracleCallableStatement,
    But ...
    I get the following Exception:
    SQL Exception:
    registerIndexTableOutParameter is not supported by the
    underlying JDBC driver weblogic.jdbc.pool.Connection
    What I need to do ?
    /* this is what i`m trying to make */
    weblogic.jdbc.vendor.oracle.OracleCallableStatement procout =(weblogic.jdbc.vendor.oracle.OracleCallableStatement)
    connection.prepareCall(sp);
    procout.registerOutParameter(1, Types.VARCHAR);
    procout.setString(1, srv_message);
    procout.setString(2, empRut);
    procout.setString(3, empTimeStamp);
    procout.registerOutParameter(4, Types.VARCHAR);
    procout.registerOutParameter(5, Types.VARCHAR);
    procout.registerOutParameter(6, Types.INTEGER);
    int elemSqlType = OracleTypes.INTEGER;
    int elemMaxLen = 0;
    procout.registerIndexTableOutParameter(7, maxRows, elemSqlType,elemMaxLen);
    >
    elemSqlType = OracleTypes.VARCHAR;
    elemMaxLen = 30;
    // register the OUT parameter
    procout.registerIndexTableOutParameter(8, maxRows, elemSqlType,elemMaxLen);
    >
    elemSqlType = OracleTypes.VARCHAR;
    elemMaxLen = 21;
    // register the OUT parameter
    procout.registerIndexTableOutParameter(9, maxRows, elemSqlType,elemMaxLen);
    >
    elemSqlType = OracleTypes.INTEGER;
    elemMaxLen = 0;
    // register the OUT parameter
    procout.registerIndexTableOutParameter(10, maxRows, elemSqlType,elemMaxLen);
    >
    >
    "Hans" <[email protected]> wrote:
    Thanx Slava,
    But I have the same problem again...
    I replace oracle.jdbc.driver.OracleCallableStatement with
    weblogic.jdbc.vendor.oracle.OracleCallableStatement
    and I get the same ClassClastException in
    weblogic.jdbc.vendor.oracle.OracleCallableStatement procout =
    (weblogic.jdbc.vendor.oracle.OracleCallableStatement)
    connection.prepareCall(sp);
    Any ideas ??
    "Slava Imeshev" <[email protected]> wrote:
    Hi Hans,
    You can not cast returned object to
    oracle.jdbc.driver.OracleCallableStatement
    when accessing oracle db via connection pool.
    It can be casted to weblogic.jdbc.vendor.oracle.OracleCallableStatement.
    Here is a list of methods supported by this interface:
    void clearParameters() throws java.sql.SQLException;
    void registerIndexTableOutParameter(int i, int j, int k, int l) throws
    java.sql.SQLException;
    void registerOutParameter(int i, int j, int k, int l) throws
    java.sql.SQLException;
    java.sql.ResultSet getCursor(int i) throws java.sql.SQLException;
    java.io.InputStream getAsciiStream(int i) throws
    java.sql.SQLException;
    java.io.InputStream getBinaryStream(int i) throwsjava.sql.SQLException;
    java.io.InputStream getUnicodeStream(int i) throwsjava.sql.SQLException;
    >>>
    Regards,
    Slava Imeshev
    "Hans" <[email protected]> wrote in message
    news:[email protected]...
    Hello,
    I get a ClassCastException when I try to execute a Stored Procedurewith
    WL6.1
    and the JDriver.
    I have a servlet who intanciate a Bean and call to his execute()
    method
    in
    this
    way:
    Context ctx = null;
    Hashtable ht = new Hashtable();
    Connection conn = null;
    ht.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFact
    or
    y");
    try {
    ctx = new InitialContext(ht);
    javax.sql.DataSource ds = (javax.sql.DataSource)ctx.lookup(connPool);
    conn = ds.getConnection();
    conn.setAutoCommit(true);
    SvcEmpEstObt empEstObt = new SvcEmpEstObt();
    empEstObt.setMaxRows(100);
    empEstObt.setConnection(conn);
    file://Get parameters from Http Get and set the JB
    empEstObt.setEmpRut(request.getParameter("rut"));
    empEstObt.setEmpTimeStamp(request.getParameter("timestamp"));
    file://Execute Service
    empEstObt.execute();
    /* ********* the execute() method of the jb is listed here */
    public int execute() throws ClassNotFoundException, SQLException{
    intreturnedRows = 0;
    try {if (connection == null){
    try {Class.forName(driver);
    } catch (ClassNotFoundException e) {
    System.err.println("ClassNotFoundException: " + e);
    throw e;
    connection = DriverManager.getConnection(url, user, password);
    row = -1;
    srv_message = String.valueOf(maxRows);
    String sp = "{call SvcEmpEstObt_Pkg.SvcEmpEstObt(?, ?, ?, ?, ?, ?,?, ?,
    oracle.jdbc.driver.OracleCallableStatement procout =(oracle.jdbc.driver.OracleCallableStatement)
    connection.prepareCall(sp); // The exception is here
    procout.registerOutParameter(1, Types.VARCHAR);
    procout.setString(1, srv_message);
    procout.setString(2, empRut);
    procout.setString(3, empTimeStamp);
    procout.registerOutParameter(4, Types.VARCHAR);
    procout.registerOutParameter(5, Types.VARCHAR);
    procout.registerOutParameter(6, Types.INTEGER);
    int elemSqlType = OracleTypes.INTEGER;
    int elemMaxLen = 0;
    procout.registerIndexTableOutParameter(7, maxRows, elemSqlType,elemMaxLen);
    elemSqlType = OracleTypes.VARCHAR;
    elemMaxLen = 30;
    // register the OUT parameter
    procout.registerIndexTableOutParameter(8, maxRows, elemSqlType,elemMaxLen);
    elemSqlType = OracleTypes.VARCHAR;
    elemMaxLen = 21;
    // register the OUT parameter
    procout.registerIndexTableOutParameter(9, maxRows, elemSqlType,elemMaxLen);
    elemSqlType = OracleTypes.INTEGER;
    elemMaxLen = 0;
    // register the OUT parameter
    procout.registerIndexTableOutParameter(10, maxRows, elemSqlType,elemMaxLen);
    // execute the call
    procout.execute();
    sqlWarning = procout.getWarnings();
    srv_message = procout.getString(1);
    returnStatus = new Integer(srv_message.substring(0,1)).intValue();
    dagMessage = new DagMessage();
    dagMessage.oracleMessage(srv_message);
    // access the value using JDBC default mapping
    empEstTitulo = procout.getString(4);
    empEstUniv = procout.getString(5);
    empEstNivel = procout.getInt(6);
    curCodigo = (BigDecimal[]) procout.getPlsqlIndexTable(7);
    curNombre = (String[]) procout.getPlsqlIndexTable(8);
    curFecha = (String[]) procout.getPlsqlIndexTable(9);
    curDuracion = (BigDecimal[]) procout.getPlsqlIndexTable(10);
    // close the statement
    procout.close();
    if (curCodigo == null) {
    return 0;
    } else {
    return curCodigo.length;
    } catch (SQLException e) {
    SQLException ex = e;
    System.err.println("\n--- SQLException caught ---\n");
    while (ex != null) {
    System.err.println("Message: " + ex.getMessage ());
    System.err.println("SQLState: " + ex.getSQLState ());
    System.err.println("ErrorCode: " + ex.getErrorCode ());
    ex = ex.getNextException();
    System.out.println("");
    throw e;
    Does Someone has an idea why it happens ?

  • Pda and jdbc driver

    hello,
    i have asked this question before also .
    my question is can i use jdbc driver in handhelds(PDA) so that i can connect my database which is residing on desktop through my java program.
    i got answer that there is no jdbc driver that can be put on handhelds but now i have came to know that i can use hsqldb jdbc driver and postgresql jdbc driver in handhelds to access desktop database.
    so i am very much confused that whether i can use jdbc driver in handhelds on not?
    kindly help me
    thanking u in advance
    its
    abhishek chopra

    hi,
    thanks for reply. ya i visited that site .but its not free as u have said.
    but i inquired about hsqldb jdbc driver in their forum and mailing lists and they have said that hsqldb drivers can be used on handheld devices to access desktop database.
    same thing for postgresql jdbc driver. they all r telling that drivers came in the form of jar file and we can deploye it on handheld (pda) with the java application
    so sir how can i get confirmed about it.
    about ur another option to use intermediate servelets to access database is also good. but problem will be that when we have to access that via http call and for it we require internet connection to access to servlet which is on our lan network(if am not wrong) . i have doubt that is internet connection is required to communicate to servlet if we connect to our pda in network.
    please suggest me.
    thanking u
    its
    abhishek

  • PostgreSQL JDBC Timeout

    Hello... how can i set a timeout to my PostgreSQL jdbc connections? My application cant wait the large solaris default tcp timeout....
    thanks...

    I tryed to use the loginTimeout propertie and it appear work fine, but when the timeout occurs he keeps locked a thread called "PostgreSQL JDBC driver connection thread" that confuses my thread counter based on ThreadGroup.... i think that this loginTimeout does not use the setSOTimeout....

  • Java.lang.OutOfMemoryError (Microsoft SQL Server JDBC driver)

    Hi everyone,
    I am getting a java.lang.OutOfMemoryError when performing a simple query to a database. The query produces only one row (and will always produce only one row). However, the statement that produces the second column in the resultset is very long (>256) characters, so could that be it?
    Also, I am executing thousands of SQL statements with no difficulty. I have double-checked that I am cleaning up all of my database resources, so I don't think that this is it. Do I have to do anything else besides closing the statement and resultset?
    There is no stack trace, otherwise I would have posted it :(
    Also, as an aside - is the Microsoft JDBC driver for SQL Server the best one to use? It seems poorly supported and slow at times. Are there any alternatives?
    Thanks for your time :)
    Ben

    It is running after thousands of other queries. I'll test to see what happens if I run it by itself.
    I am closing the connection. In fact, I am running all of these statements over the same connection and simply opening and closing resultsets.
    So a bug in the driver you think?
    Thanks for the reply :)
    Ben

  • 9i: JDBC-driver for SQL ANSI 92 Standard

    Does anyone know when the Oracle JDBC driver will support the SQL ANSI 92 Standard for joins?
    If not, are there any workarounds?

    Oracle 9i supports this syntax, so anything that connects to a 9i database will be able to use it. Unless the driver is reqriting the query, which I doubt, you should be able to use any client API with a 9i server.
    Justin

  • OpenSQLException: JDBC driver not supported?

    Hi @ all,
    I need to connect to a DataSource with the WebAS 7 via SQLJ. As I try to connect to it with the SQL Engine set to "Vendor SQL" I get:
    "The given connection "com.sap.engine.services.dbpool.cci.ConnectionHandle" is not an Open SQL connection"
    As I try to get a connection to the dataSource via SQLJ with SQL Engine set to "Open SQL" or "Native SQL", I get the following Exception:
    ResourceException in method ConnectionFactoryImpl.getConnection(): com.sap.engine.services.dbpool.exceptions.BaseResourceException: SQLException thrown by the physical connection: com.sap.sql.log.OpenSQLException: JDBC driver not supported for MS_SQL_SERVER database.
    How can I get the SQLJ- Support?
    Kind regards,
    Uwe
    Message was edited by:
            Uwe Kunath

    Hi Uwe, all,
    for using Native SQL/JDBC or Open SQL/JDBC, the database itself and the JDBC driver must be recognized as being in the supported set. The answer to that depends on what you mean in detail by "Web AS 7". Roughly speaking, it should be the JDBC driver released by Microsoft.
    Open SQL/SQLJ is only available with a Open SQL/JDBC data source. Hence, there is no way around using Open SQL/JDBC.
    Now, Open SQL/JDBC and Open SQL/SQLJ both requires tables (and other database objects) to be deployed via the Open SQL for Java Dictionary. Up to and including WebAS Java 7.1, the Open SQL/Dictionary supports deployment to the system database, i.e. the database (and schema) used by the installed server itself.
    Given the above, the JDBC driver for a Open SQL/JDBC data source must already be present, because it must be the driver used by the server itself. When defining data sources, it is referred to as "system driver".
    This leaves us with a Open SQL/JDBC data source to the system schema. You can then also consider to establish a data source alias to the server's system datasource.
    Hope this helps. Best Regards, Dietamr

  • Multibyte character support in Jdbc Driver

    Hi,
    I want to use multibyte characters in my Application and to store it in my database.
    If my database provider does not support a Multibyte data type, Can my
    Jdbc Driver provide support for the same ?
    For a column of type ISO88591 which is of single byte by nature , Can we insert Multibyte characters by providing some support for the same in my Jdbc Driver ?
    If yes , How could this support be provided in the Jdbc Driver.
    Please provide some clarification on the same.
    Thanks in Advance,
    Jay

    Hi,
    I want to use multibyte characters in my Application
    and to store it in my database.
    If my database provider does not support a Multibyte
    data type, Can my
    Jdbc Driver provide support for the same ?
    For a column of type ISO88591 which is of single byte
    by nature , Can we insert Multibyte characters by
    providing some support for the same in my Jdbc Driver
    This is a very very bad idea in general. If your database is Oracle, it's a horrificly stupendously bad idea.
    First, collation ("ORDER BY" and other things) will be badly broken.
    Second, it will very likely prevent the database from being upgraded to a multi-byte version.
    Third, it commonly will cause various database utilities to not work.
    There are plenty of databases, many of them free, that support UTF8.

  • JDBC Driver to Support nvarchar/nchar/ntext

    I downloaded the jdbcKona driver for MS SQL Server 7/2000 from
    the "Download Center". This page claims that this driver
    supports the international data types (nvarchar, nchar, and
    ntext) on SQL Server 7/2000.
    http://www.weblogic.com/docs51/techstart/install_jmsq4.html
    The examples provided in this download were very old (12/19/2001)
    and none of them showed anything dealing with these international
    types so I wonder if this driver truly does support these data
    types or if I somehow downloaded the wrong driver?
    I'd be interested in seeing some examples of how to use these
    international types to store various languages in the database.
    Something along the lines of performing this query (but doing
    so via JDBC where the text within the single quotation marks
    is a parameter that could be English, French, etc.) would be
    great:
    select address from names where name = N'&#1073;&#1091;&#1081;&#1085;&#1086;'
    Thanks.

    Grace wrote:
    Okay, that kind of makes sense, but are you saying that if I
    have this table:
    NAMES
    name nvarchar(50)
    address nvarchar(100)
    and I have a prepared statement like this:
    dbstatement = dbconnection.prepareStatement(
    "insert into address values ( ?, ? )" );
    that this set of JDBC:
    dbstatement.setString( 1, "&#1073;&#1091;&#1081;&#1085;&#1086;" );
    dbstatement.setString( 2, "123 &#1087;&#1086;&#1079;&#1074;&#1086;&#1083;&#1103;&#1077;&#1090;"
    ResultSet rs = dbStatement.executeQuery();
    would work the same way as this set of JDBC:
    dbstatement.setString( 1, "Alfred" );
    dbstatement.setString( 2, "123 West Main Street" );
    ResultSet rs = dbStatement.executeQuery();
    This does not appear to be the case. When I try this, I get a
    SQLException: string or binary data would be truncated. If I
    modify the query so that it doesn't throw any errors I see
    garbage text inserted into the database.
    Are you aware of any examples of this?No JDBC driver will change or interpret the content of any string parameter values. Is
    that syntax supposed to be understood by your DBMS? I think you need to create
    whatever string you want to send, as a Java String with the unicode characters you want,
    then set the parameter(s) with the value. Eg:
    String myFirst = "\u1073\u1091\u1081\u1085\u1086"; // note Java syntax for unicode characters...
    dbStatement.setString(1, myFirst );
    Also, the SQL you are doing is an insert, not a query, so use executeUpdate(). ExecuteQuery()
    will throw an exception.
    Joe
    >
    >
    Joseph Weinstein <[email protected]> wrote:
    Grace wrote:
    I downloaded the jdbcKona driver for MS SQL Server 7/2000 from
    the "Download Center". This page claims that this driver
    supports the international data types (nvarchar, nchar, and
    ntext) on SQL Server 7/2000.
    http://www.weblogic.com/docs51/techstart/install_jmsq4.html
    The examples provided in this download were very old (12/19/2001)
    and none of them showed anything dealing with these international
    types so I wonder if this driver truly does support these data
    types or if I somehow downloaded the wrong driver?
    I'd be interested in seeing some examples of how to use these
    international types to store various languages in the database.
    Something along the lines of performing this query (but doing
    so via JDBC where the text within the single quotation marks
    is a parameter that could be English, French, etc.) would be
    great:
    select address from names where name = N'&#1073;&#1091;&#1081;&#1085;&#1086;'The driver support of nvarchar etc. means that it will transmit string
    values,
    such as PreparedStatement parameters, with the "N'" prefix, and all java
    (16-bit) characters as unicode. This way, the DBMS will not strip the
    characters
    with a varchar map. The driver doe not alter the static contents of SQL
    that
    the application sends. It would be the DBMS that would interpret (or
    not)
    the SQL such as you posed above.
    Joe

Maybe you are looking for