How to make apache2 authenticate against MS SQL 2000 Server - Page 2
5. Tools and actual implementationLooking around for sollution it turned out that connecting from Linux to MS
SQL is not that straightforward. Ruby, perl, python - all have nice DBI (database
interface modules) but when it comes to MS - it's getting painful. I was aware that on the same Linux machine runs jboss application that is web interface to the same MS SQL database. So looking into direction of java seamed most appropriate solution. 5.1. connecting from Java to MS SQLIt took not that much gogling to find some samples and glue together the java ‘program’ that initially looked like that: import java.sql.*;
import java.io.*;
public class testConnection
{
public static void main(String[] args)
{
String userName;
String userPass;
userName = args[0];
userPass = args[1];
DB db = new DB();
db.dbConnect(
"jdbc:jtds:sqlserver://xxx.xxx.xxx.xxx:1433/test",userName,userPass);
}
}
class DB
{
public DB() {}
public void 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();
System.out.println("failed");
}
}
};
I've had already Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2) on
that machine.
wget http://belnet.dl.sourceforge.net/sourceforge/jtds/jtds-1.2-dist.zip So now it’s possible to compile the program: javac testConnection.java and run it java testConnection myUsername myPass After that I looked out what can be done from apache's side.
|
Join the discussion.
www.seamlessenterprise.com
IP Convergence
Integrate your wireless and wireline networks.
Learn how from the experts at Sprint.
www.seamlessenterprise.com
Wireless & Wireline Integration
Thoughts, strategies and solutions: join the discussion
www.seamlessenterprise.com
Unified Communications 2009
Join the Discussion. Now.
www.seamlessenterprise.com




![Creative Commons Attribution License [Creative Commons Attribution License]](http://creativecommons.org/images/public/somerights20.gif)

print: 
Recent comments
2 hours 5 min ago
3 hours 48 min ago
6 hours 13 min ago
6 hours 19 min ago
10 hours 53 min ago
12 hours 54 min ago
16 hours 17 min ago
18 hours 24 min ago
18 hours 35 min ago
21 hours 1 min ago