SQL Java Driver Woes.. | Thinkmap
807580Jun 1 2010 — edited Jun 1 2010Hello,
I am currently working on a project using a technology called Thinkmap which is entirely Java based,
It supports integration with user built packages by calling their methods in javascript,
For example:
someButton.onclick = function(){
Packages.mycompany.math.dosometrig();
}
Anywho one of the features we needed was the ability to add entites to the MS SQL Backend database,
the package itself supports the use of SQL databases using a datasource config xml file and the open source jtds driver..
so it pulls data on the fly..
one problem though when i call an SQL-using function it throws an exception
the console displays this..
net.sourceforge.jtds.jdbc.Driver
Which is the java class name of the driver..
Which suggests it cant find the driver.. ive put it in every possible directory,
Heres my code by the way:
import java.sql.*;
public class SQL {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
try {
Class.forName("net.sourceforge.jtds.jdbc.Driver");
String url = "My String";
Connection conn = DriverManager.getConnection(url,"","");
Statement st = conn.createStatement();
st.executeUpdate("INSERT INTO table(ItemName)" +
"VALUES ('Hello World')");
conn.close();
System.out.println("Looks like it worked!");
} catch (Exception e) {
System.err.println("Got an exception! ");
System.err.println(e.getMessage());
}
}
}
The username password and connection string are correct i just removed them for security!
Any help would be great! Thanks
Daniel
Edited by: Daniel_Upton on Jun 1, 2010 7:54 AM