Re: Using JDBC for SQLExpress
- From: "Angel Saenz-Badillos[MS]" <angelsa@xxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 20 Oct 2005 14:42:42 -0700
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?
.
- Follow-Ups:
- Re: Using JDBC for SQLExpress
- From: Chandresh
- Re: Using JDBC for SQLExpress
- Prev by Date: Re: Exception while using MS SQL SERVER 2005
- Next by Date: Re: Using JDBC for SQLExpress
- Previous by thread: Exception while using MS SQL SERVER 2005
- Next by thread: Re: Using JDBC for SQLExpress
- Index(es):
Relevant Pages
|
Loading