Wednesday, March 7, 2012

MSSQL2000 jdbc driver on UNIX ...

Hi experts,
I am new in java programming. I am wana to develop an application program
which can access MSSQL2000 under UNIX platform. I downloaded the jdbc
drivers for MSSQL2000 on Microsoft download center (Windows version & UNIX
version). I installed and set up on my machines,Windows 98 and
HPUX,respectively. And then, I do a sample code and try to accesss
MSSQL2000. It is works on Windows platform. But unfortunately, it does work
very well on my UNIX machine, and have an exception as
"com.microsoft.jdbc.sqlserver.SQLServerDriver".(co mplie pass). I have been
trying many times and can not get rid of this problem. Anyone can give me an
idea to solve it ? Thank you.
F.Y.I:
OS : HPUX10.20
JDK : 1.1.8
The configurlation in .cshrc :
...
set mypath = ( ... )
set hp93kpath = ( ... )
set javapath = ( ... )
set path = ($mypath $hp93kpath $javapath)
setenv classpath
install_dir/lib/msbase.jar:install_dir/lib/msutil.jar:install_dir/lib/mssqls
erver.jar
My sample code ..
import java.io.*;
import java.sql.*;
public class TestDB{
public static void main(String[] args){
try{
String mySQL = "select * from ABC";
Class.forname("com.microsoft.jdbc.sqlserver.SQLSer verDriver");
Connection cn =
DrvierManager.getConnection("jdbc:microsoft:sqlser ver://server_name:1433:Dat
abaseName = AAA","guest","guest");
Statement st = cn.createStatement();
resultSet rs = st.executeQuery(mySQL);
:
:
}catch(Exception e){
}finally{
rs.close();
st.clsoe();
cn.close();
}
}
}
Possibly a classpath problem. Do you see the jar's when you do:
shall> set | grep CLASSPATH
Or you could set the jar-CLASSPATH temporarely when you compile and run with
the 'env' shell statement, or on the javac/java command line.
Lars-Inge Tnnessen
www.larsinge.com

No comments:

Post a Comment