Hi, this is a pretty lengthy question (sorry!) b/c I tried to put in as much detail about my problem as I can. I am totally new to JDBC and this server stuff, so please bear with me. I am getting this error: **************** at com.devx.tradingapp.model.Connect.getConnection(Connect.java:27) at com.devx.tradingapp.model.Connect.displayDbProperties(Connect.java:44) at com.devx.tradingapp.model.Connect.main(Connect.java:80) Error Trace in getConnection() : [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket. Error: No active Connection ****************
1.) I've created a basic class called 'Connect' (code listed below) that connects to database using jdbc 2.) I have installed SQL Server 2000 (cd is from 2001) 3.)I downloaded Microsoft SQL Server 2000 Driver for JDBC sp3 ( I also tried sp2 but still doesn't work). 4.)I have tried tips listed on "http://support.microsoft.com/default.aspx?scid=kb;en-us;313178" but it still doesn't work. However,the only thing I didn't perform on this page was to ping my server. I'm not really sure how to perform this b/c I don't know what my server name is. I'm currently running everything on my local computer. So do they mean 'ping localhost' or 'ping local'? Currently when I open SQL Server Enterprise Manager, this is the hierarchy that I have: Console Root > Microsoft SQL Servers > (local)(Windows NT) > Now there is the Databases, Security...etc folders. 5.) I run this java application on Eclipse: Run --> Run As --> Java Application. After I run this, I get error message listed above. 6.) My OS is Windows XP
Connect.java code is below. Any instructions, comments, or sample code is greatly appreciated!
import java.*; public class Connect{ private java.sql.Connection con = null; private final String url = "jdbc:microsoft:sqlserver://"; private final String serverName= "localhost"; private final String portNumber = "1433"; private final String databaseName= "Northwind"; private final String userName = "username"; private final String password = "password"; // Informs the driver to use server a side-cursor, // which permits more than one active statement // on a connection. private final String selectMethod = "cursor";