facebook

MS SQL Server Express 2005 jdbc driver set up.

  1. MyEclipse Archived
  2.  > 
  3. Database Tools (DB Explorer, Hibernate, etc.)
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #245104 Reply

    Todd Corley
    Participant

    I found this example and it works fine:

    import java.sql.*;
    
    public class Test
    {
        public static void main(String[] args)
        {
            try
            {
                java.lang.Class
                        .forName( "com.microsoft.sqlserver.jdbc.SQLServerDriver" );
                Connection c = java.sql.DriverManager
                        .getConnection( "jdbc:sqlserver://localhost\\SQLEXPRESS;user=SQLDATAUSER;password=database;" );
                System.out.println( "Connected!" );
            }
            catch( Exception ex )
            {
                ex.printStackTrace();
            }
        }
    }

    But I can’t figure out how to configure it as a jdbc driver in the Database Explorer setup.
    Using the drivers down loaded from: http://www.microsoft.com/downloads/details.aspx?familyid=e22bc83b-32ff-4474-a44a-22b6ae2c4e17&displaylang=en

    I have read lots of stuff about the older three jar driver set, but they seem to have gone to a single jar.

    In the driver set up I have the provide jar added to the driver libraries: \sqljdbc_1.0\enu\sqljdbc_1.0\enu\sqljdbc.jar
    I have tried many different variations of the url from the example above, but can’t get the data connection to connect.

    Here is the error from the .log file:

    
    !ENTRY com.genuitec.eclipse.sqlexplorer 4 4 2006-01-23 22:33:22.125
    !MESSAGE Error while trying to login to database 
    !STACK 0
    com.microsoft.sqlserver.jdbc.SQLServerException: The connection to the named instance  has failed. Error: java.net.SocketTimeoutException: Receive timed out.
        at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(Unknown Source)
        at com.microsoft.sqlserver.jdbc.SQLServerConnection.getInstancePort(Unknown Source)
        at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(Unknown Source)
        at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(Unknown Source)
        at net.sourceforge.squirrel_sql.fw.sql.SQLDriverManager.getConnection(SQLDriverManager.java:99)
        at com.genuitec.eclipse.sqlexplorer.actions.LoginProgress$Login.run(LoginProgress.java:43)
        at java.lang.Thread.run(Unknown Source)
    

    Anyone know what I am doing wrong?

    #245138 Reply

    Todd Corley
    Participant

    The correct URL line for the new driver is:

    jdbc:sqlserver://localhost\SQLEXPRESS
    #245145 Reply

    Riyad Kalla
    Member

    Did you do the steps outlined in the document here: http://www.myeclipseide.com/images/tutorials/quickstarts/dbexplorer/

    start in section 4.1?

    #245148 Reply

    Todd Corley
    Participant

    Yes, but it didn’t help in this case.

    The problem was that the example url:

    jdbc:microsoft:sqlserver://<server_name>:<1433>

    looks very little like the new url needed for SQL server 2005:

    jdbc:sqlserver://localhost\SQLEXPRESS

    What would have helped would have been being able to see the connection attempt by the DB Browser. Is there any logging setting that would echo its calls to what ever db it is using?

    #245179 Reply

    Riyad Kalla
    Member

    What would have helped would have been being able to see the connection attempt by the DB Browser. Is there any logging setting that would echo its calls to what ever db it is using?

    No not at this time, although I believe this is a filed enhancement.

    #255941 Reply

    vvvngo
    Participant

    Try the following procedure:

    Install SQL Server 2005 Express with Mix Mode Authentication, which will require you to enter the password for ‘sa’ (make sure you write it down and remember after the installation; you can use it to connect to the database).

    Enable TCP/IP network protocol, which is disable by default, and set the TCP/IP port to 1433 by following instructions below:

    1) Open the SQL Server 2005 Configuration Manager by selecting Start->All Programs->Microsoft Server 2005->Configuration Tools->SQL Server Configuration Manager

    2) Click on the SQL Server Network Configuration node to expand it

    3) Click on Protocols for SQLEXPRESS node

    4) Right click on the TCP/IP protocol on the right panel and select Enable

    5) Right click on the TCP/IP protocol on the right panel and click Properties

    6) Click on the IP Address tab

    7) On the IPAll section, clear out the TCP Dynamic Ports field and enter 1433 (which is the default port for SQL Server 2005) on the TCP Port field

    Disable the firewall on the machine that houses the SQL Server Express

    You should be able to test the connection by using the following connection URL:

    jdbc:sqlserver://<server>

    where <server> is the server name or IP address of the machine the houses the SQL Server Express

    Good luck!

    #278609 Reply

    zulfikhar
    Member

    hello this is zulfikhar
    i am trying to connect to my sql server 200 database through database explorer
    and i have add the respective jar file also , but still it giving the error that can’t connect to databas

    #278610 Reply

    zulfikhar
    Member

    can any one tell me which url i should use to connect and in that url how to specify our dsn name

    #278643 Reply

    Hi,

    You should try to use jTDS driver for MSSQL since it faster and much more reliable.
    See : http://jtds.sourceforge.net/
    It is well documented too.
    I use it for years without problem.

    #309577 Reply

    SNK111
    Member

    Check this article ( http://www.shahriarnk.com/Shahriar-N-K-Research-Embedding-SQL-in-C-Sharp-Java.html ) for details on how to connect to SQL Server database from C#.NET database applications as well as Java database applications. It also describes how to pass embedded SQL queries (SELECT, INSERT, UPDATE, DELETE), calling stored procedures, pass parameters etc.

Viewing 10 posts - 1 through 10 (of 10 total)
Reply To: MS SQL Server Express 2005 jdbc driver set up.

You must be logged in to post in the forum log in