?
Solved

No matter how hard i try, can't get a jdbc connection.

Posted on 2003-03-25
3
Medium Priority
?
464 Views
Last Modified: 2007-12-19

 Hello. Please, if you could help me??!!

 - language :::> java
 - IDE :::> sun1studio
 - OS :::> Win98
 - jdk :::> 1.4
 - Database :::> MSSQLServer (local)
 - Accessing to a public db.
 - Server :::> Tomcat 4.0 (internal)
 - driver :::> com.microsoft.jdbc.sqlserver.SQLServerDriver (recently downloaded from internet)
 - driver location :::> C:\s1studio\ce\lib\ext
 - url (format) used:::> jdbc:microsoft:sqlserver://<HOST>:<PORT>[;DatabaseName=<DB>]
 - c\Autoexec.bat :::> PATH C:\Novell\Client32;%PATH%;C:\WINDOWS\SYSTEM\WBEM;C:\ARCHIV~1\MICROS~3\80\TOOLS\BINN;C:\Archivos de programa\Microsoft SQL Server\80\Tools\Binn\;C:\j2sdk\bin;C:\mysql\bin;
set ANT_HOME=C:\ant
set JAVA_HOME=C:\j2sdk
Set NWLANGUAGE=ENGLISH
set PATH=%PATH%;%ANT_HOME%\bin
set CLASSPATH=.C:\Mis documentos\Lluis\struts\Projectes;C:\jakarta-tomcat-4.1.18-LE-jdk14\common\lib\servlet.jar;c:\Archivos de Programa\Microsoft SQL Server 2000 Driver for JDBC\lib\msbase.jar;c:\Archivos de Programa\Microsoft SQL Server 2000 Driver for JDBC\lib\msutil.jar;c:\Archivos de Programa\Microsoft SQL Server 2000 Driver for JDBC
\lib\mssqlserver.jar
 - App. Code:::> public class Connexio extends Object implements java.io.Serializable {
   
    private static final String PROP_SAMPLE_PROPERTY = "SampleProperty";
   
    private String sampleProperty;
   
    private PropertyChangeSupport propertySupport;
   
    private Connection conn;
   
    private Vector dades;

    public Connexio() throws ConnexioException{
       
        propertySupport = new PropertyChangeSupport( this );
        this.dades = Gestor.dades;
       
        String driver = (String)dades.elementAt(0);
        String uri = (String)dades.elementAt(1);
        String user = (String)dades.elementAt(2);
        String psw = (String)dades.elementAt(3);
        try{
           
            establirConnexio(driver, uri, user, psw);
           
        }
        catch(ConnexioException cE){
           
            throw new ConnexioException (cE.getMessage());
        }
    }
   
    public final void establirConnexio(String driver, String uri, String user, String password)throws ConnexioException{
        if (conn != null){
       
        }
        else{
            try
            {
                Class.forName(driver);
                conn = DriverManager.getConnection(uri,user,password);
               
            }
            catch(ClassNotFoundException c)
            {
                throw new ConnexioException ("No es troba el Driver d'accés per a la BD demanada: " + c.getCause() + " ::: " + c.getLocalizedMessage());
            }
            catch(SQLException s)
            {
                throw new ConnexioException ("Error de connexió amb la BD");
            }
        }
    }
  - Error  message :::>  "SQLServer Driver ([Microsoft][SQLServer 2000 Driver for JDBC] Unhandled token type : Unknown token : 0x20)"

 Generally i cannot get thru a connection. Don't think is a code problem. Basically, becasue i've done it hundreds of times. But the sun1studio IDE it's a new tool to me, and besides, i'm not very good at installing and configurating, only at programing, if so. So there you go, likely it is  to be a configuration/install problem rather than a code problem. Still, at this point i only dare to say that i know nothing, so if you could help me out. I'm really having a mare and expecting it, any moment, to turn out to be a very silly thing.
 Thanks in advanced!!

PS: You may excuse my english, i'm a catalan.
0
Comment
Question by:payess
  • 2
3 Comments
 
LVL 7

Accepted Solution

by:
mnye earned 300 total points
ID: 8204558
1. What Version of MS-SQL 2000 are you running?

Run the following in Query Analyzer to find out:
SELECT @@Version
you should be up to 8.00.0760.03
If not, contact your DBA and see if they can install service pack 3
look here:
http://www.microsoft.com/downloads/details.aspx?FamilyId=9032F608-160A-4537-A2B6-4CB265B80766&displaylang=en

2. What version of JDBC do you have?

Microsoft has a bad track record with JDBC. There are some patches and third party JDBC's out there but they dont garuentee any but thier own.  Microsofts latest release is 2.2.0029
Look here:
http://www.microsoft.com/downloads/details.aspx?FamilyID=4f8f2f01-1ed7-4c4d-8f7b-3d47969e66ae&DisplayLang=en

hth

late
matt
 
0
 

Author Comment

by:payess
ID: 8209252
Thanks for your help, nothing was wrong with the MS-SQL Server version (800.00.3xx) and i was using the exact same driver that could be found on the adress. But, however, by checking this things out, i've come out with a mid.term solution. Still, you were very helpfull and thanks to you i'm 'scratching'  again, thanks god. So there you're. Thanks again!
0
 

Author Comment

by:payess
ID: 8209258
Hit the nail!!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
When trying to connect from SSMS v17.x to a SQL Server Integration Services 2016 instance or previous version, you get the error “Connecting to the Integration Services service on the computer failed with the following error: 'The specified service …
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Suggested Courses

616 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question