Archives for the ‘SQL Server’ Category

JDBC Connection URLs for 22 Databases

Here is a non-exhaustive list of JDBC connection URLs for various databases. Corrections welcome!
Microsoft SQL Server JDBC connection URL
jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=northwind
com.microsoft.jdbc.sqlserver.SQLServerDriver
msbase.jar;mssqlserver.jar;msutil.jar
downloadl
Microsoft SQL Server 2005 JDBC connection URL
jdbc:sqlserver://serverName\instance:port[;user=value][;password=value][;property=value]
com.microsoft.sqlserver.jdbc.SQLServerDriver
sqljdbc.jar
download SQL Server 2005 driver
Microsoft SQL Server (JTurbo) JDBC connection URL
jdbc:JTurbo://<HOST>:<PORT>/<DB>
com.ashna.jturbo.driver.Driver
Microsoft SQL Server (Sprinta) JDBC connection URL
jdbc:inetdae7:<HOST>:<PORT>?database=<DB>
com.inet.tds.TdsDrive
download

SQL Server ARITHABORT

Just a reminder to myself. The next time I see an ARITHABORT error, try these
1) SET ARITHABORT OFF
2) Change SQL Server compatibility from SQL 2000 to SQL 2005

Tags: mssql

SQL Server Error Creating User Instance

Fellow Australian Dave Gardiner points out there is a patch available from Microsoft where SQL Server Express would not start up a user instance over Remote Desktop.
Thanks!

nvarchar padded strings

Here’s my little mystery of the day that took me an hour to figure out:
I have a table called EQUIPMENT with a column called SITE nvarchar(50). For some strange reason the results I’m getting from ADO.net is a string padded to full 50 characters. Now, only nchar(50) does that. I checked with Query Analyzer:
SELECT SITE, [...]

Connecting SQL Express Manager to User Instances

Use Master
GO
Select owning_principal_name, instance_pipe_name
FROM sys.dm_os_child_instances
GO

HOSTNAME\UserName \\.\pipe\4104C6A7-5175-45\tsql\query

Connect to
np:\\.\pipe\4104C6A7-5175-45\tsql\query

VS.net 2005 Data Binding summary

Visual Studio 2005.net introduced code-less databinding, entirely using drag and drop.
Here’s what happens in the GUI, and what occurs behind the scenes:
GUI – Add a new data source to the project
Code –
Database (mdf) added to project [optional]
Connection strings added to app.config.
TypedDataSet (xsd) created and added to project.
In [...]

XCopy deployment of MDF files with ODBC

Deployment notes: Deploying an MDF file to an installation using SQL Server Express 2005 or SQL Server 2005. (The following is useful if you require ODBC)

Note down the path to the MDF file, e.g. C:\zope261\3.03.05\DW30305DEMO.mdf
Win+Run odbccp32.cpl
Assign default database name and database filename to the same one as in step 1 (see picture)

SQL Express 2005 Unable to Backup database

Symptoms:
Error 3007 The backup of the file or filegroup “sysft_Search” is not permitted because it is not online.
Reason: Imported database from SQL Server 2000 may have reference to full text index, which is not supported by SQL Server Express 2005.
I just arrived at a solution through experimentation. Use at your own risk!

sp_help_fulltext_catalogs
… Gets you the [...]

SQL Server Linked Database

I was using one database (DB1) and wished to refer to a table in another database on the same server (DB2).
This is accomplished without resorting to sp_addlinkedserver.

USE DB1
GO
SELECT TOP 20 * FROM DB2..TABLE1

Observe that there are two periods between DB2 and TABLE1. This is not a typo.