Re: Using JDBC for SQLExpress



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?


.



Relevant Pages

  • Re: Access 2007->SQL Server2005 "connection was forcibly closed",G
    ... I moved every table I was able to move to the SQL ... closed connections - but all of these errors are in the version which used ... the SQL Server 2000 and everything worked ... communication between ODBC (OLEDB and Native Client, ...
    (microsoft.public.sqlserver.connect)
  • Re: Unable to Apply SP4 to SQL 2000 Cluster (new Node)
    ... Rebuild the node in the failover cluster. ... Scenario 1" in SQL Server 2000 Books Online. ... This setup process updates to SP4 only the binaries on the new ...
    (microsoft.public.sqlserver.clustering)
  • Re: WSS 3.0 question
    ... I followed the advise given in removing WSS 3.0 etc, ... the server is complaining that the SQL service(?) was tempered with or corrupt. ... I may just instal the SQL server as I was going eventuall use it anyway. ... If WSUS 3.0 is installed, I would suggest you uninstall it and then you install WSS 3.0. ...
    (microsoft.public.windows.server.sbs)
  • Re: MS SQL Server 2005 (KB 921896)
    ... I have had to remove MS SQL Server on the XP side of this machine for the ... instance SQLEXPRESS ... Someone knowing please tell me the default so I can install this damn ...
    (microsoft.public.windowsupdate)
  • Re: WSUS
    ... I'm not seeing performance issues with the full enchilada installed, and 25 users busy hitting SQL. ... WSUS isn't difficult to uninstall - if you have WSUS v2 (installed with SBS R2) uninstall R2 from add/remove programs. ... How can anyone work with 4 instances of SQL Server on the same box? ...
    (microsoft.public.windows.server.sbs)

Loading