JDBC Driver For MS SQL 7
Mar 8, 2006Hi guys,
Where can I download the JDBC Driver for our MS SQL Server 7 ?
Thank you.
Hi guys,
Where can I download the JDBC Driver for our MS SQL Server 7 ?
Thank you.
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.
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
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 RelatedIs 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 RelatedHi
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
Hi,
Does SQL Server Express ship with a JDBC driver? ... Hardly so, but is it available somewhere?
Rgds and thanks, PP
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 RelatedI need a free, redistributable JDBC driverfrom MS SQL Server. (MSDE2000a)
View 2 Replies View Relatedwhat 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 RelatedHi Mixxo,
I also am having this problem! if you get an solution,
send me an answer or add my msn: griciolli@hotmail.com
please help it's urgent i badly need the jdbc driver for mssql for my project
thank u
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
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
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?
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
Hello,
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!)
Thanks,
Steve Ash
Software Developer
Metavante Image Solutions
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?
Thank you all
Hi,
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?
Thanks for the help,
Greg
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 :
DriverManager.registerDriver(new com.microsoft.sqlserver.jdbc.SQLServerDriver());
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
String connectionUrl="jdbcqlserver://localhost:49182;databaseName=NanoBase;";
Connection con = java.sql.DriverManager.getConnection(connectionUrl, "test", "Walt787sop289");
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.
regards,
anant
Hi,
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?
Thanks,
Bob
I have SQL server installed on a XP box. I need to access it from other machines using Java code. Where can I download a JDBC driver?
Thanks.
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
View 1 Replies View RelatedDear 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
View 2 Replies View RelatedDear all,Any MS SQL server driver for JDBC for window NT ?Thanks for reply.Victoria
View 2 Replies View RelatedHello,
View 6 Replies View Related
Hi,
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"
Is there any way this issue can be resolved?
Regards,
Guru
Hi folks,
I'm trying to figure out if the SQL Server 2005 JDBC driver supports SSL at all. I've downloaded the driver documentation, looked at more web pages than I care to count, and even went as far as to take a stab at guessing at different driver property names in the hopes I might discover some undocumented feature. Each time I try, I come up dry.
The following exception shows up in my JBoss log:
2007-01-03 12:13:36,812 WARN [org.jboss.resource.connectionmanager.JBossManagedConnectionPool] Throwable while attempting to get a new connection: null org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (com.microsoft.sqlserver.jdbc.SQLServerException: The SQL Server login requires an SSL connection.)
I know I have things working properly on the SQL Server side, as both osql and Query Analyzer work fine, and packet sniffing yields no plain text information. I've also tried swapping in the open source JTDS driver, and once again, sniffing shows that the data between the two machines in encrypted.
Does anyone know if I'm just missing something completely obvious, or can someone state with absolute certainty that the driver does not support SSL? Any ideas on how to find out if there are plans to support this feature and what the timeline might be?
Thanks in advance.
Trev.
hi,
i just downloaded the latest version of the drver v 1.2
am using Eclipse latest version along with Microsoft SQL Server 2005 with Express Mangment Tools
i installed the driver (copied the .dll to C:windowssystem32 ad included the .jar file in my project)
am using mixed mode authentication
when i use the following url:
"jdbcqlserver://localhost:1433;user=sa;password=;integratedSecurity=true;";
it connects to the master DB... good
whe i use the following:
"jdbcqlserver://localhost:1433;user=sa;password=;database=MyHits;integratedSecurity=true;";
it gives me the follwoing:
com.microsoft.sqlserver.jdbc.SQLServerException: Cannot open database "MyHits" requested by the login. The login failed.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown Source)
at com.microsoft.sqlserver.jdbc.TDSTokenHandler.onEOF(Unknown Source)
at com.microsoft.sqlserver.jdbc.TDSParser.parse(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.sendLogon(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.access$000(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection$LogonCommand.doExecute(Unknown Source)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.loginWithoutFailover(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at db_worker.<init>(db_worker.java:25)
at runner.main(runner.java:10)
although am sure i didnt miss anything (enbaled tcp/ip, no special permission thing on the DB MyHits) etc..
note: the databaseName ield in the url only works when i set it = to master,else it wont work (northwind or whatever) wont work!!!
Hi
Do we have to use SQL server 2005 JDBC driver to connect the sql server 2005? I got sql server 2000 driver for JDBC, it works fine to connect the database. But when I use sql server migration assistant for oracle, i got an error saying: [sql server 2000 driver for JDBC] Error establishing socket. Do I have to download SQL server 2005 driver for JDBC or I miss something else?
Thanks
Li
Hi All,
To me the results of getSchemas appears wrong and the catalog/schema values the wrong way round!
Using latest version of Sql Server 2005 Express with 1.2.2828 JDBC driver.
Created a database called: db_connection_tests
Created some tables inside this database called:
main
child
lookupThese show in Sql Server Manager as:
dbo.main
dbo.child
dbo.lookupIf I now log on through JDBC as user "dddddddddddd" and run 2 metadata calls (getCatalogs() and getSchemas()) the results to me do not match, that is the schema and catalog seem to be wrong in getSchemas.
Why is the catalog DBO returned for schema d_connection_tests in getSchemas(), when not in results of getCatalogs()?
TABLE_SCHEM db_connection_tests
TABLE_CATALOG dbo
getDatabaseProductName: Microsoft SQL Server
getDatabaseProductVersion: 9.00.3042
getDatabaseMajorVersion: 9
getDatabaseMinorVersion: 0
meta.getDriverMajorVersion(): 1
meta.getDriverMinorVersion(): 2
meta.getDriverName(): Microsoft SQL Server 2005 JDBC Driver
meta.getDriverVersion(): 1.2.2828.100
List of schemas (snippet):
TABLE_SCHEM db_connection_tests
TABLE_CATALOG dbo
List of catalogs:
TABLE_CAT db_connection_tests
TABLE_CAT master
TABLE_CAT model
TABLE_CAT msdb
TABLE_CAT tempdb
Tried JTds driver and results for getSchemas() are different!
getDatabaseProductName: Microsoft SQL Server
getDatabaseProductVersion: 09.00.3042
getDatabaseMajorVersion: 9
getDatabaseMinorVersion: 0
meta.getDriverMajorVersion(): 1
meta.getDriverMinorVersion(): 2
meta.getDriverName(): jTDS Type 4 JDBC Driver for MS SQL Server and Sybase
meta.getDriverVersion(): 1.2.2
List of schemas:
TABLE_SCHEM db_connection_tests
TABLE_CATALOG null
Code
package test.com.database;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
public class SqlServeTest_DriverMs {
private Connection con;
private DatabaseMetaData meta;
public static void main(String[] args) throws ClassNotFoundException, SQLException {
SqlServeTest_DriverMs sqlServeTest = new SqlServeTest_DriverMs();
sqlServeTest.runTests();
}
protected void runTests() throws ClassNotFoundException, SQLException {
// Class.forName("net.sourceforge.jtds.jdbc.Driver"); // JTds Driver
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); // MS Driver
try {
// Jtds Drvier
// con = DriverManager.getConnection("jdbc:jtdsqlserver://localhost:1433/db_connection_tests;user=dddddddddddd;password=root");
// MS Driver
con = DriverManager.getConnection("jdbcqlserver://localhost:1433;user=dddddddddddd;password=root;database=db_connection_tests");
meta = con.getMetaData();
System.out.println("getDatabaseProductName: " + meta.getDatabaseProductName());
System.out.println("getDatabaseProductVersion: " + meta.getDatabaseProductVersion());
System.out.println("getDatabaseMajorVersion: " + meta.getDatabaseMajorVersion());
System.out.println("getDatabaseMinorVersion: " + meta.getDatabaseMinorVersion());
System.out.println("meta.getDriverMajorVersion(): " + meta.getDriverMajorVersion());
System.out.println("meta.getDriverMinorVersion(): " + meta.getDriverMinorVersion());
System.out.println("meta.getDriverName(): " + meta.getDriverName());
System.out.println("meta.getDriverVersion(): " + meta.getDriverVersion());
printOutSchemas();
printOutCatalogs();
} finally {
if (con != null) {
try {
con.close();
} catch (Exception e) { // Ignore error
}
}
}
}
protected void printOutSchemas() throws SQLException {
ResultSet rs = null;
try {
rs = meta.getSchemas();
System.out.println("List of schemas: ");
printResults(rs);
} finally {
if (rs != null) rs.close();
}
}
protected void printOutCatalogs() throws SQLException {
ResultSet rs = null;
try {
rs = meta.getCatalogs();
System.out.println("List of catalogs: ");
printResults(rs);
} finally {
if (rs != null) rs.close();
}
}
protected void printResults(ResultSet rs) throws SQLException {
final int cols = rs.getMetaData().getColumnCount();
while (rs.next()) {
System.out.println();
for (int i = 1; i <= cols; i++) {
System.out.println(' ' + rs.getMetaData().getColumnName(i) + ' ' + rs.getString(i));
}
}
}
}
Can any version of the SQL Server 2000 JDBC driver connect to SQL Server 2005 or do I have to install the new JDBC version 1.1 to connect to my 2005 instance?
View 1 Replies View Related