Sending Table Variable Argument Using MSFT JDBC Driver
Nov 21, 2006
I want to call a stored procedure that has a table variable as its parameter. I am using the MSFT SQL Server 2005 JDBC driver 1.1, however I don't know how to construct a table variable from the Java side to place within a CallableStatement. The CallableStatement interface allows me to set various types of parameters (e.g. Boolean, Byte, Blob, Array, etc.) but I don't see anything for table variable.
Hi. I want to call a stored procedure that has a table variable as its parameter. I am using the MSFT SQL Server 2005 JDBC driver 1.1, however I don't know how to construct a table variable from the Java side to place within a CallableStatement. The CallableStatement interface allows me to set various types of parameters (e.g. Boolean, Byte, Blob, Array, etc.) but I don't see anything for table variable.
I am unable to send null values through the Microsoft JDBC 1.1 driver to a stored procedure. Please look at the thread already started on the SQL Server Transact SQL Forum at http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1772215&SiteID=1
Hello,I am working with the driver JDBC and I have a strange error that I can't find in Google for example.Caused by: com.seeburger.smarti.util.SmartiEJBException: nested exception is: com.seeburger.smarti.dao.DAOSysException: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Must declare the variable '@P2GROUP'.I don't know what is this variable '@P2GROUP'.Does anybody know it ?Thanks
I have read similar posts to this, but I am still having problems.
I am trying to use connection pooling to connect to a local SQL Server 2005 database. I am running my application using MyEclipse Enterprise Workbench. I have verified that sqljdbc.jar resides in "WebRoot/WEB-INF/lib/"
Hi All,Hope someone can help me...Im trying to highlight the advantages of using table variables asapposed to temp tables within single scope.My manager seems to believe that table variables are not advantageousbecause they reside in memory.He also seems to believe that temp tables do not use memory...Does anyone know how SQL server could read data from a temp tablewithout passing the data contained therein through memory???Is this a valid advantage/disadvantage of table variables VS temptables?
Hi,Could some please tell me whether Microsoft provides Type 2 and Type 4jdbc driver ? For Type 4 MS providescom.microsoft.jdbc.sqlserver.SQLServerDriver driver. What is thecofiguration required for type 2 driver and what driver class filesrequired ?Its very urgent to me please reply.Ajay
Hi I just downloaded the Microsoft JDBC Driver for SQL Server 2000. Now it tells me SQL Server 7 is not supported. :o I already checked the JDBC Driver list on suns site. Its quite long and only states MS SQL Server without any version number. Can you recommend a particular driver? Preferrably without any cost. :D Or am I better of with the jdbc/odbc bridge?
Hello all,I have a question about the SQL Server JDBC driver. I was wondering ifanyone knows what the default prefetch size is (in number of rows).Also, does anyone know if an entire packet is sent (i.e. padded withnull values) if there is not enough data to fill it?Thanks for your help!ty
what is the jdbc driver for sql express? is it "sqljdbc"? then what is its "complete" name in the class path:"com.microsoft.sqlexpress.sqljdbc"? and for the conection url is it "jdbc:microsoft:sqlexpress://localhost/sqlexpress"?
Hi at all, i'm new here, your communitiy seems too much preparated. My question is simple... i must to connect via jdbc to a ms sql server 2000 database, but i'm in doubt to select which jdbc driver to use. your suggest over microsoft'drivers? i found on the internet the open source drivers jdts...what about them?
I appear to have an issue here with WebLogic and SQL Server. The WebLogic server is set up to create a pool of connections (max 15, min 4) to the SQL server. The idea is that connections are "leased" to the application for the duration of a transaction and then returned to the pool at the end of the lease. The pool can grow to up to 15 simultaneous connections -- after that the applications must wait for the next available connection in the pool.
As activity subsides, connections are supposed to be dropped down to the minimum number of 4 connections (which are maintained open continuously).
The problem that I can see from SQL is that there are tens of connections that are open (should not be more than 15, right?) and some of these connections have been held open for several days (going back to the last time we rebooted the server 2 weeks ago). I am told that this is a relatively new phenomenon; new within the last 3 months, anyway. I have tried killing some of these processes manually and now they show up in "Current Activity" as being in a "Killed/Rollback" state.
Does anyone have any experience with JDBC/Weblogic and SQL? Any experiences similar to this?
More information: SQL Server: SQL Server 2000 (SP3) Windows NT (SP6)
I'm using Borland's ProcedureDataSet to retrieve data from a SQL 2005 database using the JDBC 1.2 Driver. My problem is with the money data type. The Borland's component translate money into BigDecimal and if the value in the database in NULL then I get a NullPointerException.
On MSDN I saw money was referred as Double which is wrong! Any Ideas?
I used SQLServerDatabaseMetaData (which requires a connection to return this data which seems unnecessary) to get:
name: Microsoft SQL Server 2005 JDBC Driver version: 1.1.1501.101 Passing a url of: jdbc:sqlserver://localhost:1433;DatabaseName=Northwind;IntegratedSecurity=true
I get the error: Oct 7, 2006 3:46:09 PM com.microsoft.sqlserver.jdbc.AuthenticationJNI <clinit> WARNING: Failed to load the sqljdbc_auth.dll Exception in thread "main" com.microsoft.sqlserver.jdbc.SQLServerException: This driver is not configured for integrated authentication.
I copied over x86sqljdbc_auth.dll and then it worked. I assume this is required with the jar file. This leads to a couple of questions:
What are the files xax86sqljdbc_xa.dll & x64 files for? Are they needed? The jar file can just travel with my java code. Should the dll do the same or does it need to be in the path and/or the default directory? Are there any other files needed or just these two?
We are deploying our application with the v1.1 JDBC driver, but are getting a little worried with some of the results of our recent stress tests. I wanted to see if anyone could offer any insight into this problem. Also, do you have any expectation for a release date for the 1.2 driver (not CTP).
Under heavy load with a number of concurrent processes loading to a few tables in our database through batched INSERT statements (called executeBatch against a prepared statement), we see these exceptions coming back from the driver:
com.vectorsgi.tw.services.exception.LoaderException: java.lang.NullPointerException at com.vectorsgi.tw.loader.X937HibernateLoader.loadToDatabase(X937HibernateLoader.java:813) at com.vectorsgi.tw.loader.X937HibernateLoader.loadToDatabase(X937HibernateLoader.java:482) at com.vectorsgi.tw.loader.X937HibernateLoader.loadToDatabase(X937HibernateLoader.java:466) at com.vectorsgi.viex.workflow.capture.LoadListener.execute(LoadListener.java:91) at com.vectorsgi.viex.workflow.capture.LoadListener.actionFired(LoadListener.java:55) at fluximpl.JavaActionImpl.execute(JavaActionImpl.java:6) at fluximpl.gl.a(gl.java:348) at fluximpl.gl.b(gl.java:417) at fluximpl.gl.a(gl.java:236) at fluximpl.dm.d(dm.java:58) at fluximpl.tlb.run(tlb.java:10) Caused by: java.lang.NullPointerException at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecuteBatchPreparedStatement(Unknown Source) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PreparedStatementBatchExecutionRequest.executeStatement(Unknown Source) at com.microsoft.sqlserver.jdbc.CancelableRequest.execute(Unknown Source) at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeRequest(Unknown Source) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeBatch(Unknown Source) at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeBatch(NewProxyPreparedStatement.java:1723) at com.vectorsgi.tw.loader.X937HibernateLoader.loadItems(X937HibernateLoader.java:1326) at com.vectorsgi.tw.loader.X937HibernateLoader.loadToDatabase(X937HibernateLoader.java:637) ... 10 more
In a test of 20 "jobs" 2 failed with this error, so its certainly not frequent, but not fleeting either. What is also strange about this is that after the two failures (not immediately back to back but within a few minutes of each other) we got a primary key constraint error:
com.vectorsgi.tw.services.exception.LoaderException: java.sql.BatchUpdateException: com.microsoft.sqlserver.jdbc.SQLServerException: Violation of PRIMARY KEY constraint 'PK__X937_ITEM__0E7B75BC'. Cannot insert duplicate key in object 'X937_ITEM'. at com.vectorsgi.tw.loader.X937HibernateLoader.loadToDatabase(X937HibernateLoader.java:813) at com.vectorsgi.tw.loader.X937HibernateLoader.loadToDatabase(X937HibernateLoader.java:482) at com.vectorsgi.tw.loader.X937HibernateLoader.loadToDatabase(X937HibernateLoader.java:466) at com.vectorsgi.viex.workflow.capture.LoadListener.execute(LoadListener.java:91) at com.vectorsgi.viex.workflow.capture.LoadListener.actionFired(LoadListener.java:55) at fluximpl.JavaActionImpl.execute(JavaActionImpl.java:6) at fluximpl.gl.a(gl.java:348) at fluximpl.gl.b(gl.java:417) at fluximpl.gl.a(gl.java:236) at fluximpl.dm.d(dm.java:58) at fluximpl.tlb.run(tlb.java:10) Caused by: java.sql.BatchUpdateException: com.microsoft.sqlserver.jdbc.SQLServerException: Violation of PRIMARY KEY constraint 'PK__X937_ITEM__0E7B75BC'. Cannot insert duplicate key in object 'X937_ITEM'. at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeBatch(Unknown Source) at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeBatch(NewProxyPreparedStatement.java:1723) at com.vectorsgi.tw.loader.X937HibernateLoader.loadItems(X937HibernateLoader.java:1333) at com.vectorsgi.tw.loader.X937HibernateLoader.loadToDatabase(X937HibernateLoader.java:637) ... 10 more
Now- I realize that this is very straight forward, but we are almost certain that our key generation code cannot generate a duplicate key. We have been running it 24x7 for three years at a number of customer sites without ever getting a duplicate (under the open-source jTDS driver). Now that we are trying to move to a better driver that is actively supported, we see these primary key violations every once in a while. Its very hard to consistently replicate, but we have received it from 5 of the past 20 stress tests.
I mainly want insight into the NullPointerException, but if there is any possibility that a driver issue could be contributing to my primary key problem--that would sure make a lot of sense. (I realize its a long shot!)
Hi; I am having problem figuring out if the JDBC Driver for MS SQL Server 2005 is faster or setting up a data source from Administrative tools/Data Sources. I have run several tests and in all tests, the odbc datasource is faster. In that case, why having the trouble of downloading a driver if I am not wrong. I have understood that the native driver is always faster than the odbc bridge. Thanks in advance
Hi all, I am building a program using Java and SQL express and I need the driver in order to connect to the database. I have downloaded I think a version for sql server 2005 but it did not work. Can somebody tell me if such driver exists?
I'm trying to debug some deadlock problems I'm having with an XA JDBC application that uses the Microsoft JDBC driver.
Problem is, I can't see much of the info in the Profiler I always get the TextData colum filled with things such as : 'sp_cursorclose 180150269' for my BatchCompleted. I've tried other event but I can't see any of the SQL code. My other application does not use XA and I see the statements fine.
I was wondering how I could get to see the TextData with the SQL sent to the server via the XA connection if it's possible. Is it another event or column I need?
hi, i am using sqljdbc.jar in a java applet and i am using Netbeans for development. i am able to connect with the SQL Server from the IDE. however, when i try to debug the SQL part of the code, i am getting an exception at :
where it says that it cannot find the class. i am also putting down the exception information.
java.lang.reflect.InvocationTargetException 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 com.sun.javaws.Launcher.executeApplication(Launcher.java:1273) at com.sun.javaws.Launcher.executeMainClass(Launcher.java:1219) at com.sun.javaws.Launcher.doLaunchApp(Launcher.java:1066) at com.sun.javaws.Launcher.run(Launcher.java:105) at java.lang.Thread.run(Thread.java:619) Caused by: java.lang.NoClassDefFoundError: com/microsoft/sqlserver/jdbc/SQLServerDriver at VncViewer.performSql(VncViewer.java:115) at VncViewer.readParameters(VncViewer.java:743) at VncViewer.init(VncViewer.java:152) at VncViewer.main(VncViewer.java:53) ... 9 more Caused by: java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at com.sun.jnlp.JNLPClassLoader.findClass(JNLPClassLoader.java:256) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
i am currently using java web start to debug the application. earlier, the application was running smoothly during debug (when not being run through java web start), but was failing to run when started externally say within a html file as an applet. however, when i used java web start, the exception is being pointed to the line in bold. i have added sqljdbc.jar to the list of libraries and have added it under the compile as well as the run time configuration. i would appreciate if this exception could be resolved. if i have to configure anything in the classpath, pls suggest how i can configure it under netbeans.
We are in need of a JDBC driver (version 3) to support some autonumbering in SQLServer. We've found a couple, very expensive stuff (JTurbo & DataDirect), these drivers can be more expensive than a SQLServer license. Any other ideas/sources?
Hello JoeOver the past several years, I have found your responses to jdbcusage/driver related issues to be extremely helpful. I am sure thatyou're very busy so I will make my question as brief as possible - thereason I didn't post this to a newsgroup is that I don't want to hearany more hype or links to benchmarks (since the vast majority of thebenchmarks don't test concurent/mixed-transaction environments). (I amalso posting a modified version of this message to some newsgroups, butbased on past responses - don't have too much hope that these will leadto a resolution.) If the only way to answer this question would be tohave a phone conversation, my company would be more than happy to pay aconsulting-service fee for your time.My situation:My company has a enterprise level web-app that targets SQL Server. Wedon't use J2EE - so we stick to a simple to administer web containers(JRun,Tomcat). Recently, we have been getting worse and worseperformance from our jdbc driver (we use the free MS jdbc driver) -things like strange transaction resource handling, chopy overallperformance, etc.. I have spent significant time tweaking it (followingvarious advice - many times yours - on newgroups... I can go intodetails, but I don't want to take up your time). As the project'sarchitect, I need to do something about this problem - but varioushigh-level tunnings that I have done to the way we use connections withthis driver haven't significantly improved perfomance under normaleveryday load. (Our queries often span tables with millions of records,and are relatively dynamic. We use a seperate pool of autocommit-offconnections for writes, and autocommit-on connecions for reads)So, then, my question - in your expert opinion - what is the BESTdriver from SQL Server 2000 given the following needs:Things I need it to have are solid jdbc 1.0, solid transactionhandling, decent concurrent load handling, stable implementation ofresource handling (i.e. auto closing result sets when parent statementsclose, closing of result sets & statements when connections close) andsupport for multiple open statements/result sets per connection.Things I do not have a direct need for:Connection Pooling (I keep my own pool of open connections), DataSourcesupport, distributed transactions or 2-phase commit support, RowSetvariants, jdbc 3.0 autokey generation, J2EE compliance. We do make useof updatable result sets - but I don't care if it isn't supported sinceI can still use MS driver for those, as they are mainly done it batchjobs).Things that are nice:It would also be good to have a driver that can handle prep statementcaching on a driver level (vs connection level) although this isn't anecessity, and if it is available - it would need to have aconfigurable caching strategy (or have a way to be turned off :)I very much appreciate your help in advanceThanksGary BogachkovSystem ArchitectStericycle Direct Return
Dear All,I developed an web application which use MS SQL Server 2000. Iencounter the following SQLException "[Microsoft][SQLServer 2000Driver for JDBC]Error setting up static cursor cache". Did anyoneencounter this problem before? What does this exception mean and howto solve this problem?[Remarks: The web application work properly on development machine andthis machine but encounter this exception when move to anothermachine, so is this exception related to the machine?]Thank you for your attention.Yours faithfully,Benny
We currently have a SQL 2005 database with Thai Collation (Thai_CI_AI). When we try using Microsoft's JDBC SQL Server driver to connect to the database, we get a "SQLException: Codepage 874 is not supported by the Java environment." error.
We're currently using this code to connect:
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); con = DriverManager.getConnection( "jdbc: sqlserver://x.x.x.x;databasename=xyz;" + "user=xxx;password=xxx"