BUg In JDBC Driver 1.2 - Fails To Call Stored Procedures Which Use Ap_name() Internally.
Nov 9, 2007
Using the MSSQL JDBC 1.2 driver (Oct 2007 release), we don't seem to be able to call stored procedures which internally uses app_name() function to fill into database tables .
This driver fails to access such stored procedures in both SQL Server 2000 and SQL Server 2005 databases.
The previous 1.1 driver (2006), suceeds in both cases.
Here is a test case which demonstrates this problem.
create table ICS_ConsraintTest (PrimaryIdentifier varchar(64),
ServiceProvider varchar(64),
SecondaryID varchar(64),
SecondaryServiceProvider varchar(64),
Description varchar(64),
PanoramaObject varchar(64),
Operation int,
ScalingFactor int,
DisplayAs float,
FeedType int,
InputValue int,
OutputValue float,
salary float,
birthdate datetime,
CONSTRAINT SimpleTestConstraint CHECK((len(ltrim([PrimaryIdentifier])) > 0
and len(ltrim([ServiceProvider])) > 0
and len(ltrim([SecondaryID])) > 0
and len(ltrim([PanoramaObject])) > 0
and [salary] <> 0.0)))
Stored procedure id defined as follows:
CREATE PROCEDURE SP_ICS_TestWithConstraints1(@PrimaryIdentifier varchar(64),
@PrimaryServiceProvider varchar(64),
@ServiceProvider varchar(64),
@SecondaryID varchar(64),
@SecondaryServiceProvider varchar(64),
@Description varchar(64),
@PanoramaObject varchar(64),
@Operation int,
@ScalingFactor int,
@DisplayAs float,
@FeedType int,
@InputValue int,
@OutputValue float,
@salary float,
@birthdate datetime) AS
BEGIN
BEGIN TRANSACTION
BEGIN
/* Insert */
INSERT INTO ICS_ConsraintTest ( PrimaryIdentifier,
ServiceProvider,
SecondaryID,
SecondaryServiceProvider,
Description,
PanoramaObject,
Operation,
ScalingFactor,
DisplayAs,
FeedType,
InputValue,
OutputValue,
salary,
birthdate)
VALUES ( @PrimaryIdentifier,
@ServiceProvider,
app_name(),
@SecondaryServiceProvider,
@Description,
@PanoramaObject,
@Operation,
@ScalingFactor,
@DisplayAs,
@FeedType,
@InputValue,
@OutputValue,
@salary,
@birthdate)
END
COMMIT TRANSACTION
END
Check out the app_name() is passed as the SecondaryID which causes the failure.
View 6 Replies
ADVERTISEMENT
Aug 2, 2007
We are seeing a regression bug with the Microsoft JDBC driver 1.2 CTP.
Using this driver, we don't seem to be able to call stored procedures which return a result set, if those stored procedures use temporary tables internally.
The 1.2 CTP driver fails to access such stored procedures in both SQL Server 2000 and SQL Server 2005 databases.
The previous 1.1 driver, suceeds in both cases.
Here is a test case which demonstrates the problem (with IP addresses and logins omitted). The prDummy stored procedure being called is quite simple, and I've copied it below:
Code Snippet
public class MicrosoftJDBCDriverCallingStoredProceduresTest extends TestCase {
// CREATE PROCEDURE [dbo].[prDummy]
// AS
//
// CREATE TABLE #MyTempTable (
// someid BIGINT NOT NULL PRIMARY KEY,
// userid BIGINT,
// )
//
// SELECT 1 as TEST2, 2 as TEST2
// GO
public void testStoredProcedureViaDirectJDBC() {
Connection conn = null;
String driverInfo = "<unknown>";
String dbInfo = "<unknown>";
try {
// Set up driver & DB login...
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
String connectionUrl = "jdbc:sqlserver://xxx.xxx.xxx.xxx:1433";
Properties dbProps = new Properties();
dbProps.put("databaseName", "xxxxxx");
dbProps.put("user", "xxxxxx");
dbProps.put("password", "xxxxxx");
// Get a connection...
conn = DriverManager.getConnection(connectionUrl, dbProps);
driverInfo = conn.getMetaData().getDriverName() + " v" + conn.getMetaData().getDriverVersion();
dbInfo = conn.getMetaData().getDatabaseProductName() + " v" + conn.getMetaData().getDatabaseProductVersion();
// Perform the test...
CallableStatement cs = conn.prepareCall("{CALL prDummy()}");
cs.executeQuery();
// If the previous line executes okay, the test is passed...
System.out.println("Accessing "" + dbInfo + "" with driver "" + driverInfo + "" calls the stored procedure successfully.");
}
catch (Exception e) {
// Fail the unit test...
fail("Accessing "" + dbInfo + "" with driver "" + driverInfo + "" fails to call the stored procedure: " + e.getMessage());
}
finally {
// Close the connection...
try { if (conn != null) conn.close(); } catch (Exception ignore) { }
}
}
}
The output of this test under both drivers and accessing both databases is as follows:
Code Snippet
Accessing "Microsoft SQL Server v8.00.2039" with driver "Microsoft SQL Server 2005 JDBC Driver v1.1.1501.101" calls the stored procedure successfully.
Accessing "Microsoft SQL Server v9.00.3042" with driver "Microsoft SQL Server 2005 JDBC Driver v1.1.1501.101" calls the stored procedure successfully.
Accessing "Microsoft SQL Server v8.00.2039" with driver "Microsoft SQL Server 2005 JDBC Driver v1.2.2323.101" fails to call the stored procedure: The statement did not return a result set.
Accessing "Microsoft SQL Server v9.00.3042" with driver "Microsoft SQL Server 2005 JDBC Driver v1.2.2323.101" fails to call the stored procedure: The statement did not return a result set.
View 17 Replies
View Related
Aug 22, 2007
Hi,
I am using SQL server 2005 stored procedures being called from my java application using the CallableStatement. As long as my stored procedure is a simple and direct Select statement things are moving nicely.
But my stored procedures are a little bit more complicated and this causes problems for me to parse the data in a ResultSet.
a sample stored procedure:
Create procedure sp_Get
@cat int,
@itemId bigint
as
declare @results table (tableId bigint, label varchar(200), typeId int)
if @cat = 1
begin
insert @results (tableId, label, typeId)
select
tableId = personId,
label = fname + lname,
typeId = 1
from Person where catId = @itemId
insert @results (tableId, label, typeId)
select
tableId = prospectId,
label = prospect,
typeId = 2
from Prospects where catId = @itemId
end
else if @cat = 2
begin
insert @results (tableId, label, typeId)
select
tableId = companyId,
label = Company,
typeId = 1
from Company where regionId = @itemId
end
/* result set*/
select
tableId,
label,
typeId
from @results
GO
my java code:
Connection conn = this.getConnection() //opens connection to db
CallableStatement cmd = conn.prepareCall(" { call sp_Get (?,?) }");
cmd.setInteger("cat", 1);
cmd.setLong("itemId", 2);
//this returns false?
boolean hasResults = cmd.execute();
//this also returns false?
boolean moreResults = cmd.getMoreResults();
The strange part of this is that when you execute this query in the SQL Server Managent Studio it returns 1 result set.
Why is my java code not able to see this result?
Thanks for any help,
- Rogier
View 1 Replies
View Related
May 22, 2007
Hi,
I have a Tomcat server which uses the SQL 2005 JDBC Driver 1.1 .
A couple of weeks ago I successfully got it to work with database failover. However, I've now run in to another problem whereby it fails to failback i.e. the DB fails for a second time back to the original server.
If I restart the Tomcat server following a failback everything continues to work again. Or at least until I do another failover and failback!
It also doesn't seem to make any difference which DB server (primary or failoverPartner) is the principal when we perform a failover and failback ... It will always fails on the failback.
This also seems to be the case with the 1.2 CTP driver.
Does anyone have any ideas what may be the issue?
Many Thanks in Advance!
Nick
View 16 Replies
View Related
Aug 3, 2015
We are using Microsoft jdbc driver 4.1 connecting to SQL 2012, which has a linked server to another SQL 2012 server.Will linked server calls work with kerberos authentication using Microsoft jdbc driver 4.1? connection string looks like this:
jdbc:sqlserver://SQL01;database= product_db; integrated Security= true;authenticationScheme=JavaKerberos..We have the linked server connection configured to use "Be made using the login's current security context"
Date 8/3/2015 4:19:56 PM
Log SQL Server (Current - 8/3/2015 3:49:00 PM)
Source Logon
Message
Login failed for user 'NT AUTHORITYANONYMOUS LOGON'. Reason: Could not find a login matching the name provided. [CLIENT: 10.196.21.4]
View 2 Replies
View Related
Oct 9, 2006
Hi.
How can I get the messages sent by the server while I'm executing a stored procedure via the JDBC driver?
I need to get my own debug messages (done through the print() function)
and also standard server messages (such as "x row(s) affected" or
results from SET STATISTICS TIME ON). Is this possible?
Many thanks.
Carlos
View 4 Replies
View Related
Jun 25, 2007
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
View 1 Replies
View Related
Apr 14, 2008
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/"
"WebRoot/WEB-INF/web.xml":
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsichemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<resource-ref>
<res-ref-name>jdbc/DefaultDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</web-app>
"WebRoot/META-INFcontext.xml":
<?xml version="1.0" encoding="UTF-8"?>
<Context>
<Resource name="jdbc/DefaultDS"
auth="Container"
type="javax.sql.DataSource"
username="tec"
password="tec"
driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDrive"
url="jdbcqlserver://localhost:1433/tec;databaseName=tec;user=tec;password=test;"
validationQuery="select 1"
maxActive="10"
maxIdle="2"/>
</Context>
Classpath:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="com.genuitec.eclipse.j2eedt.core.J2EE14_CONTAINER"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/dom.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/jaxen-full.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/jaxp-api.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/jdbc2_0-stdext.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/sqljdbc.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/jstl.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/mail.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/sax.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/saxpath.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/standard.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/xalan.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/xercesImpl.jar"/>
<classpathentry kind="output" path="WebRoot/WEB-INF/classes"/>
</classpath>
Code to connect:
import java.io.Serializable;
import java.sql.*;
import javax.sql.*;
import javax.naming.*;
public int testConnect(){
Connection conn = null;
InitialContext ctx = null;
java.sql.Statement stmt = null;
try {
ctx = new InitialContext();
Context envCtx = (Context) ctx.lookup("java:comp/env");
DataSource ds = (DataSource) envCtx.lookup("jdbc/DefaultDS");/*This is generating the Cannot load JDBC driver class... error*/
conn = ds.getConnection();
stmt = conn.createStatement();
return CONSTANT.SUCCESS;
} catch (Exception e) {
return CONSTANT.FAILURE;
}finally {
try {
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
if (ctx != null)
ctx.close();
} catch (Exception ex) {
// do nothing
return CONSTANT.FAILURE;
}
}
}
Any ideas would be greatly appreciated.
View 17 Replies
View Related
Oct 26, 2006
I have a procedure that uses varchar(max) as output parameter, when I tried to retrieve
the result of calling the procedure, the result is truncated to 4000 character. Is this a driver bug?
Any workaround?
Here is the pseudo code:
create Procedure foo(@output varchar(max))
{
set @foo = 'string that has more than 4000 characters...';
return;
}
Java code:
CallableStatement cs = connection.prepareCall("{call foo ?}");
cs.registerOutputParameter(1, Types.longvarchar); // also tried Types.CLOB.
cs.execute();
String result = cs.getString(1); // The result is truncated to 4000 char.
-- Also tried
CLOB clob = cs.getClob(1);
long len = clob.length(); // The result is 4000.
Thanks,
Eric Wang
View 3 Replies
View Related
Aug 8, 2006
Hi all,
We've just stumbled on a 1.0 version incompatibility with the JDBC specs.
Problem: A table with SMALLINT column. According to JDBC specs version 3.0
(p.B-179) and 4.0 (p.221)), the value should be converted to Integer type.
Unfortunatelly we get a Short object :(
Now, I remember, this case was also affecting old JSQLConnect driver from
DataDirect. Could that problem sneak to new MS driver too?
Please let me know any resolution to this problem if exists.
The issue has not been fixed in CTP 1.1 version. Any ideas if it can be fixed??
Cheers,
Piotr
View 1 Replies
View Related
Mar 8, 2005
How to call store procedures in VB 6.0 application?
View 1 Replies
View Related
Sep 12, 2014
I am trying to execute the following to call a DB2 stored procedure from SQL Server 2000.
DECLARE @ICVR_CLAIM_NBR VARCHAR(19)
SET @ICVR_CLAIM_NBR= 'XXXXXXXXXXX'
EXEC('call PPSPCOL.X2COVSEL (?)', @ICVR_CLAIM_NBR) AT [EXCEEDPP]
and I get the following error
Incorrect syntax near ','. The above code works comfortably in SQL Server 2008. Why?
View 1 Replies
View Related
Jun 19, 2007
I'm just wondering what people think of these two design methods for calling sql stored procedures from an asp.net web app.
When returning data.
1. Having one call to the database (a stored procedure) that returns many recordsets (datatables) for each item on the form / page
vs.
2. Creating DAL objects for each action (many calls to stored procedures for each form /page.
Is there anyone with experience with #1 that can tell me if it was a good idea or not.
My database admin is strongly against the application making any more then one stored procedure call per page request. I would argue that the time saved execution wise isn't significant enough. The other problem with #1 is that business logic become part of the stored procedure and that can make your application less modular.
View 8 Replies
View Related
Oct 1, 2006
Hello Everyone,
I have created a stored procedure something like this :
CREATE PROCEDURE [dbo].[Get_Lots]
AS
BEGIN
SELECT _id, description FROM LOT
RETURN 0
END
GO
I want to know what would be the return parameter in above procedure.
Secondly, If I need to get the value in DataSet using C# how can I do that....If someone can provide with an example.....
Thanks,
Harsimrat
View 1 Replies
View Related
Aug 24, 2000
I am having a problem trying to run a stored procedure
from a MS SQL Server version 6.5 server. The stored
procedure calls another stored procedure on a MS SQL
Server version 7.0 server.
The job task always fails with the error message...
"Login failed for user 'sa'. (Message 18456)".
I can run the stored procedure from the T-Query window
on the 6.5 server successfully but it will not run
as a job task.
Does anyone have any suggestions?
View 1 Replies
View Related
Apr 23, 2008
Hello friends......How are you ? I want to ask you all that how can I do the following ?
I want to now that how many ways are there to do this ?
How can I call one or more stored procedures into perticular one Stored Proc ? in MS SQL Server 2000/05.
View 1 Replies
View Related
Nov 20, 2003
How can I get a group of stored procedures or a job to run on the sql server from Access?
Thanks
View 1 Replies
View Related
Oct 6, 2006
Is these .net methods supported to call from SQL Stored Procedures?
public static int MultiplyMany(params int[] intArray)
{
int result = 1;
foreach(int now in intArray)
{
result *= now;
}
return result;
}
public static void TestOut(string name, out string firstName, out string lastName)
{
int spaceIndex = name.IndexOf(' ');
firstName = name.Substring(0, spaceIndex);
lastName = name.Substring(++spaceIndex);
}
View 5 Replies
View Related
May 10, 2001
Hello,
When I transfer/copy tables from one database to another (on the same SQL Server), everything is fine. When I try to tranfer/copy Stored Procedures, I get the error message:
"Failed to copy objects from Microsoft SQL Server to Microsoft SQL Server."
I am using the DTS import/export wizard to do this.
Thanks,
Bruce
View 2 Replies
View Related
Jul 20, 2005
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
View 1 Replies
View Related
Feb 6, 2004
Is oracle and Microsoft JDBC drivers are same? Oracle 9i comes with JDBC, can I use the same driver to access the Microsoft SQL Server?
View 1 Replies
View Related
Jun 1, 2004
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?
Thanks
Shabassa
View 1 Replies
View Related
Dec 7, 2004
Hi,
Does SQL Server Express ship with a JDBC driver? ... Hardly so, but is it available somewhere?
Rgds and thanks, PP
View 3 Replies
View Related
Mar 8, 2006
Hi guys,
Where can I download the JDBC Driver for our MS SQL Server 7 ?
Thank you.
View 3 Replies
View Related
Jul 23, 2005
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
View 2 Replies
View Related
Jul 20, 2005
I need a free, redistributable JDBC driverfrom MS SQL Server. (MSDE2000a)
View 2 Replies
View Related
Oct 2, 2006
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"?
View 3 Replies
View Related
Nov 19, 2007
Hi Mixxo,
I also am having this problem! if you get an solution,
send me an answer or add my msn: griciolli@hotmail.com
View 1 Replies
View Related
Jan 18, 2001
please help it's urgent i badly need the jdbc driver for mssql for my project
thank u
View 1 Replies
View Related
Jan 18, 2005
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?
thank you and excuse for by bad english! :p
View 2 Replies
View Related
Mar 30, 2004
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)
WebLogic Server:
Weblogic 6.1
Windows 2000 (SP4)
Weblogic JDBC Driver (6.1)
Any input would be welcome.
Regards,
hmscott
View 2 Replies
View Related
Feb 1, 2008
Hi, All!
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?
View 6 Replies
View Related
Oct 7, 2006
Hi;
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?
thanks - dave
View 33 Replies
View Related