on 06-23-2006 11:52 PM
Help!
I've created a simple program that should connect to a client of mine using jdbc. I was given the driver class which I have imported and added to my build path. I deploy the application and it errors saying it cannot find the class. Here is the code:
public void wdDoInit()
{
//@@begin wdDoInit()
IWDMessageManager mm = wdThis.wdGetAPI().getComponent().getMessageManager();
String host = "host";
int port = 1433;
String SID = "hostsid";
String user = "username";
String pass = "pwd";
String driver_class = "net.sourceforge.jtds.jdbc.Driver";
String access = "jdbc:jtds:sqlserver://" + host + ":1433" + "/" + SID;
Connection con;
try
{
try
{
Driver driver = (Driver)Class.forName(driver_class).newInstance();
} catch (Exception e)
{
mm.reportWarning("msg = " + e.toString());
}
con = DriverManager.getConnection(access, user, pass);
} catch (SQLException e)
{
mm.reportWarning("Error: " + e.getMessage());
}
Hi Steve,
Put jar file with JDBC driver to lib folder under your WD project and it will be included to wda and ear files.
BTW, may be it is beeter to register driver and datasource instead of using direct connect to DB? See how to register data source http://help.sap.com/saphelp_nw04/helpdata/en/b0/6e62f30cbe9e44977c78dbdc7a6b27/frameset.htm
Best regards, Maksim Rashchynski.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.