View Full Version : connect to sql server on the network
soumy
February 26th, 2008, 11:56 AM
I am developing jsp applications on ubuntu (tomcat5) and I would like to connect my application to an sql server database on the network. Could you please tell me how to do that (what I should download....).
Thanks
pedro_orange
February 26th, 2008, 12:09 PM
Have you heard of the JavascriptDB project?
It's pretty nifty. Check it out.
http://sourceforge.net/project/showfiles.php?group_id=131101&package_id=143753
aks44
February 26th, 2008, 12:21 PM
Have you heard of the JavascriptDB project?
Javascript has nothing to do with Java...
@OP: I guess you should use JDBC. Sorry I can't help more, I'm not very knowledgeable at Java.
thaus
May 21st, 2008, 12:31 AM
Hi, you can connect to SQL Using JDBC
1) download the JAR of jTDS add to your CLASSPATH
2) Microsoft SQL Server 2000 Driver for JDBC is a Type 4 JDBC driver. You need to place the jar files in your CLASSPATH variable.
when u have all the jars on your CLASSPATH try this code
import java.sql.*;
public class testConnection
{
public static void main(String[] args)
{
DB db = new DB();
db.dbConnect(
"jdbc:jtds:sqlserver://localhost:1433/tempdb","sa","");
}
}
class DB
{
public DB() {}
public voidn dbConnect(String db_connect_string,
String db_userid, String db_password)
{
try
{
Class.forName("net.sourceforge.jtds.jdbc.Driver");
Connection conn = DriverManager.getConnection(
db_connect_string, db_userid, db_password);
System.out.println("connected");
}
catch (Exception e)
{
e.printStackTrace();
}
}
};
Best Regards
Thaus Nebel.
vBulletin® v3.8.7, Copyright ©2000-2012, vBulletin Solutions, Inc.