Error in ODBC after long time connection (MS.SQL Server 2000)

i' using windows XP
and create MS.SQL Server connection through SYSTEM DSN of ODBC DATA SOURCE ADMINISTRATOR in WinXP Control Panel
using jdbc.odbc connection to make connection to database.
it's working, but after many request of data transaction with database.
my program closed it self.
an a error file appear in the path of program.
i don't remember all what the error file contain exactly - it's about ODBC connection ( i already remove the error file long day a go, if i got it again i will post it here)
is java cannot connect database with ODBC properly?
thanks.

this is the error:
# An unexpected error has been detected by HotSpot Virtual Machine:
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x7c901010, pid=2528, tid=3508
# Java VM: Java HotSpot(TM) Client VM (1.4.2_15-b02 mixed mode)
# Problematic frame:
# C [ntdll.dll+0x1010]
--------------- T H R E A D ---------------
Current thread (0x02e64358): JavaThread "ServerBeritaThread" [_thread_in_native, id=3508]
siginfo: ExceptionCode=0xc0000005, reading address 0x00000018
Registers:
EAX=0x00000004, EBX=0x0355f9b4, ECX=0x7ffaf000, EDX=0x00000004
ESP=0x0355f950, EBP=0x0355f968, ESI=0x00000000, EDI=0x039414e8
EIP=0x7c901010, EFLAGS=0x00010297
Top of Stack: (sp=0x0355f950)
0x0355f950: 74355a16 00000004 0394150c 7432139f
0x0355f960: 0394150c 00000000 0355f980 7432a244
0x0355f970: 0394150c 74350000 02e643f4 02e64358
0x0355f980: 0355f994 7432a653 02fbde98 02e643f4
0x0355f990: 143aff08 0355f9ac 03711157 039414e8
0x0355f9a0: 0355f9b4 02e64358 143aff50 0355f9e4
0x0355f9b0: 00a881a6 00000000 0355fa00 039414e8
0x0355f9c0: 00000000 0355f9f4 0355f9c8 00000000
Instructions: (pc=0x7c901010)
0x7c901000: 90 90 90 90 90 64 8b 0d 18 00 00 00 8b 54 24 04
0x7c901010: 83 7a 14 00 75 4f f0 ff 42 04 75 19 8b 41 24 89
Stack: [0x03520000,0x03560000), sp=0x0355f950, free space=254k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [ntdll.dll+0x1010]
C [ODBC32.dll+0xa244]
C [ODBC32.dll+0xa653]
C [JdbcOdbc.dll+0x1157]
j sun.jdbc.odbc.JdbcOdbc.allocConnect(J[B)J+0
j sun.jdbc.odbc.JdbcOdbc.SQLAllocConnect(J)J+30
j sun.jdbc.odbc.JdbcOdbcDriver.allocConnection(J)J+6
j sun.jdbc.odbc.JdbcOdbcConnection.initialize(Ljava/lang/String;Ljava/util/Properties;I)V+37
j sun.jdbc.odbc.JdbcOdbcDriver.connect(Ljava/lang/String;Ljava/util/Properties;)Ljava/sql/Connection;+129
j java.sql.DriverManager.getConnection(Ljava/lang/String;Ljava/util/Properties;Ljava/lang/ClassLoader;)Ljava/sql/Connection;+154
j java.sql.DriverManager.getConnection(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/sql/Connection;+41
j Prosesor.processInput(Ljava/lang/String;)Ljava/lang/String;+51
j ServerBeritaThread.run()V+35
v ~StubRoutines::call_stub
V [jvm.dll+0x752e6]
V [jvm.dll+0xaf627]
V [jvm.dll+0x751f3]
V [jvm.dll+0x74eef]
V [jvm.dll+0x74f28]
V [jvm.dll+0x8ce4f]
V [jvm.dll+0xd3b07]
V [jvm.dll+0xd3ad5]
C [MSVCRT.dll+0x2a3b0]
C [kernel32.dll+0xb50b]
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j sun.jdbc.odbc.JdbcOdbc.allocConnect(J[B)J+0
j sun.jdbc.odbc.JdbcOdbc.SQLAllocConnect(J)J+30
j sun.jdbc.odbc.JdbcOdbcDriver.allocConnection(J)J+6
j sun.jdbc.odbc.JdbcOdbcConnection.initialize(Ljava/lang/String;Ljava/util/Properties;I)V+37
j sun.jdbc.odbc.JdbcOdbcDriver.connect(Ljava/lang/String;Ljava/util/Properties;)Ljava/sql/Connection;+129
j java.sql.DriverManager.getConnection(Ljava/lang/String;Ljava/util/Properties;Ljava/lang/ClassLoader;)Ljava/sql/Connection;+154
j java.sql.DriverManager.getConnection(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/sql/Connection;+41
j Prosesor.processInput(Ljava/lang/String;)Ljava/lang/String;+51
j ServerBeritaThread.run()V+35
v ~StubRoutines::call_stub
--------------- P R O C E S S ---------------
Java Threads: ( => current thread )
=>0x02e64358 JavaThread "ServerBeritaThread" [_thread_in_native, id=3508]
0x02facf38 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=1048]
0x02fadc20 JavaThread "AWT-EventQueue-0" [_thread_blocked, id=2028]
0x02e61db0 JavaThread "AWT-Windows" daemon [_thread_in_native, id=728]
0x02e20e48 JavaThread "AWT-Shutdown" [_thread_blocked, id=4056]
0x009d03c0 JavaThread "CompilerThread0" daemon [_thread_blocked, id=1568]
0x009cf630 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=1572]
0x009ccba0 JavaThread "Finalizer" daemon [_thread_blocked, id=2580]
0x009cb818 JavaThread "Reference Handler" daemon [_thread_blocked, id=980]
0x00035aa8 JavaThread "main" [_thread_in_native, id=1684]
Other Threads:
0x00a0b6c0 VMThread [id=1256]
0x00a0cab8 WatcherThread [id=2276]
VM state:not at safepoint (normal execution)
VM Mutex/Monitor currently owned by a thread: None
Heap
def new generation total 576K, used 43K [0x10010000, 0x100b0000, 0x104f0000)
eden space 512K, 1% used [0x10010000, 0x10012448, 0x10090000)
from space 64K, 53% used [0x10090000, 0x10098930, 0x100a0000)
to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000)
tenured generation total 1408K, used 665K [0x104f0000, 0x10650000, 0x14010000)
the space 1408K, 47% used [0x104f0000, 0x105967e8, 0x10596800, 0x10650000)
compacting perm gen total 4096K, used 4065K [0x14010000, 0x14410000, 0x18010000)
the space 4096K, 99% used [0x14010000, 0x14408580, 0x14408600, 0x14410000)
Dynamic libraries:
0x00400000 - 0x0040b000      C:\java\bin\java.exe
0x7c900000 - 0x7c9b0000      C:\WINDOWS\system32\ntdll.dll
0x7c800000 - 0x7c8f4000      C:\WINDOWS\system32\kernel32.dll
0x77dd0000 - 0x77e6b000      C:\WINDOWS\system32\ADVAPI32.dll
0x77e70000 - 0x77f01000      C:\WINDOWS\system32\RPCRT4.dll
0x77c10000 - 0x77c68000      C:\WINDOWS\system32\MSVCRT.dll
0x08000000 - 0x08144000      C:\java\jre\bin\client\jvm.dll
0x77d40000 - 0x77dd0000      C:\WINDOWS\system32\USER32.dll
0x77f10000 - 0x77f56000      C:\WINDOWS\system32\GDI32.dll
0x76b40000 - 0x76b6d000      C:\WINDOWS\system32\WINMM.dll
0x10000000 - 0x10007000      C:\java\jre\bin\hpi.dll
0x76bf0000 - 0x76bfb000      C:\WINDOWS\system32\PSAPI.DLL
0x00390000 - 0x0039e000      C:\java\jre\bin\verify.dll
0x003b0000 - 0x003c9000      C:\java\jre\bin\java.dll
0x003d0000 - 0x003de000      C:\java\jre\bin\zip.dll
0x02e70000 - 0x02f84000      C:\java\jre\bin\awt.dll
0x73000000 - 0x73026000      C:\WINDOWS\system32\WINSPOOL.DRV
0x76390000 - 0x763ad000      C:\WINDOWS\system32\IMM32.dll
0x774e0000 - 0x7761c000      C:\WINDOWS\system32\ole32.dll
0x5ad70000 - 0x5ada8000      C:\WINDOWS\system32\uxtheme.dll
0x033e0000 - 0x03432000      C:\java\jre\bin\fontmanager.dll
0x73760000 - 0x737a9000      C:\WINDOWS\system32\ddraw.dll
0x73bc0000 - 0x73bc6000      C:\WINDOWS\system32\DCIMAN32.dll
0x73940000 - 0x73a10000      C:\WINDOWS\system32\D3DIM700.DLL
0x74720000 - 0x7476b000      C:\WINDOWS\system32\MSCTF.dll
0x035e0000 - 0x035ef000      C:\java\jre\bin\net.dll
0x71ab0000 - 0x71ac7000      C:\WINDOWS\system32\WS2_32.dll
0x71aa0000 - 0x71aa8000      C:\WINDOWS\system32\WS2HELP.dll
0x605d0000 - 0x605d9000      C:\WINDOWS\system32\mslbui.dll
0x77120000 - 0x771ac000      C:\WINDOWS\system32\OLEAUT32.DLL
0x20b00000 - 0x20b4b000      C:\WINDOWS\system32\imon.dll
0x71ad0000 - 0x71ad9000      C:\WINDOWS\system32\WSOCK32.dll
0x71a50000 - 0x71a8f000      C:\WINDOWS\system32\mswsock.dll
0x662b0000 - 0x66308000      C:\WINDOWS\system32\hnetcfg.dll
0x71a90000 - 0x71a98000      C:\WINDOWS\System32\wshtcpip.dll
0x03710000 - 0x0371c000      C:\java\jre\bin\JdbcOdbc.dll
0x74320000 - 0x7435d000      C:\WINDOWS\system32\ODBC32.dll
0x5d090000 - 0x5d127000      C:\WINDOWS\system32\COMCTL32.dll
0x7c9c0000 - 0x7d1d4000      C:\WINDOWS\system32\SHELL32.dll
0x77f60000 - 0x77fd6000      C:\WINDOWS\system32\SHLWAPI.dll
0x763b0000 - 0x763f9000      C:\WINDOWS\system32\comdlg32.dll
0x773d0000 - 0x774d2000      C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2180_x-ww_a84f1ff9\comctl32.dll
0x20000000 - 0x20017000      C:\WINDOWS\system32\odbcint.dll
0x77c00000 - 0x77c08000      C:\WINDOWS\system32\VERSION.dll
0x77fe0000 - 0x77ff1000      C:\WINDOWS\system32\Secur32.dll
0x5fe80000 - 0x5fe9b000      C:\WINDOWS\system32\odbccp32.dll
0x77c70000 - 0x77c93000      C:\WINDOWS\system32\msv1_0.dll
0x76d60000 - 0x76d79000      C:\WINDOWS\system32\iphlpapi.dll
VM Arguments:
java_command: ServerBerita
Launcher Type: SUN_STANDARD
Environment Variables:
CLASSPATH=.;C:\PROGRA~1\JMF\lib\sound.jar;C:\PROGRA~1\JMF\lib\jmf.jar;C:\PROGRA~1\JMF\lib;.;.;d:\PROGRA~1\JMF21~1.1E\lib\sound.jar;d:\PROGRA~1\JMF21~1.1E\lib\jmf.jar;d:\PROGRA~1\JMF21~1.1E\lib;
PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Microsoft SQL Server\80\Tools\BINN;c:\java\bin;C:\Program Files\Microsoft SQL Server\90\Tools\binn\;C:\Program Files\Microsoft Visual Studio\Common\Tools\WinNT;C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin;C:\Program Files\Microsoft Visual Studio\Common\Tools;C:\Program Files\Microsoft Visual Studio\VC98\bin;c:\apache\mysql\bin;;C:\PROGRA~1\COMMON~1\MUVEET~1\030625
USERNAME=acer
OS=Windows_NT
PROCESSOR_IDENTIFIER=x86 Family 6 Model 15 Stepping 2, GenuineIntel
--------------- S Y S T E M ---------------
OS: Windows XP Build 2600 Service Pack 2
CPU:total 2 family 6, cmov, cx8, fxsr, mmx, sse, sse2
Memory: 4k page, physical 1038440k(478648k free), swap 1712796k(1228644k free)
vm_info: Java HotSpot(TM) Client VM (1.4.2_15-b02) for windows-x86, built on May 22 2007 17:01:47 by "java_re" with MS VC++ 6.0

Similar Messages

  • Re: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server

    Hi,
    I'm encountering an issue with "Named Pipes Provider, error: 40 windows" and am having problems determining how to fix it due to the environment I'm using.  I have two SQL Servers installed on two separate Win2K3 Server boxes, one is SQL Server 2000 and the other is SQL Server 2005.  The SQL Server 2000 contains the actual application data.  The 2005 database is used only for Reporting Services.  I've set up the reports on SSRS such that their datasources hit the 2000 server.  This is using SQL Server authentication.
    When testing the reports via SSRS (in Visual Studio 2005), the connection to the data works and the reports are generated fine.  When I deploy them to the reporting server and launch IE to test locally (still on the 2005 box), I get this "Named Pipes Provider, error 40" issue.  I made sure that Named Pipes and TCP were enabled and the port set at 1433 (to match that on the 2000 box). 
    Now I changed the datasource's authentication from SQL Server to Windows authentication.  I tested this in SSRS and this works too.  When I redeployed the reports with this authentication change, testing the reports via IE locally (on the 2005 box) worked.  Great.  Now when I open IE on an external box, i.e. on the 2000 box, and try to test the reports, I get this same error 40 issue.  I've been through a few threads describing the error 40, fiddling around with the SQL Server configuration as well as SSRS, to no avail.  I have a feeling this error 40 issue has to due with permissions/authentication between the SQL Server boxes but I can't really be sure.  Anyone have any ideas on how to troubleshoot my situation.  Thanks.
    larry

    Named Pipes Provider, error: 40 - Could not open a connection to SQL Server :
    I.   Incorrect connection string, such as using SqlExpress.
    Check out: http://forums.microsoft.com/TechNet/ShowPost.aspx?PostID=558456&SiteID=17
                    https://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1245564&SiteID=1
    The typical error when dealing with Express includes:
    a.  User is not aware of SqlExpress was installed as a named instance, consequently, in his/her connection string, he/she only specify ".","localhost" etc instead of ".\SqlExpress" or "<machinename>\Sqlexpress".
    b. Np was disabld by default after installing SqlExpress.
    c. If Sqlexpress was installed on the remote box, you need to enable remote connection for Express.
    Please read the following blog for best practice of connecting to SqlExpress.
    http://blogs.msdn.com/sql_protocols/archive/2006/03/23/558651.aspx
    II. Named Pipes(NP) was not enabled on the SQL instance.
    Check out: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=136253&SiteID=1
    Oppose to SQL 2000 which turn on all protocols, SQL 2005 SKUs turn off NP by default. So, when you see this error, please check:
    1) Go to SQL Server Configuration Manager, See Server has NP enabled.
    2) %windir%\program files\microsoft sql server\mssql.1\mssql\log, notepad ERRORLOG, see whether Server is listening on NP.  You should see "Server named pipe provider is ready to accept connection on [ \\.\pipe\sql\query ] or [\\.\pipe\mssql$<InstanceName>\sql\query]"
    3) Notice that "sql\query" is the default pipe name, so you need to know server is listening on which pipe name. eg: if you specify server pipe name is "sql\query1", then you would see in the errorlog that server listening on [ \\.\pipe\sql\query1 ], and go to SQL Server Configuration Manager, click client Named Pipe properties, see whether the pipe name is same with the one server listening on.
    4) If you are using SQL Native Client ODBC/OLEDB provider({SQL Native Client} or SQLNCLI), go to SQL Configuration Manager, click client protocols, make sure NP and TCP are both enabled. Right click properties of NP, make sure client is using the same pipe name as server for connection.
    5) If you are using MDAC ODBC/OLEDB({SQL Server} or SQLOLEDB) provider, in command line, launch "cliconfg.exe" and make sure NP enabled and right pipe name specified.
    III. Remote connection was not enabled. 
    Check out: when you right click on the Server in SQL Server Management Studio, in Connections, the Remote server connections part, you have enabled the "Allow remote connections to this server" check box
    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=322792&SiteID=1
    https://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=763875&SiteID=1
    If you are making a remote connection, namely, your target SQL Server is on the different box as client application, you might need to check whether:
    a. "File and Printer Sharing" was opened in Firewall exception list.
    b. Please see the blog for enabling remote connection for express and troubleshooting tips of remote connection.
    http://blogs.msdn.com/sql_protocols/archive/2005/11/14/492616.aspx
    http://blogs.msdn.com/sql_protocols/archive/2006/09/30/SQL-Server-2005-Remote-Connectivity-Issue-TroubleShooting.aspx
    IV. Server not started, or point to not a real server in your connection string.
    Check out: Open SQL Server Surface Area Configuration and ensure all the required services are started, Remote Connections are configured.
    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=348662&SiteID=1
    a. use "sc query mssqlserver" for default instance or "sc query mssql$<instancename>" to make sure SQL Server was started. Sometimes, reseason behind the broken of your client application w/ this error:40 might be SQL server restarted and failed, so, it'd better for you to double check.
    b. User specified wrong server in their connection string, as described in the forum discussion, "MSSQLSERVER" is an invalid instance name. Remember, when you connect to default instance, <machinename> could be best representitive for the instance, when you connect to a named instance such as sqlexpress, you should specify <machinename>\<instancename> as data source in your connection string.
     V. Other reasons such as incorrect security context.
    Check out: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=192622&SiteID=1
    Such error also occured during user operation such as moving database or db mirroring or cluster, any DB OP that might invovle different sql instances, namely, the destination database is located in another sql instance and user is not aware of the state of the destination. I recommend you first isolate whether this fail is during connection stage or data operation stage.
    a. During data operation, you are normally asked to type in the destination server name whether it is default to "(local)" or another server "<remotemachinename>". So, remember the exact string that represent the target instance, then when the error repros, open command line, use "sqlcmd -S<representitive> -E" ,see what happens, if the connection fail, please follow up above I - IV troubleshooting lists. otherwise continue.
    b. If you can make basic conection, but still face the error, then there must be something that server reject the connection or client close the connection for some reason.
    VI. Please try basic connectivity tests between the two mahcines you are working on. One simple way to verifty connectivity is to use command line tools, such as osql.exe. For example, osql -E -Stcpervername\instancename. If it connects cross-machine successfully, please also verify that your connection string in your scenario is correct.
    Here are some blogs which could be helpful: just follow the basic connectivity troubleshooting guidelines on the SQL Protocols blog, see:
    SQL Server 2005 Connectivity Issue Troubleshoot - Part I
    http://blogs.msdn.com/sql_protocols/archive/2005/10/22/483684.aspx
    and
    SQL Server 2005 Connectivity Issue Troubleshoot - Part II
    http://blogs.msdn.com/sql_protocols/archive/2005/10/29/486861.aspx
    Hope this helps.

  • Named Pipes Provider, error: 40 - Could not open a connection to SQL Server

    This was originally posted in the SSIS Forum, but a member of the IS team suggested it be moved here.  "Most recently I got this error (Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) so does this mean that SQL Server is still trying to use named pipes even if I only have TCP/IP enabled in SQL Server Configuration Manager?"
    I'm having the same issue, and here's our scenario:
    Installed SQL Server 2005 Developer Edition on a machine with WinXP SP2 and enabled remote connections over TCP/IP
    Installed SQL Server 2005 Standard Edition on a machine with Win2003 SP1 (remote connections over TCP/IP enabled by default)
    Attempted to 'Copy Database' from Developer Edition TO Standard Edition using 'Detach and Attach' method and recieved the error on the Win2003 machine: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server
    Attempted to 'Copy Database' from Developer Edition TO Standard Edition using 'SQL Management Objects' method and recieved the error on the Win2003 machine: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server
    Reinstalled Standard Edition on the Win2003 SP1 machine
    Checked all the settings on both machines several times, restarted services etc., and read every post I could find referencing the error.
    Same error
    Lost my last hair
    Thanks in advance,
    Steve

    Nan,
    Before I get on with this post - thank you for your reply.
    The XPSP2 machine actually had the firewall disabled, and I verified that it could accept connections on the the associated ports with the Shields Up utility.  I tested this on both machines.
    I can connect to the server from the XPSP2 machine, Import / Export, manage, view logs, and do everything EXCEPT get the Copy Database package to run.  SQL Server Agent always fails on the last step with the following error:
    Event Type: Error
    Event Source: SQLISPackage
    Event Category: None
    Event ID: 12550
    Date:  1/10/2006
    Time:  1:34:15 PM
    User:  NT AUTHORITY\SYSTEM
    Computer: 401SERVER
    Description:
      Event Name: OnError
     Message: Failed to connect to server BETHESDA.
    StackTrace:    at Microsoft.SqlServer.Management.Common.ConnectionManager.Connect()
       at Microsoft.SqlServer.Dts.Tasks.TransferObjectsTask.TransferObjectsTask.OpenConnection(Server& server, ServerProperty serverProp)
    InnerException-->An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
    StackTrace:    at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
       at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
       at System.Data.SqlClient.TdsParser.Connect(Boolean& useFailoverPartner, Boolean& failoverDemandDone, String host, String failoverPartner, String protocol, SqlInternalConnectionTds connHandler, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject, Boolean aliasLookup)
       at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
       at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
       at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
       at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
       at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
       at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
       at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
       at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
       at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
       at System.Data.SqlClient.SqlConnection.Open()
       at Microsoft.SqlServer.Management.Common.ConnectionManager.InternalConnect(WindowsIdentity impersonatedIdentity)
       at Microsoft.SqlServer.Management.Common.ConnectionManager.Connect()
     Operator: NT AUTHORITY\SYSTEM
     Source Name: BETHESDA_401SERVER_Transfer Objects Task
     Source ID: {86F355AD-3B74-4D7B-8D2D-C743C790A269}
     Execution ID: {91B7C32C-C439-4EDB-8A0F-9F8BF207BC06}
     Start Time: 1/10/2006 1:34:15 PM
     End Time: 1/10/2006 1:34:15 PM
     Data Code: 0
    For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
    Have you (or anyone else) successfully executed a Copy Databse task?
    Steve

  • SQL Server Agent Log showing errors [298] SQLServer Error: 10061, A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL

    Hi All,
    I have started receiving this error in the logs for the last 10 days and the Schedules Jobs for the database have stopped running. My MS CRM application is working fine.
    Can anyone guide me what could be the problem.
    Date                      17/4/2014 2:04:20 PM
    Log                         SQL Server Agent (Current - 17/4/2014 2:01:00 PM)
    Message
    [298] SQLServer Error: 10061,
    A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct
    and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online. [SQLSTATE 08001]
    Date                      17/4/2014 2:11:55 PM
    Log                         SQL Server Agent (Current - 17/4/2014 2:01:00 PM)
    Message
    [298] SQLServer Error: 10061,
    A network-related or instance-specific error
    has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information
    see SQL Server Books Online. [SQLSTATE 08001]
    Date                      7/4/2014 11:00:31 AM
    Log                         SQL Server Agent (Current - 17/4/2014 2:01:00 PM)
    Message
    [298] SQLServer Error: 10061,
    A network-related or instance-specific error
    has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information
    see SQL Server Books Online. [SQLSTATE 08001]

    Check this link
    http://social.msdn.microsoft.com/Forums/en-US/906da9b5-2482-468c-a424-ae099da2d96b/sql-server-agent-service-account-error?forum=sqlsetupandupgrade
    Regards, RSingh

  • Named Pipes provider, error:40 could not open a connection to sql server. Only happens on one of the front end SRS servers

    when testing a datasource connection I get the following error.
    Named Pipes provider, error:40 could not open a connection to sql server.
    I've read all the posts on this and nothing works.  This is a scale out deployment and the connection
    works from the other server I have setup with SRS that is connected to the same backend SRS databases.  It just doesn't work from one of the SRS front ends.  I'm at a loss..  please help

    Enable both named pipe and TCP communications.
    Make sure client is using the same (named) pipe name as server for connection.
    Kalman Toth Database & OLAP Architect
    Free T-SQL Scripts
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • Reporting Services 2008 R2 configuration error: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server

    Hi, I am using SQL Server 2008 R2 and on one of our dev boxes I am trying to setup ReportServer using ReportingServices Configuration manager. This is was installed longtime back and during installation they created a service account for reporting services.
    When I try to configure the service account I do not get the service account created during the installation in the pull down and if I were to use something different I get this "Named Pipes Provider, error: 40 - Could not open a connection to SQL Server"
    error.
    Thanks in advance...........
    Ione

    Hi,
    Take a look at this blog - http://blogs.msdn.com/b/sql_protocols/archive/2007/03/31/named-pipes-provider-error-40-could-not-open-a-connection-to-sql-server.aspx
    I hope it will help.

  • Null connection when trying to connect to SQL Server 2000 in Tomcat4.1.29

    Hi All,
    I am still struggling with null connection when trying to connect to sql server 2000 with tomcat using sun.jdbc.odbc.JdbcOdbcDriver
    Here is my server.xml
    <Server port="8005" shutdown="SHUTDOWN" debug="0">
    <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"
    debug="0"/>
    <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"
    debug="0"/>
    <GlobalNamingResources>
    <Resource name="UserDatabase" auth="Container"
    type="org.apache.catalina.UserDatabase"
    description="User database that can be updated and saved">
    </Resource>
    <ResourceParams name="UserDatabase">
    <parameter>
    <name>factory</name>
    <value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
    </parameter>
    <parameter>
    <name>pathname</name>
    <value>conf/tomcat-users.xml</value>
    </parameter>
    </ResourceParams>
    <Resource auth="Container" description="Users and Groups
    Database" name="UserDatabase"
    scope="Shareable"
    type="org.apache.catalina.UserDatabase"/>
    <Resource name="jdbc/DefaultDS" scope="Shareable"
    type="javax.sql.DataSource"/>
    <ResourceParams name="UserDatabase">
    <parameter>
    <name>factory</name>
    <value>org.apache.catalina.users.
    MemoryUserDatabaseFactory</value>
    </parameter>
    <parameter>
    <name>pathname</name>
    <value>conf/tomcat-users.xml</value>
    </parameter>
    </ResourceParams>
    <ResourceParams name="jdbc/DefaultDS">
    <parameter>
    <name>validationQuery</name>
    <value></value>
    </parameter>
    <parameter>
    <name>user</name>
    <value>sa</value>
    </parameter>
    <parameter>
    <name>maxWait</name>
    <value>5000</value>
    </parameter>
    <parameter>
    <name>maxActive</name>
    <value>4</value>
    </parameter>
    <parameter>
    <name>password</name>
    <value>sa</value>
    </parameter>
    <parameter>
    <name>url</name>
    <value>jdbc:odbc:JBoss-SQL://localhost:1433;databaseName=Development;selectMethod=cursor;</value>
    </parameter>
    <parameter>
    <name>driverClassName</name>
    <value>sun.jdbc.odbc.JdbcOdbcDriver</value>
    </parameter>
    <parameter>
    <name>maxIdle</name>
    <value>2</value>
    </parameter>
    </ResourceParams>
    </GlobalNamingResources>
    <!-- Define the Tomcat Stand-Alone Service -->
    <Service name="Tomcat-Standalone">
    <Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
    port="8080" minProcessors="5" maxProcessors="75"
    enableLookups="true" redirectPort="8443"
    acceptCount="100" debug="0" connectionTimeout="20000"
    useURIValidationHack="false" disableUploadTimeout="true" />
    <!-- Note : To disable connection timeouts, set connectionTimeout value
    to -1 -->
    <!-- Define a SSL Coyote HTTP/1.1 Connector on port 8443 -->
    <!--
    <Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
    port="8443" minProcessors="5" maxProcessors="75"
    enableLookups="true"
    acceptCount="100" debug="0" scheme="https" secure="true"
    useURIValidationHack="false" disableUploadTimeout="true">
    <Factory className="org.apache.coyote.tomcat4.CoyoteServerSocketFactory"
    clientAuth="false" protocol="TLS" />
    </Connector>
    -->
    <!-- Define a Coyote/JK2 AJP 1.3 Connector on port 8009 -->
    <Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
    port="8009" minProcessors="5" maxProcessors="75"
    enableLookups="true" redirectPort="8443"
    acceptCount="10" debug="0" connectionTimeout="0"
    useURIValidationHack="false"
    protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"/>
    <!-- Define an AJP 1.3 Connector on port 8009 --><Logger className="org.apache.catalina.logger.FileLogger"
    prefix="catalina_log." suffix=".txt"
    timestamp="true"/>
    <!-- Define the default virtual host -->
    <Host name="localhost" debug="0" appBase="webapps"
    unpackWARs="true" autoDeploy="true">
    <Logger className="org.apache.catalina.logger.FileLogger"
    directory="logs" prefix="localhost_log." suffix=".txt"
    timestamp="true"/>
    <Environment name="maxExemptions" type="java.lang.Integer"
    value="15"/>
    <Parameter name="context.param.name" value="context.param.value"
    override="false"/>
    <Resource name="jdbc/DefaultDS" auth="container" type="javax.sql.DataSource"/>
    <ResourceParams name="jdbc/DefaultDS">
    <!-- Maximum number of dB connections in pool.
    Set to 0 for no limit.
    -->
    <parameter>
    <name>maxActive</name>
    <value>8</value>
    </parameter>
    <!-- Maximum number of idle dB connections to retain in pool.
    Set to 0 for no limit.
    -->
    <parameter>
    <name>maxIdle</name>
    <value>4</value>
    </parameter>
    <!-- Maximum time to wait for a dB connection to become available
    in ms, in this example 10 seconds. An Exception is thrown if
    this timeout is exceeded. Set to -1 to wait indefinitely.
    -->
    <parameter>
    <name>maxWait</name>
    <value>5000</value>
    </parameter>
    <!-- MS Sql Server dB username and password for dB connections
    -->
    <parameter>
    <name>user</name>
    <value>sa</value>
    </parameter>
    <parameter>
    <name>password</name>
    <value>sa</value>
    </parameter>
    <!-- Class name for MS Sql Server JDBC driver
    -->
    <parameter>
    <name>driverClassName</name>
    <value>sun.jdbc.odbc.JdbcOdbcDriver</value>
    </parameter>
    <!-- The JDBC connection url for connecting to MS Sql Server dB.
    -->
    <parameter>
    <name>url</name>
    <value>jdbc:odbc:JBoss-SQL://localhost:1433;databaseName=Development;selectMethod=cursor;</value>
    </parameter>
    <!-- This Databae Connection Pool Description.
    -->
    <parameter>
    <name>description</name>
    <value>JDBC Driver: sun.jdbc.odbc.JdbcOdbcDriver</value>
    </parameter>
    </ResourceParams>
    <Resource name="mail/Session" auth="Container"
    type="javax.mail.Session"/>
    <ResourceParams name="mail/Session">
    <parameter>
    <name>mail.smtp.host</name>
    <value>localhost</value>
    </parameter>
    </ResourceParams>
    <ResourceLink name="linkToGlobalResource"
    global="simpleValue"
    type="java.lang.Integer"/>
    </Host>
    </Engine>
    </Service>
    </Server>
    and my web.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
    <!-- Standard Action Servlet Mapping -->
    <web-app>
    <resource-ref>
    <res-ref-name>jdbc/DefaultDS</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    </web-app>
    and JBoss-SQL is data source I created from control panel settings and here is way I am retrieving connetion
    InitialContext initCtx = new InitialContext();
    DataSource ds = (DataSource) initCtx.lookup("java:comp/env/jdbc/DefaultDS");
    Connection con = ds.getConnection();
    return con;
    I tried connecting as mentioned in this website
    http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html#Common%20Problems.But didn't help
    Please help urgent
    Sorry for long file. Can any one please help me in solving this problem.
    Thanks in advnace
    Kurakula

    I'd recommend that you not use the JDBC-ODBC bridge driver to connect to SQL Server. M$ and jTDS are two free type IV JDBC drivers that you should use instead. Put those JARs in the WEB-INF/lib directory.
    The database URL you're using is not correct if you change drivers. Consult the docs to find out what the proper syntax is.
    MOD

  • Can't connect  to SQL Server 2000 from serlet

    Hi,
    I can connect to SQL Server 2000 from standalone program after set the classpath properly.
    but I Can't connect to SQL Server 2000 from serlet, I am using Tomcat 4.1 and Win2K pro now. Do I need to set something for servlet just like CLASSPATH?
    Any help will be appreciated.
    package usingjsp;
    import java.io.*;
    import java.sql.*;
    import javax.servlet.*;
    public class JDBCServlet extends GenericServlet
    protected Connection conn;
    public void init()
    try
    // Make sure the JdbcOdbcDriver class is loaded
    Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
    // Try to connect to a database via ODBC
    conn = DriverManager.getConnection(
    "jdbc:microsoft:sqlserver://hu:1433", "sa","");
    catch (Exception exc)
    // If there's an error, use the servlet logging API
    getServletContext().log(
    "Error making JDBC connection: ", exc);
    public void service(ServletRequest request, ServletResponse response)
    throws java.io.IOException
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    out.println("<HTML>");
    out.println("<BODY>");
    out.println("<PRE>");
    out.println("The JDBC connection is:");
    out.println(conn);
    out.println("</PRE>");
    out.println("</BODY>");
    out.println("</HTML>");

    i also have this problem..do u have any solution?

  • Database Connection in SQL Server 2000

    Hi All!
    I would like to ask your expertise regarding JDBC-MS SQL Server 2000.
    I have here a sample code in connecting to SQL Server 2000, AgriMrpPrd Database using the account "sa" and the password "092802". I have tried running the code in my local server at home and It successfully runs, but when I tried running it on my local server in the office, I was not able to create a connection object though I already have changed the HOST, PORT, DATABASE, USERNAME, and PASSWORD values.
    I have tried logging in using my local account, removed the LAN connection, start my local server and tried connecting to it but still it does not work.
    I have tried turning the firewall OFF and try reconnecting but it there was no improvement.
    I do not know if there is a difference if there is my computer is on a DOMAIN (althought I am only connecting to my local server).
    Source Code:
    import javax.swing.*;
    import java.sql.*;
    import com.microsoft.jdbc.sqlserver.*;
    public class SQLServerConnection{
    public String un, pw, db, host, port, url, driver;
    public Connection conn=null;
    public void connectDB(){
    String msg="",title="MS SQL Server - JDBC:ODBC Connection";          
    int msgType=0;
    driver="com.microsoft.jdbc.sqlserver.SQLServerDriver";
    host="206.101.216.95";
    port="1433";
    un="sa";
    pw="092803";
    db="AgriMrpPrd";
    url="jdbc:microsoft:sqlserver://" + host + ":" + port + ";DatabaseName=" + db;
    try{
    Class.forName(driver);
    conn=DriverManager.getConnection(url,un,pw);     
    System.out.println("Connected to Database!");                    
    }catch(Exception ex){
    msg="Unable to connect to MS SQL Server!";
    msgType=JOptionPane.ERROR_MESSAGE;
    JOptionPane.showMessageDialog(null,msg,title,msgType);
    System.exit(0);               
    public static void main(String args[]){
    SQLServerConnection ssc=new SQLServerConnection();
    ssc.connectDB();
    Please give me wisdom in handling this problem...
    Take care always and God blesss
    MADz

    Hi All!
    I would like to ask your expertise regarding JDBC-MS
    SQL Server 2000.
    I have here a sample code in connecting to SQL Server
    2000, AgriMrpPrd Database using the account "sa" and
    the password "092802". I have tried running the code
    in my local server at home and It successfully runs,
    but when I tried running it on my local server in the
    office, I was not able to create a connection object
    though I already have changed the HOST, PORT,
    DATABASE, USERNAME, and PASSWORD values.If the code runs in one place and not the other, it's got to be a problem with seeing the host.
    I have tried logging in using my local account,
    removed the LAN connection, start my local server and
    tried connecting to it but still it does not work.
    I have tried turning the firewall OFF and try
    reconnecting but it there was no improvement.
    I do not know if there is a difference if there is my
    computer is on a DOMAIN (althought I am only
    connecting to my local server).I have no idea how to fix your problem, but there are several things to comment on about your code:
    (1) You don't have to import the microsoft package. It's actually a bad idea.
    (2) I'd name this class DbConnection, because if you wrote it properly it might have a chance of being useful wih other databases, too.
    (3) You hardwire all the connection information. Better to pass it in so changing the database doesn't require a recompile.
    (4) It's bad to mingle Swing and database code. Take those JOptionPane calls out.
    (5) Print the stack trace out when you catch an exception. You're losing a lot of information by handling it that way.
    %

  • Connection with SQL Server 2000 to SQL Developer 1.2 Migration Workbench

    Hi all,
    I keep getting the following error with setup for SQL Developer 1.2 Migration Workbench connection to SQL Server 2000 database:
    "Status: Failure -Network error IOException: Connection refused:connect"
    I can access the Microsoft SQL Server 2000 database with username
    and password using Enteprise Manager. However for some odd
    reason the Oracle SQL Developer 1.2 cannot connect to it.

    I was having this problem too. I'll mangle this explanation, but Our SQLServer instance was on a local server with some named DNS something. So, to get to the server, we used theservername.outdomain instead of an IP. We could never get it to connect through the named server. We got an SQLServer instance going on a server that we could connect to through a regular IP, and it connected just fine.
    Also, are you using the JTDS driver, or microsofts driver? We have only been able to connect with the JTDS driver. http://jtds.sourceforge.net/

  • Have anyone connected to sql server 2000 from forms 6i release 2

    Have anyone connected to sql server 2000 from forms 6i release 2
    on winNT 2000. sql server is also on same machine.
    If yes then pls tell me details regarding
    oca version
    any patch required for forms 6i release 2(download location of
    patch)
    version of odbc drivers
    or any other detils
    urgent
    thanks
    yogesh

    refresh

  • Connection String SQL SERVER 2000

    Hi everybody:
    I have a problem:
    I want to connect to Sql Server 2000 from Java Server Pages but I can not do it.
    In Active Server Pages I connect using:
    "Provider=SQLOLEDB;Data Source=" SERVIDOR";Initial Catalog=IntranetHipohard;User id=sa;Password="
    I would like that somebody write me by email.
    This string not is valid for Java Server Pages.
    How can I do it?
    Thank you very much and sorry my language.

    Well, it entirely depends on the JDBC driver you are using. If you are using Microsoft's driver currently in beta 2 (http://www.microsoft.com/sql), you use the following:
    Driver Name
    com.microsoft.jdbc.sqlserver.SQLServerDriver
    Connection URL
    jdbc:microsoft:sqlserver://<HOST>:1433;DatabaseName=<DATABASE>;User=<USER>;Password=<PASSWORD>
    Where <HOST> is the IP or hostname of the machine running SQL Server 2000, and <DATABASE> is the name of the database you are connecting to (optional).
    Hope this is what you need.

  • How to connect MS SQL Server 2000 with JDeveloper 11g

    Hi,
    I am new to JDevleoper, Is it possible to connect MS SQL Server 2000 with JDeveloper 11g.
    If possible can anyone help me in doing that?
    waiting for ur reply...
    Thanks in advance
    Regards,
    reddy

    Shay or other knowledgeable folks,
    Is there a way to utilize the wizard for "Business Tier > ADF Business Components > Business Components from Tables" for SQL Server 2000, 2005 or 2008. I can successfully execute sql via java programmatically or import a table from SQL Server with "Business Tier > ADF Business Components > Entity Object" wizard, but the Business Components from Tables simply doesn't see any tables under any schema. Without the "Business Components from Tables", i don't get the referential constraints imported into the application and to code all those from scratch is just not as elegant. So far i have only utilized the sql server jdbc driver from Microsoft (versions, 1.1, 1.2 and 2.0). Is there an alternative client that i need to use to enable selecting tables from that "Business Components from Tables" wizard. Is this a limitation of SQL Server, the jdbc driver or the wizard itself? Did anybody else experience the same issues? I am using Jdeveloper 11.1.1.0.1 against SQL Server 2005 (currently)
    Thanks,
    Andy

  • Error while connecting to SQL Server 2000 using Heteregenous Services 11g

    Hope this is the right thread to post on! We have been given the challenge of connecting to and reading data from a SQL Server 2000 database.
    Our Infrastructure guys have set up the network access.
    The SQL Server DB is set to windows NT Authentication only (N.B. NOT Mixed Mode) as there is an application running against the DB locally that will not run under Mixed Mode.
    Our Oracle partner has download and installed the 11g Heteregenous Services. all works fine until the point we try to create the DBLink and then connect to the SQL Server DB when we get:
    SQL> CREATE DATABASE LINK infoteam1.sco.infoteam.co.uk CONNECT TO "sco.infoteam.co.uk/infoteam" IDENTIFIED BY "########" USING 'dg4msql';
    Database link created.
    SQL> select * from "systables"@infoteam1.sco.infoteam.co.uk;
    select * from "systables"@infoteam1.sco.infoteam.co.uk
    ERROR at line 1:
    ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
    [Oracle][ODBC SQL Server Driver][SQL Server]Login failed for user
    'sco.infoteam.co.uk/infoteam'. Reason: Not associated with a trusted SQL Server
    connection.[Oracle][ODBC SQL Server Driver]Invalid connection string attribute
    ORA-02063: preceding 2 lines from INFOTEAM1.SCO.INFOTEAM.CO.UK
    The question is can we (and if so how)?) connect to the SQL Server using an NT Windows Authorised account?
    Jeremy

    Hi,
    Please look at MOS note
    ORA-28500: Generic connectivity using ODBC DSN over mapped drive fails [ID 105210.1]
    Ora-28500 with Ms Sqlserver - Not associated with a trusted SQL Server connection [ID 333775.1]
    Regards,
    Edited by: gjilevski1 on Aug 31, 2010 8:23 AM

  • JDBC connection for SQL Server 2000

    How to connect SQL Server 2000 from java?
    If i can get any sites where i can get examples also fine.
    Thanks in advance
    Praveen.

    Developer's Daily  Java Education 
      front page | java | perl | unix | DevDirectory 
      Front Page
    Java
    Education
    Pure Java
       Articles
    JDBC 101: How to connect to an SQL database with JDBC
    Introduction
    If you're interested in connecting your Java applets and applications to standard SQL databases like Oracle, Informix, Sybase, and others, JDBC is your ticket to paradise.  The combination of Java's JDBC and standard SQL makes a simple and powerful database solution. JDBC makes the simple things easy -- without making the complex tasks too difficult either.
    In this first article in our series, we'll show you step-by-step how to establish a connection from your Java programs to an SQL database using JDBC. In the process we'll show you how to connect to two different databases -- Mini SQL (mSQL), and Interbase -- just so you can see how the code changes when you switch from one database to another.
    Obtaining the JDBC driver
    Before you start working with JDBC, you'll need a copy of the Java JDK. If you don't have it already, you can get the JDK for free at Sun's Java web site, or it will also be included with many IDE's that you can purchase, such as JBuilder or Visual Cafe.
    Once you have the JDK, the next thing you need to do is to get the correct JDBC driver for your database. In most cases the JDBC driver will be provided by your database vendor. For instance, if you purchase the Interbase database, the driver will be provided with the software, or you can obtain the most recent version at http://www.interbase.com/.
    (An exception to this rule is Mini SQL, or mSQL. Because it's a very low-cost database, the JDBC driver has actually been developed by a separate group of people, led by George Reese at imaginary.com. You can download the mSQL JDBC driver from the imaginary.com web site.)
    Once you have the correct JDBC driver for your database, install it according to the instructions that came with it. Installation instructions will vary somewhat for each vendor.
    Establishing a connection is a two-step process
    Once you have the correct JDBC driver installed, establishing a connection from your Java programs to your SQL database is pretty easy.
    Regardless of whether you're trying to connect to Oracle, Sybase, Informix, mSQL, or Interbase (or any other JDBC data source), establishing a connection to an SQL database with Java JDBC is a simple two-step process:
    Load the JDBC driver.
    Establish the connection.
    We'll show you two examples just so you can see how easy it is, and how little the code changes when you migrate from one database server to another.
    A Mini SQL Example
    Listing 1 provides the full source code required to establish a connection to a mSQL database on a server named "www.myserver.com".
      //  Establish a connection to a mSQL database using JDBC. 
    import java.sql.*; 
    class JdbcTest1 { 
        public static void main (String[] args) { 
            try { 
                // Step 1: Load the JDBC driver. 
                Class.forName("com.imaginary.sql.msql.MsqlDriver"); 
                // Step 2: Establish the connection to the database. 
                String url = "jdbc:msql://www.myserver.com:1114/contact_mgr"; 
                Connection conn = DriverManager.getConnection(url,"user1","password");  
            } catch (Exception e) { 
                System.err.println("Got an exception! "); 
                System.err.println(e.getMessage()); 
      Listing 1: This source code example shows the two steps required to establish a connection to a Mini SQL (mSQL) database using JDBC. 
    An Interbase Example
    Listing 2 provides the full source code required to establish a connection to an Interbase database. In this example, we're connecting to a local Interbase server (i.e., the server is running on the same PC that we're running the Java code on).
      //  Establish a connection to an Interbase database using JDBC. 
    import java.sql.*; 
    class JdbcTest1 { 
        public static void main (String[] args) { 
            try { 
                // Step 1: Load the JDBC driver. 
                Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); 
                // Step 2: Establish the connection to the database. 
                String url = "jdbc:odbc:contact_mgr"; 
                Connection conn = DriverManager.getConnection(url,"user1","password");  
            } catch (Exception e) { 
                System.err.println("Got an exception! "); 
                System.err.println(e.getMessage()); 
      Listing 2: This source code example shows the two steps required to establish a connection to an Interbase database using JDBC. 
    What's the difference?
    The difference between the two source code listings is very small, so we highlighted them in a dark blue color. The only difference between connecting to the two databases is:
    The name of the JDBC driver.
    The URL used to connect to the database.
    Everything else in the two source code listings -- except for the comment at the top -- is identical. Here's a slightly more detailed discussion of the two differences:
    1. The JDBC Driver
    The name of the JDBC driver will be supplied to you by your database vendor. As you can see in the class.forName() statements, these names will vary. In the first case we're using the mSQL-JDBC driver. In the second case we're using the JDBC-ODBC Bridge driver supplied with the Interbase server.
    2. The URL
    The syntax of the DriverManager.getConnection() method is:
    DriverManager.getConnection(String url, String username, String password);
    The username and password are the normal names you use to log into your database. The URL you use will again vary with the database you use. In both examples shown, we're establishing a connection to a database named contact_mgr. (We'll use this database for all of our examples in this series of JDBC articles.)
    If you stick with standard SQL commands, it can be very easy to switch from one database server to another. In fact, I've heard from several developers who are using mSQL to prototype their software (because it's so inexpensive), and then switching to another commercial vendor when it's time to take their product "live".
    Conclusion
    Establishing a connection to an SQL database with Java JDBC is a simple, two-step process. The process is nearly identical for all SQL databases, and the only real differences are (a) the driver name, and (b) the URL used to connect to the database. Your database vendor will provide this information in their documentation.
    Resources mentioned in this article
    Here are a few links to resources we mentioned in this article:
    Interbase
    The Mini SQL (mSQL) database
    The mSQL-JDBC driver at imaginary.com
      [an error occurred while processing this directive]
     

Maybe you are looking for

  • IPhone losing all signal when put into sleep

    When I put my iPhone 4 to sleep after about a minute all of my signal drops off and I'm unable to receive calls or messages until I wake it When I wake it to signal indicator confirms what's happening and it displays either one bar or "no service." A

  • CS4 on Dual Core MacBook Pro...Unknown Recording Error?

    Hello! I am getting the "Unknown Recording Error" when I capture from my Analog-DV Bridge. It will record for a few minutes, then give the error. Recording quality for what it does record is perfect. Any ideas? Thanks!

  • Problem in using bind variables.

    I am using following query in my procedure: In 1st Query I am getting the result. And in 2nd Query when i am using bind variable i got error that " Table or View Does not Exist" ---------1st query OPEN p_document_details FOR SELECT ddd.document_code,

  • Please help me on Report

    Dear all IR report requirement is users enter the part number in text box, when he clicks ok then it needs to show off coresponding quantity, how the script needs to write down to populate the coresponding value. Ex Part No     Qty     CS 25ABCD12345

  • I am unable to transfer my audio book from my Mac lap top to my iPhone.  Can anyone help me?

    I am unable to transfer my audio book from my Mac laptop to my iPhone.  Can anyone help me?