Here is an example of connecting to MSSQL server directly using jdbc
from inside Phobos. This post shows how to make a connection only. You would
use this for test purposes. A production application would need a pooled
connection for performance. That will be posted in the future.
*******************************************************************
// This will set up our writer.
// We could do this with a dynamic script or view as well
response.setStatus(200);
response.setContentType("text/html");
writer = response.getWriter();
// Set up our connection by specifying the driver
java.lang.Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
var user = "user";
var pass = "pass";
var strconn =
"jdbc:sqlserver://server:port;databaseName=database;selectMethod=cursor;"
var con = new java.sql.DriverManager.getConnection(strconn,user,pass);
writer.println("strconn");
if (con!=null) {
writer.println("Connection Successful");
}
// Close the connection.
con.close();
writer.flush();
Friday, August 3, 2007
Connecting to MSSQL with in Phobos
Subscribe to:
Posts (Atom)