Problems With JDBC

I downloaded the latest version on JDBC from Microsoft and I got problems.
Indeed, when fetching a smallint from SQL Server i got instead an Integer.
How can i do to avoid such a problem?
Some hints?

many tanks, gaetano

View Replies


Cannot Load JDBC Driver Class ''

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/"

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns=""


<?xml version="1.0" encoding="UTF-8"?>
<Resource name="jdbc/DefaultDS"
validationQuery="select 1"

<?xml version="1.0" encoding="UTF-8"?>
<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"/>

Code to connect:

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();

} catch (Exception e) {
}finally {
try {
if (stmt != null)
if (conn != null)
if (ctx != null)
} catch (Exception ex) {
// do nothing

Any ideas would be greatly appreciated.

View Replies View Related

MS JDBC Driver Incompatibility With JDBC 3.0 Specs

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??



View Replies View Related

2000 JDBC Vs 2005 JDBC

I've got an import app written in Java. One table I'm importing from contains 22 million records. When I run the app in a 2000 environment, I have my max heap set at 512, and the table gets imported. When I run in a 2005 environment, I have to change the max heap to 1152 or it will error out with a similiar error: The system is out of memory. Use server side cursors for large result sets:Java heap space. Result set size:854,269,999. JVM total memory size:1,065,484,288. (<--this is with max heap at 1024)

what is the difference between the 2000 and 2005 JDBC that I have to set max heap in one and not the other?

View Replies View Related

Help With JDBC Driver

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 Replies View Related


I have a MSDE database that I am trying to connect to with JDBC. I don'thave SQL Server installed. Is this possible? When I try to connect I getthe error:java.sql.SQLException: [Microsoft][SQLServer 2000 Driver forJDBC][SQLServer]Login failed for user 'sa'. Reason: Not associated with a trusted SQL Serverconnection.From what I've read on the web it looks like I need to set the securitysettings to allowfor SQL authentication as well as NT authentication. Is that correct? Andcan thatbe done with just MSDE?I think that I have MSDE 2000 installed (it actually came with a differentapplication).I just downloaded the latest SQL Server JDBC driver.Thanks,Bruce

View Replies View Related

Need A JDBC Driver

I need a free, redistributable JDBC driverfrom MS SQL Server. (MSDE2000a)

View Replies View Related

JDBC For MS SQL Server

Dear all,Where can I find JDBC for MS SQL server?Thx for reply.Victoria

View Replies View Related

Please Help, Jdbc Error

I am trying to access ms sql server 2000 using jdbc, the code compiled but produce this kind of error:

java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establi
hing socket.
at tion(Unknown Sourc
at n(Unknown Source)
at n(Unknown Source)
at<init>(Unknown Source

at So
at onnection(Unknown
at n Source)
at Source)
at java.sql.DriverManager.getConnection(DriverManager .java:512)
at java.sql.DriverManager.getConnection(DriverManager .java:193)
at org.apache.jsp.addvideo$jsp._jspService(addvideo$j
at org.apache.jasper.runtime.HttpJspBase.service(Http
at javax.servlet.http.HttpServlet.service(HttpServlet .java:853)
at org.apache.jasper.servlet.JspServlet$JspServletWra pper.service(JspSe
at org.apache.jasper.servlet.JspServlet.serviceJspFil e(
at org.apache.jasper.servlet.JspServlet.service(JspSe
at javax.servlet.http.HttpServlet.service(HttpServlet .java:853)
at ternalDoFilter(App
at Filter(Application
at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapper
at org.apache.catalina.core.StandardPipeline.invokeNe xt(StandardPipelin
at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.ja
at org.apache.catalina.core.ContainerBase.invoke(Cont

at org.apache.catalina.core.StandardContextValve.invo ke(StandardContext
at org.apache.catalina.core.StandardPipeline.invokeNe xt(StandardPipelin
at org.apache.catalina.valves.CertificatesValve.invok e(CertificatesValv
at org.apache.catalina.core.StandardPipeline.invokeNe xt(StandardPipelin
at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.ja
at org.apache.catalina.core.ContainerBase.invoke(Cont

at org.apache.catalina.core.StandardContext.invoke(St
at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.
at org.apache.catalina.core.StandardPipeline.invokeNe xt(StandardPipelin
at voke(ErrorDispatch
at org.apache.catalina.core.StandardPipeline.invokeNe xt(StandardPipelin
at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.
at org.apache.catalina.core.StandardPipeline.invokeNe xt(StandardPipelin
at org.apache.catalina.valves.AccessLogValve.invoke(A
at org.apache.catalina.core.StandardPipeline.invokeNe xt(StandardPipelin
at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.ja
at org.apache.catalina.core.ContainerBase.invoke(Cont

at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineVa
at org.apache.catalina.core.StandardPipeline.invokeNe xt(StandardPipelin
at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.ja
at org.apache.catalina.core.ContainerBase.invoke(Cont

at org.apache.catalina.connector.http.HttpProcessor.p rocess(HttpProcess
at org.apache.catalina.connector.http.HttpProcessor.r un(HttpProcessor.j

Here is my full code I'm using jsp for accessing the database

<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
.style1{color: #FF0000}

String title = request.getParameter("Title");
String price = request.getParameter("Price");
ResultSet rs = null;
Connection connection =DriverManager.getConnection("jdbc:microsoft:sqlserver://WIN-WBL8VT0HEPJ:1433","sa","sa");
if (connection != null)
System.out.println("Succesfully connected");
Statement stmt = connection.createStatement();
String query = "Insert into Video (Title, Price) values('" + title + "','" +price+ "')";

query = "select * from Video";
rs = stmt.executeQuery(query);
<h4 class="style1">.: A new video titled: <%= title %> has been added with a price of <%= price %> :.</h4>
You currently have the following videos:
<table width="50%" border="1">
<td><div align="center"><strong>Title</strong></div></td>
<td><div align="center"><strong>Price</strong></div></td>
<td><%= rs.getString("Title") %></td>
<td><%= rs.getString("Price") %></td>
}catch(Exception e)
System.err.println("Cannot connect to database server");
<div align="center"><br>
<a href="video.html">back</a>

Anyone know what is wrong?

View Replies View Related

JDBC Driver

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 Replies View Related

Need JDBC Driver For MS SQL 7.00.847

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?



View Replies View Related

JDBC Drivers

Is anyone out there using Unix/Java/Sun app server to connect to SQL Server via JDBC? If so, what drivers are you using? We are currently testing with WebLogic's BEA JDBC driver. Does anyone have any feedback on it?

View Replies View Related

Problems With JDBC


Anyone here had difficulty logging in using JDBC to SQL Server 2000? I've an Java app that works perfectly with my test site and test database, but can't connect when I deploy at the customer location. I consistently get an error saying "Login failed for user 'foo'". Yet I can connect with the same user/password from an ASP page using ADO. This is with Microsoft's JDBC driver.

Tried a bunch of stuff
--> same thing happens with another type 4 driver (JTurbo)

--> Security permissions for user are fine (can read and write to database), and global settings are set to SQL Server authentication (not Win NT)

Anyone have any ideas for other things to check? My next step is to try the Sun JDBC-ODBC bridge.

Thanks, WILL

View Replies View Related

SQL Server And JDBC

Does anyone know of a good JDBC for SQL Server 2000?

View Replies View Related

Sql Server 7 And JDBC

Are there separate jdbc drivers for Sql Server 7 or should I use the 2000 drivers?

View Replies View Related

JDBC Connection

this url is having problem while making connection to SQL Server

"The requested instance is either invalid or not running."

View Replies View Related

JDBC Driver For MS SQL 7

Hi guys,

Where can I download the JDBC Driver for our MS SQL Server 7 ?

Thank you.

View Replies View Related

Jdbc Problem

I have a java program which uses sql.It supports sql 2000 and 2005.The user can enter a command from which he can choose to what server type he wants to connect.It is something like :

" c:connect [jdbc driver for 2005] [server] "

Now i have to do some different operations when user connects to 2000 and other operations when user connects to 2005.
The problem is that when using jdbc driver for 2005 he can also connect to mssql server 2000.
How can i find out to what server type he is connecting to?

i hope i explained it clearly enough

View Replies View Related

JDBC Driver?


Does SQL Server Express ship with a JDBC driver? ... Hardly so, but is it available somewhere?

Rgds and thanks, PP

View Replies View Related

Jdbc Driver

we are currently using ms jdbc driver 2.2 to access our sql server 2000. we are upgrading to sql server 2005, is my current jdbc driver compatible with 2005, or do I have to use the new jdbc driver 1.1 for 2005.


View Replies View Related

No Way To Do An Insert With JDBC?

I started with a simple insert on one of my tables. It throws an exception for trying to place NULL in one of two calculated fields in the table.
I then tried setting up a simple stored procedure and calling it using:

CallableStatement statement = con.prepareCall("? = call dbo.AddSignedForms");
statement.registerOutParameter(1, java.sql.Types.INTEGER);

Which generates this exception: Incorrect syntax near '@P0'.

of course there is no such expression in any of the code.

I then set up a simple two column table called tblTestJDBC. now i'm getting this error: Invalid object name 'dbo.tblTestJDBC'.

Btw we DID manage to get a simple select statement to work from my applet. Nothing else has. Is this the MS JDBC driver? Should I just avoid using it or are we missing something here?

View Replies View Related

Driver Jdbc

Hi Mixxo,
I also am having this problem! if you get an solution,
send me an answer or add my msn:

View Replies View Related

Driver JDBC

hi Mixxo,
I also am having this problem! if you get an solution,
send me an answer or add my msn:

View Replies View Related

Jdbc Driver

what is the jdbc driver for sql express? is it "sqljdbc"? then what is its "complete" name in the class path:""? and for the conection url is it "jdbc:microsoft:sqlexpress://localhost/sqlexpress"?

View Replies View Related

Help: JDBC 1.22 And SQL 2000

HI, all

I need to write a program, which using VM 1.1.8.

So I need to find the JDBC driver version 1.22, Can anyone help me???

Please Reply, a link for download jdbc 1.22 or any other solutions .

Thank you!

View Replies View Related

JDBC With SQL Express

The java code :


String connectionUrl = "jdbc:sqlserver://localhost:1433;" +
Connection con = DriverManager.getConnection(connectionUrl);

returns "connection refused" no matter what I do.

I've used the surface config tool to enable TCP, I've added sqlsrvr.exe to the firewall exceptions, I've tried a dozen or so variations on the connection string.

I can connect to the database using the Management Studio.

Any ideas what I'm missing ????


View Replies View Related

JDBC Connectivity With SQL Server

How do I configure the MS-SQLSERVER to accept JDBC connections andprocess the sql?I'm using SQLSERVER 2000 on Windows NT.Thanks for your help

View Replies View Related

JDBC ResultSet And Cursors

Hi everyone-I'm using the Microsoft JDBC driver for SQL Server 2000 and I'm tryingto avoid using server cursors.Is there a way to guarantee that every query will not create aserver-side ResultSet with a cursor? In other words, I want everyResultSet to be loaded into the client's (the web server's) memory.Does setting the "selectMethod" connection property guarantee this?Does SQL Server automatically decide which method is best and if so,what is the default choice?I would appreciate any insight. Thanks in advance!

View Replies View Related


Hello. I am having trouble finding a descent API for executing TSQLvia JDBC. I have tried the Microsoft driver AND the JDTS driver's butget the same syntax errors. I am hoping there is a good solution alsofor executing scripts using the same. Any help is MUCHappreciated.Thx.

View Replies View Related

JDBC Connections W/ AD Login?

I'm a newbie w/ SQL Server 2005.We will be connecting to SQL Server 2005 via JDBC. We have made thiswork by using an SQL Server account, rather than an Active Directory(AD) account, even though SQL Server IS in mixed authentication mode.Does mixed mode mean you can connect either way, but only using MS SQLServer interfaces (like Mgmt Studio), and not something like JDBC?Can we connect using JDBC w/ an AD login? If so, what form does thelogin take? Is the login not in 'DOMAIN/LOGIN' form?What is the best practice for this sort of thing? We would prefer touse AD logins (that a sysadmin creates) rather than having a separate(and probably equal) set of SQL Server logins.Any help appreciated.thanksaj

View Replies View Related

Secure Jdbc And Mssql

i have weblogic (7 and 8.1) installations that need to talk securelyvia JDBC to mssql database. preferrably using type4 (or at leasttype2) driver. is there anything out there that can be of any help?thank you.-anton

View Replies View Related

JDBC With Mulitple Databases

Dear all,Our application needs a bit of database redundancy.Our application only accesses database for reading purposes.We want to have two databases in separate machines. Incase one databaseserver dies the application should automatically extract data from theother server.Is there any JDBC driver available so that it can detect failure in themain database server and then tries to extract data from the standbydatabase server?Kind regards--Posted via

View Replies View Related

Copyrights 2005-15, All rights reserved