Re: Using JDBC for SQLExpress
- From: Chandresh <Chandresh@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 21 Oct 2005 08:40:03 -0700
Couple of setting changes fixed this. The TCP/IP protocol was set to use
dynamic port (I'm not using the SQL Browser yet). I changed it to use a
static port and then using the 'SQL Server Surface Area Configuration' I
enabled TCP/IP for local and remote connection.
I had to specify the port number in the connection string and the program's
working now.
Thanks for your help.
"Angel Saenz-Badillos[MS]" wrote:
> The exception that you are seeing indicates that we were not able to get the
> portnumber for the SQLEXPRESS instance. We retrieve the port number by
> sending a DatagramPacket to port 1433 of the server you specified, for some
> reason this is taking longer than 5000ms to complete.
>
> Can you think of anythign that may be affecting this? my first guess would
> be that the SQL Server Browser is not running, you can check the status of
> this service in the SQL Server Configuration Manager that installed with Sql
> Express under SQL Server 2005 Services -> SQL Server Browser->start.
>
> If this is not the problem my second guess would be an issue with a
> firewall.
>
> --
> Angel Saenz-Badillos [MS] DataWorks
> This posting is provided "AS IS", with no warranties, and confers no
> rights.Please do not send email directly to this alias.
> This alias is for newsgroup purposes only.
> I am now blogging: http://weblogs.asp.net/angelsb/
>
>
>
>
> "Chandresh" <Chandresh@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:2570580E-1DFE-43A3-8B59-9049531ADB04@xxxxxxxxxxxxxxxx
> > Thanks for the response. That did not work. I tried out the sanple code
> > and I
> > get the following exception:
> >
> > Failed Logon:com.microsoft.sqlserver.jdbc.SQLServerException: Failed
> > connection to named instance [sqlexpress]
> > [java.net.SocketTimeoutException:
> > Receive timed out] Error Code = 0
> > com.microsoft.sqlserver.jdbc.SQLServerException: Failed
> > Logon:com.microsoft.sqlserver.jdbc.SQLServerException: Failed connection
> > to
> > named instance [sqlexpress] [java.net.SocketTimeoutException: Receive
> > timed
> > out]
> > at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(Unknown
> > Source)
> > at java.sql.DriverManager.getConnection(DriverManager.java:525)
> > at java.sql.DriverManager.getConnection(DriverManager.java:193)
> > at SQLXJdbcTest.main(SQLXJdbcTest.java:10)
> >
> >
> > "Angel Saenz-Badillos[MS]" wrote:
> >
> >> There are a couple of things to keep in mind when using Sql Express with
> >> the
> >> JDBC driver:
> >> · You need to enable mixed mode security when you install the
> >> server
> >> so that you can connect using user name and password.
> >> · The JDBC provider only works with the TCP/IP protocol which is
> >> disabled by default on Sql Express. You need to enable the TCP/IP
> >> Protocol
> >> from the SQL Server Configuration Manager that ships with SqlExpress and
> >> re-start the server. Look under SQL Server 2005 Network Configuration ->
> >> Protocols for SQLEXPRESS-> TCP/IP->Enable.
> >>
> >> Once you have set up Sql Express accordingly you can connect like this:
> >>
> >> 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=myuser;password=mypass;");
> >> System.out.println("Connected!");
> >> }catch(Exception ex){
> >> ex.printStackTrace();
> >> }
> >> }
> >> }
> >>
> >>
> >>
> >>
> >>
> >> --
> >> Angel Saenz-Badillos [MS] DataWorks
> >> This posting is provided "AS IS", with no warranties, and confers no
> >> rights.Please do not send email directly to this alias.
> >> This alias is for newsgroup purposes only.
> >> I am now blogging: http://weblogs.asp.net/angelsb/
> >>
> >>
> >>
> >>
> >> "Chandresh" <Chandresh@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> >> news:F7F63D04-20D7-4194-9CD3-18310E3EE941@xxxxxxxxxxxxxxxx
> >> > Has anyone used the JDBC driver for SQL Server 2005 to access a
> >> > SQLExpress
> >> > database? Could you please share how did you configure SQLExpress to be
> >> > able
> >> > to do this? What connection string did you use?
> >>
> >>
> >>
>
>
>
.
- References:
- Re: Using JDBC for SQLExpress
- From: Angel Saenz-Badillos[MS]
- Re: Using JDBC for SQLExpress
- From: Chandresh
- Re: Using JDBC for SQLExpress
- From: Angel Saenz-Badillos[MS]
- Re: Using JDBC for SQLExpress
- Prev by Date: Re: Using JDBC for SQLExpress
- Previous by thread: Re: Using JDBC for SQLExpress
- Index(es):
Relevant Pages
|
Loading