<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Jeff's thoughts on Software Architecture, Large Scale Services and the Technical world at large : SQL</title><link>http://blogs.msdn.com/jcurrier/archive/tags/SQL/default.aspx</link><description>Tags: SQL</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Feedback to the SQL Azure team</title><link>http://blogs.msdn.com/jcurrier/archive/2009/11/29/feedback-to-the-sql-azure-team.aspx</link><pubDate>Mon, 30 Nov 2009 03:39:44 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9929994</guid><dc:creator>jcurrier</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/jcurrier/comments/9929994.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jcurrier/commentrss.aspx?PostID=9929994</wfw:commentRss><wfw:comment>http://blogs.msdn.com/jcurrier/rsscomments.aspx?PostID=9929994</wfw:comment><description>&lt;p&gt;Hey all,&lt;/p&gt;  &lt;p&gt;During PDC09 we spent a bunch of time handing a survey for folks to fill out to give feedback to the team.&amp;#160; I would really encourage you to fill this out.&amp;#160; If there’s a data type that you’d like to see supported, feature enabled, enhancement, etc please try some time to fill &lt;a href="http://social.msdn.microsoft.com/Forums/en-US/ssdsgetstarted/thread/379f9a68-6246-497a-bed8-9c9443c53eda" target="_blank"&gt;this&lt;/a&gt; out.&lt;/p&gt;  &lt;p&gt;Thanks in advance from the SQL Azure team!&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9929994" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jcurrier/archive/tags/SQL/default.aspx">SQL</category><category domain="http://blogs.msdn.com/jcurrier/archive/tags/SQL+Azure/default.aspx">SQL Azure</category><category domain="http://blogs.msdn.com/jcurrier/archive/tags/PDC/default.aspx">PDC</category></item><item><title>SDS Java JDBC examples</title><link>http://blogs.msdn.com/jcurrier/archive/2009/03/29/sds-java-jdbc-examples.aspx</link><pubDate>Sun, 29 Mar 2009 23:57:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9517505</guid><dc:creator>jcurrier</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/jcurrier/comments/9517505.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jcurrier/commentrss.aspx?PostID=9517505</wfw:commentRss><wfw:comment>http://blogs.msdn.com/jcurrier/rsscomments.aspx?PostID=9517505</wfw:comment><description>&lt;P&gt;&lt;FONT size=2&gt;In my &lt;A href="http://blogs.msdn.com/jcurrier/archive/2009/03/29/sds-coding-examples-part-1-c-ado-net.aspx" mce_href="http://blogs.msdn.com/jcurrier/archive/2009/03/29/sds-coding-examples-part-1-c-ado-net.aspx"&gt;previous&lt;/A&gt; blog entry I mentioned that I would post some Java &amp;amp; JDBC examples for connecting to and interacting with the SDS service.&amp;nbsp; Since that post (roughly an hour ago) I’ve been called a, “slacker” by &lt;A href="http://blogs.msdn.com/drobinson/default.aspx" mce_href="http://blogs.msdn.com/drobinson/default.aspx"&gt;David Robinson&lt;/A&gt; one of the PM’s on the team.&amp;nbsp; Therefore, to show that I am not a, “slacker” I’ve decided to just post the code today.&amp;nbsp; Happy Dave :-)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;So, in this example I’m using Java 1.6, NetBeans as the editor and the latest JDBC driver for SQL Server which you can download from &lt;A href="http://www.microsoft.com/downloads/details.aspx?FamilyId=F914793A-6FB4-475F-9537-B8FCB776BEFD&amp;amp;displaylang=en" mce_href="http://www.microsoft.com/downloads/details.aspx?FamilyId=F914793A-6FB4-475F-9537-B8FCB776BEFD&amp;amp;displaylang=en"&gt;here&lt;/A&gt;.&amp;nbsp; The only jar file I’m currently using to compile (and run with) other than the expected JRE jar files is the, “sqljdbc4.jar” jar file which comes along with the download I’ve linked to above.&amp;nbsp; NOTE: That if you choose to use an earlier version of JDBC it *must* support SSL.&amp;nbsp; This is a requirement for the service.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;Now, I’ve purposely made this example to be the exact same as the C# example I did previously so you could focus more on the differences with the client technologies and less on the actual data I’ve created.&amp;nbsp; As you can see the only significant difference relative to SDS is the format of a couple of connection string values (namely the database, user id format and the initial url for the server).&amp;nbsp; Other than that it’s the same code that we would use to connect to locally.&amp;nbsp; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;Now, with no further delay.&amp;nbsp; The Java code for working with SDS.&lt;/FONT&gt;&lt;/P&gt;&lt;PRE&gt;    &lt;SPAN style="COLOR: #0000ff"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;void&lt;/SPAN&gt; main(String[] args)
    {
        String createTableSql = 
                "&lt;SPAN style="COLOR: #8b0000"&gt;CREATE TABLE [dbo].[tbl_Person]    &lt;/SPAN&gt;" +
                "&lt;SPAN style="COLOR: #8b0000"&gt;(                                                    &lt;/SPAN&gt;" +
                "&lt;SPAN style="COLOR: #8b0000"&gt;     [FirstName] NVARCHAR(64) NOT NULL,              &lt;/SPAN&gt;" +
	            "&lt;SPAN style="COLOR: #8b0000"&gt;     [LastName] NVARCHAR(64) NOT NULL                &lt;/SPAN&gt;" +
                "&lt;SPAN style="COLOR: #8b0000"&gt;    CONSTRAINT [personName_PK] PRIMARY KEY CLUSTERED &lt;/SPAN&gt;" +
                "&lt;SPAN style="COLOR: #8b0000"&gt;    (                                                &lt;/SPAN&gt;" +
                "&lt;SPAN style="COLOR: #8b0000"&gt;        [FirstName] ASC,                             &lt;/SPAN&gt;" +
                "&lt;SPAN style="COLOR: #8b0000"&gt;        [LastName] ASC                               &lt;/SPAN&gt;" +
                "&lt;SPAN style="COLOR: #8b0000"&gt;    )                                                &lt;/SPAN&gt;" +
                "&lt;SPAN style="COLOR: #8b0000"&gt;)&lt;/SPAN&gt;";     
        
        String insertSql = 
                "&lt;SPAN style="COLOR: #8b0000"&gt;INSERT INTO dbo.tbl_Person(FirstName, LastName) VALUES ('Jeff', 'Currier'); &lt;/SPAN&gt;" +
                "&lt;SPAN style="COLOR: #8b0000"&gt;INSERT INTO dbo.tbl_Person(FirstName, LastName) VALUES ('Nigel', 'Ellis'); &lt;/SPAN&gt;" +
                "&lt;SPAN style="COLOR: #8b0000"&gt;INSERT INTO dbo.tbl_Person(FirstName, LastName) VALUES ('David', 'Robinson');&lt;/SPAN&gt;"+ 
                "&lt;SPAN style="COLOR: #8b0000"&gt;INSERT INTO dbo.tbl_Person(FirstName, LastName) VALUES ('Jeff', 'Smith');&lt;/SPAN&gt;";
                
        &lt;SPAN style="COLOR: #0000ff"&gt;try&lt;/SPAN&gt;
        {
            &lt;SPAN style="COLOR: #008000"&gt;// First, format the connection string note that the server name here again is, “myserver”.  The database name (my user database name) is mydatabase.&lt;/SPAN&gt;&lt;SPAN style="COLOR: #008000"&gt;  &lt;/SPAN&gt;
            String connectionUrl = "&lt;SPAN style="COLOR: #8b0000"&gt;jdbc:sqlserver://myserver.data.dev.mscds.com;&lt;/SPAN&gt;" +
                    "&lt;SPAN style="COLOR: #8b0000"&gt;database=mydatabase;encrypt=true;user=jeff@myserver;password=*****&lt;/SPAN&gt;";

            &lt;SPAN style="COLOR: #008000"&gt;// Next, make the sure the SQL Server Driver is loaded.&lt;/SPAN&gt;
            Class.forName("&lt;SPAN style="COLOR: #8b0000"&gt;com.microsoft.sqlserver.jdbc.SQLServerDriver&lt;/SPAN&gt;");
            
            &lt;SPAN style="COLOR: #008000"&gt;// Then attempt to get a connection.  This will null or throw if we can't&lt;/SPAN&gt;
            &lt;SPAN style="COLOR: #008000"&gt;// get a connection.&lt;/SPAN&gt;
            Connection sqlConn = DriverManager.getConnection(connectionUrl);
            &lt;SPAN style="COLOR: #0000ff"&gt;if&lt;/SPAN&gt; (sqlConn == &lt;SPAN style="COLOR: #0000ff"&gt;null&lt;/SPAN&gt;)
            {
                System.out.println("&lt;SPAN style="COLOR: #8b0000"&gt;Unable to obtain connection.  exiting&lt;/SPAN&gt;");
                System.exit(1);
            }

            &lt;SPAN style="COLOR: #008000"&gt;// Begin by creating the table we'll use.&lt;/SPAN&gt;
            Statement sqlStmt = sqlConn.createStatement();
            sqlStmt.execute(createTableSql);

            &lt;SPAN style="COLOR: #008000"&gt;// Then, insert some rows into the table that we just created.&lt;/SPAN&gt;
            sqlStmt.execute(insertSql);

            &lt;SPAN style="COLOR: #008000"&gt;// Now, select all of the, "Jeff' data from the table and print them out.&lt;/SPAN&gt;
            ResultSet results = sqlStmt.executeQuery("&lt;SPAN style="COLOR: #8b0000"&gt;select FirstName, LastName from tbl_Person where FirstName='Jeff'&lt;/SPAN&gt;");
            &lt;SPAN style="COLOR: #0000ff"&gt;while&lt;/SPAN&gt; (results.next())
            {
                System.out.println("&lt;SPAN style="COLOR: #8b0000"&gt;FirstName: &lt;/SPAN&gt;" + results.getString("&lt;SPAN style="COLOR: #8b0000"&gt;FirstName&lt;/SPAN&gt;") + "&lt;SPAN style="COLOR: #8b0000"&gt; LastName: &lt;/SPAN&gt;" + results.getString("&lt;SPAN style="COLOR: #8b0000"&gt;LastName&lt;/SPAN&gt;"));
            }
            &lt;SPAN style="COLOR: #008000"&gt;// Close the ResultSet up.&lt;/SPAN&gt;
            results.close();

            &lt;SPAN style="COLOR: #008000"&gt;// Finally drop the table and close the conneciton.&lt;/SPAN&gt;
            sqlStmt.execute("&lt;SPAN style="COLOR: #8b0000"&gt;drop table tbl_Person&lt;/SPAN&gt;");
            sqlConn.close();
        } &lt;SPAN style="COLOR: #0000ff"&gt;catch&lt;/SPAN&gt; (SQLException ex)
        {
            System.out.println("&lt;SPAN style="COLOR: #8b0000"&gt;Error: Unable to execute query &lt;/SPAN&gt;");
            ex.printStackTrace();
        } &lt;SPAN style="COLOR: #0000ff"&gt;catch&lt;/SPAN&gt;(ClassNotFoundException ex)
        {
            System.out.println("&lt;SPAN style="COLOR: #8b0000"&gt;Error: Unable to load JDBC Driver!&lt;/SPAN&gt;");
        }

    }&lt;/PRE&gt;&lt;PRE&gt;&lt;FONT size=2&gt;Enjoy,&lt;/FONT&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;FONT size=2&gt;--Jeff--&lt;/FONT&gt;&lt;/PRE&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9517505" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jcurrier/archive/tags/Java/default.aspx">Java</category><category domain="http://blogs.msdn.com/jcurrier/archive/tags/SQL+Data+Services/default.aspx">SQL Data Services</category><category domain="http://blogs.msdn.com/jcurrier/archive/tags/SDS/default.aspx">SDS</category><category domain="http://blogs.msdn.com/jcurrier/archive/tags/SQL/default.aspx">SQL</category><category domain="http://blogs.msdn.com/jcurrier/archive/tags/JDBC/default.aspx">JDBC</category></item><item><title>SDS coding examples – Part 1 (C# &amp; ADO.NET)</title><link>http://blogs.msdn.com/jcurrier/archive/2009/03/29/sds-coding-examples-part-1-c-ado-net.aspx</link><pubDate>Sun, 29 Mar 2009 23:16:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9517463</guid><dc:creator>jcurrier</dc:creator><slash:comments>7</slash:comments><comments>http://blogs.msdn.com/jcurrier/comments/9517463.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jcurrier/commentrss.aspx?PostID=9517463</wfw:commentRss><wfw:comment>http://blogs.msdn.com/jcurrier/rsscomments.aspx?PostID=9517463</wfw:comment><description>&lt;P&gt;&lt;FONT size=2&gt;So, as I did with the original SDS I want to outline some code examples that other developers can use to get a sense of how to interact with the service.&amp;nbsp; In general, this will be much easier now that we have shifted more to the relational model as some of the more abstract (okay maybe not sooo abstract) concepts don’t necessarily need to be explained from scratch.&amp;nbsp; Having said that, there are a few concepts that are worth covering before we dive into the code.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;H5&gt;&lt;FONT size=3&gt;Servers, and Masters, and User Databases,&amp;nbsp; oh my!&lt;/FONT&gt;&lt;/H5&gt;
&lt;P&gt;&lt;FONT size=2&gt;There are really two different types of databases that we have present in SDS now.&amp;nbsp; The first, and the one that you’ll generally interact with the most, is the user database.&amp;nbsp; This is really where your user data resides.&amp;nbsp; You’re in charge in this space.&amp;nbsp; You define the tables, schemas and what have you that appear in this database.&amp;nbsp; We may insert some data into locked down tables (and present them to you with views) here to help assist you with debugging and provide some metrics data but by in large this is your house.&amp;nbsp; NOTE: The name you choose here for your user database (“mydatabase” in the example below) is the name of the database you specify in the connection string.&lt;/FONT&gt;&lt;/P&gt;&lt;PRE&gt;connStringBuilder.InitialCatalog = "&lt;SPAN style="COLOR: #8b0000"&gt;mydatabase&lt;/SPAN&gt;"; &lt;SPAN style="COLOR: #008000"&gt;// Specify your user database to connect to. &lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;FONT size=2&gt;The second type of database is really what we refer to as the logical master database (or server database) but it actually encapsulates two different things.&amp;nbsp; The first thing is that the server represents a logical master database.&amp;nbsp; This is the database where we keep track of all of the user databases that you have on this logical server. It’s important to note that this is *not* a real server and is more logical in nature.&amp;nbsp; We will also store things your metrics here as well as login information NOTE: Because we store login information here this is why you have specify your server name in the user id as certain elements don’t come across in the initial TDS packets we receive.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;The second important thing to note about the server database is that is associated (along with each of the user databases managed by it) with a particular geo-location.&amp;nbsp; You will pick the geo-location when you go through the provisioning process and requests will be routed to your servers by taking advantage of the DNS system as once done previously.&amp;nbsp; The code snippet below illustrates how the server presents itself in the connection string.&lt;/FONT&gt;&lt;/P&gt;&lt;PRE&gt;connStringBuilder.DataSource = "&lt;SPAN style="COLOR: #8b0000"&gt;myserver.data.dev.mscds.com&lt;/SPAN&gt;"; &lt;SPAN style="COLOR: #008000"&gt;// Specify the DNS name of my SDS server (which holds my master db).&lt;/SPAN&gt;
connStringBuilder.UserID = "&lt;SPAN style="COLOR: #8b0000"&gt;jeff@myserver&lt;/SPAN&gt;";                   &lt;SPAN style="COLOR: #008000"&gt;// Specify my user id (and the server name which holds my master db)&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;H5&gt;&lt;FONT size=3&gt;On to the code&lt;/FONT&gt;&lt;/H5&gt;
&lt;P&gt;&lt;FONT size=2&gt;So now with no further delay is some sample code.&amp;nbsp; It’s simple (on purpose) but it illustrates the types of operations that you’ll be able to do (DDL &amp;amp; DML).&amp;nbsp; In this example, I simply create a table, insert some rows, select some rows from that table, and finally drop the table in the end.&amp;nbsp; Here you go!&amp;nbsp; If you have other questions around the code please feel free to comment and I’ll try to reply as soon as I can.&lt;/FONT&gt;&lt;/P&gt;&lt;PRE&gt;        &lt;FONT size=2&gt;&lt;SPAN style="COLOR: #0000ff"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;void&lt;/SPAN&gt; Main(&lt;SPAN style="COLOR: #0000ff"&gt;string&lt;/SPAN&gt;[] args)
        {
            &lt;SPAN style="COLOR: #008000"&gt;// Begin, by constructing the connection string using the SqlConnectionStringBuilder class for&lt;/SPAN&gt;
            &lt;SPAN style="COLOR: #008000"&gt;// simplicity.  I could just use String.Format but this makes it a bit easier to explain what&lt;/SPAN&gt;
            &lt;SPAN style="COLOR: #008000"&gt;// we're doing with each parameter.&lt;/SPAN&gt;

            SqlConnectionStringBuilder connStringBuilder = &lt;SPAN style="COLOR: #0000ff"&gt;new&lt;/SPAN&gt; SqlConnectionStringBuilder();
            connStringBuilder.DataSource = "&lt;SPAN style="COLOR: #8b0000"&gt;myserver.data.dev.mscds.com&lt;/SPAN&gt;"; &lt;SPAN style="COLOR: #008000"&gt;// Specify the DNS name of my SDS server (which holds my master db).&lt;/SPAN&gt;
            connStringBuilder.InitialCatalog = "&lt;SPAN style="COLOR: #8b0000"&gt;mydatabase&lt;/SPAN&gt;";              &lt;SPAN style="COLOR: #008000"&gt;// Specify your user database to connect to.&lt;/SPAN&gt;
            connStringBuilder.Encrypt = &lt;SPAN style="COLOR: #0000ff"&gt;true&lt;/SPAN&gt;;                             &lt;SPAN style="COLOR: #008000"&gt;// Specify that I would like the channel to be encrypted.&lt;/SPAN&gt;
            connStringBuilder.UserID = "&lt;SPAN style="COLOR: #8b0000"&gt;jeff@myserver&lt;/SPAN&gt;";                   &lt;SPAN style="COLOR: #008000"&gt;// Specify my user id (and the server name which holds my master db)&lt;/SPAN&gt;
            connStringBuilder.Password = "&lt;SPAN style="COLOR: #8b0000"&gt;****&lt;/SPAN&gt;";                          &lt;SPAN style="COLOR: #008000"&gt;// Finally, specify my password.&lt;/SPAN&gt;

            &lt;SPAN style="COLOR: #0000ff"&gt;string&lt;/SPAN&gt; createTableSql =
                @"&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;SPAN style="COLOR: #8b0000"&gt;CREATE TABLE [dbo].[tbl_Person]
                (
                     [FirstName] NVARCHAR(64) NOT NULL,
	             [LastName] NVARCHAR(64) NOT NULL
                    CONSTRAINT [personName_PK] PRIMARY KEY CLUSTERED
                    (
                        [FirstName] ASC,
                        [LastName] ASC
                    )
                )&lt;/SPAN&gt;";

            &lt;SPAN style="COLOR: #0000ff"&gt;string&lt;/SPAN&gt; insertSql =
                @"&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;SPAN style="COLOR: #8b0000"&gt;INSERT INTO dbo.tbl_Person(FirstName, LastName) VALUES ('Jeff', 'Currier');
                  INSERT INTO dbo.tbl_Person(FirstName, LastName) VALUES ('Nigel', 'Ellis');
                  INSERT INTO dbo.tbl_Person(FirstName, LastName) VALUES ('David', 'Robinson');
                  INSERT INTO dbo.tbl_Person(FirstName, LastName) VALUES ('Jeff', 'Smith');&lt;/SPAN&gt;";
            &lt;SPAN style="COLOR: #0000ff"&gt;try&lt;/SPAN&gt;
            {
                &lt;SPAN style="COLOR: #008000"&gt;// New up a connection to my previously provisioned user database just as I would to any other database.&lt;/SPAN&gt;
                &lt;SPAN style="COLOR: #008000"&gt;// and then open it.&lt;/SPAN&gt;
                &lt;SPAN style="COLOR: #0000ff"&gt;using&lt;/SPAN&gt; (SqlConnection conn = &lt;SPAN style="COLOR: #0000ff"&gt;new&lt;/SPAN&gt; SqlConnection(connStringBuilder.ToString()))
                {
                    conn.Open();

                    &lt;SPAN style="COLOR: #008000"&gt;// Construct a new SqlCommand object that we'll use to execute execute our Sql code.&lt;/SPAN&gt;
                    &lt;SPAN style="COLOR: #0000ff"&gt;using&lt;/SPAN&gt; (SqlCommand cmd = conn.CreateCommand())
                    {
                        &lt;SPAN style="COLOR: #008000"&gt;// Use the above defined SQL to create a simple table that we'll to construct a table for this&lt;/SPAN&gt;
                        &lt;SPAN style="COLOR: #008000"&gt;// example&lt;/SPAN&gt;
                        cmd.CommandText = createTableSql;
                        cmd.CommandType = CommandType.Text;
                        cmd.ExecuteNonQuery();

                        &lt;SPAN style="COLOR: #008000"&gt;// Insert some simple data into that table.&lt;/SPAN&gt;
                        cmd.CommandText = insertSql;
                        cmd.CommandType = CommandType.Text;
                        cmd.ExecuteNonQuery();

                        &lt;SPAN style="COLOR: #008000"&gt;// Next, perform a simple select finding all of the persons in the table whose first name is Jeff.&lt;/SPAN&gt;
                        cmd.CommandText = "&lt;SPAN style="COLOR: #8b0000"&gt;select FirstName, LastName from dbo.tbl_Person where FirstName = 'Jeff'&lt;/SPAN&gt;";
                        cmd.CommandType = CommandType.Text;
                        &lt;SPAN style="COLOR: #0000ff"&gt;using&lt;/SPAN&gt; (SqlDataReader reader = cmd.ExecuteReader())
                        {
                            &lt;SPAN style="COLOR: #0000ff"&gt;while&lt;/SPAN&gt; (reader.Read())
                            {
                                Console.WriteLine("&lt;SPAN style="COLOR: #8b0000"&gt;First Name: {0} LastName: {1}&lt;/SPAN&gt;", reader["&lt;SPAN style="COLOR: #8b0000"&gt;FirstName&lt;/SPAN&gt;"],
                                                  reader["&lt;SPAN style="COLOR: #8b0000"&gt;LastName&lt;/SPAN&gt;"]);
                            }

                            reader.Close();
                        }

                        &lt;SPAN style="COLOR: #008000"&gt;// Finally, drop the table since we no longer need it.&lt;/SPAN&gt;
                        cmd.CommandText = "&lt;SPAN style="COLOR: #8b0000"&gt;Drop table dbo.tbl_Person&lt;/SPAN&gt;";
                        cmd.CommandType = CommandType.Text;
                        cmd.ExecuteNonQuery();
                    }

                    conn.Close();
                }
            }
            &lt;SPAN style="COLOR: #0000ff"&gt;catch&lt;/SPAN&gt; (SqlException ex)
            {
                Console.WriteLine(ex);
            }
        }&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;FONT size=2&gt;Now, this example was in C# and used SqlClient (ADO.NET) but my next example will use Java &amp;amp; JDBC.&amp;nbsp; If there are other languages (toolkits) you would like to see us illustrate please comment here or on the main SDS blog and we’ll try to get them out as soon as we can.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;Enjoy!&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;--Jeff--&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9517463" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jcurrier/archive/tags/Services/default.aspx">Services</category><category domain="http://blogs.msdn.com/jcurrier/archive/tags/SQL+Data+Services/default.aspx">SQL Data Services</category><category domain="http://blogs.msdn.com/jcurrier/archive/tags/SDS/default.aspx">SDS</category><category domain="http://blogs.msdn.com/jcurrier/archive/tags/SQL/default.aspx">SQL</category></item></channel></rss>