Link to home
Start Free TrialLog in
Avatar of payess
payess

asked on

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


 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.
ASKER CERTIFIED SOLUTION
Avatar of mnye
mnye
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of payess
payess

ASKER

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!
Avatar of payess

ASKER

Hit the nail!!