Sponsored Content
Full Discussion: Unix to Sql Server via JDBC
Top Forums Shell Programming and Scripting Unix to Sql Server via JDBC Post 302168493 by cqldba on Monday 18th of February 2008 02:24:05 PM
Old 02-18-2008
Unix to Sql Server via JDBC

I am trying to connect SQL SERVER VIA JDCB. Following is something I tried and will appreciate any help what I am doing wrong
Here's what I did, I tried several variations, but I keep getting this error:

Code:
Exception in thread "main" java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Unable to connect.  Invalid URL

I tried:

Code:
Driver d = (Driver)Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();

Connection con = DriverManager.getConnection("jdbc:microsoft:sqlserver://133.5.144.155/:1433/IE;selectMethod=cursor", "jdbc123", "test1456"); replacing ://133.5.144.155 with \\IP

my classpath is :
voyager->whseuser: echo $CLASSPATH

/apps/twhse/scripts/jen:/apps/twhse/scripts/jen/mssqlserver/lib/msutil.jar:/apps/twhse/scripts/jen/mssqlserver/lib/mssqlserver.jar:/apps/twhse/scripts/jen/mssqlserver/lib/msbase.jar
and it's not giving me a classpath error, so I think my classpath is right.

import java.sql.*;

//import oracle.jdbc.*;
public class HelloWorldApp {

    public static void main(String[] args) throws Exception {

       System.out.println("Hello World!"); // Display the string.

Driver d = (Driver)Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();

Connection con = DriverManager.getConnection("jdbc:microsoft:sqlserver://133.5.144.155/:1433/IE;selectMeth

od=cursor", "jdbc123", "test456");
    }
}

I have never tried this on a sqlserver before, only in oracle.
will appreciate any response at
thanks
sam
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Installing Ms Sql Server 2000 On Unix

Hello As per requirements, can i Install a MSSQL SERVER on UNIX , is it possible., can i install or not.., could u plz give me reply with some installation details.......... Regards&Thanking You sreedhar G (1 Reply)
Discussion started by: sreedhargunda
1 Replies

2. UNIX for Dummies Questions & Answers

MS SQL Server on UNIX

Hi GURUs, I have following queries: 1) If its possible to configure Microsoft SQL Server database on a UNIX machine, if yes, can any body pls point me to the guide to acheive the same. 2) I know Oracle runs perfectly on UNIX based machines, can any body point me to the guide to achieve the... (6 Replies)
Discussion started by: patras
6 Replies

3. Shell Programming and Scripting

From Solaris UNIX to MS SQL Server

Hello, my problem is, that I want to send an SQL-Statement via ksh-Shell to an MS-SQL-Database based on SQL Server 2005. I want to receive a file, which can be used for further actions on UNIX (Sun OS 5.9). ODBCUnix and JDBC and FreeTDS are not allowed. Does anybody have a suggestion? Br,... (0 Replies)
Discussion started by: usagi67
0 Replies

4. Programming

JDBC code to pass the SQL query as parameter and execute?

Below i have the sample code. i need to pass the entire query from file or as parameter and read the results and write into a output file. here the number of columns are unknown. some times it may be 2,3 or entire columns from the table. read all the column results and write into a comma... (0 Replies)
Discussion started by: laknar
0 Replies

5. Shell Programming and Scripting

Unix with sql Server 2005

Hello All I am getting a problem.What i want to do is to connect unix(korn shell) and sql server 2005. But it is not happening. The task is to schedule a job using crown or something else that connect with sql server 2005 and run the query and save the result in a text file. (5 Replies)
Discussion started by: parthmittal2007
5 Replies

6. Emergency UNIX and Linux Support

How to connect Unix and Sql Server 2005?

Hi All Can any one please help me about How to connect Unix with Sql Server 2005 I want to do it urgently and i didn't find the way. (14 Replies)
Discussion started by: parthmittal2007
14 Replies

7. Shell Programming and Scripting

Unix and SQL server

Hi All, I am accessing Unix through putty (i.e. unix is installed on other server and i am accessing it remotely through putty). I am having SQL Server 2008 installed on my computer. Now i want to access sql server via. unix. Could some one please help me in this!!! Thanks (2 Replies)
Discussion started by: preetpalkapoor
2 Replies

8. Shell Programming and Scripting

Invoking sql server from UNIX

I would like to invoke a procedure in SQL server which will return some results of a select query from UNIX script. I would like to invoke this procedure and load the data into a flat file in UNIX. Can you please help? I am not able to find any sample programs in Internet. (1 Reply)
Discussion started by: madhu.sushmitha
1 Replies

9. IP Networking

Connection to DB from client server through jdbc:Oracle:Oci8 fail

We tried to use to connect to DB using jdbc:Oracle:Oci8:@<SERVICE-A>. Connection fail / refuse with one DB .But its working with other databases. But through toad, jdbc thin client were able to connect. But this has happen suddenly and were able to connect previously. How to navigate this... (0 Replies)
Discussion started by: udara
0 Replies
ALTER 
SERVER(7) PostgreSQL 9.2.7 Documentation ALTER SERVER(7) NAME
ALTER_SERVER - change the definition of a foreign server SYNOPSIS
ALTER SERVER name [ VERSION 'new_version' ] [ OPTIONS ( [ ADD | SET | DROP ] option ['value'] [, ... ] ) ] ALTER SERVER name OWNER TO new_owner ALTER SERVER name RENAME TO new_name DESCRIPTION
ALTER SERVER changes the definition of a foreign server. The first form changes the server version string or the generic options of the server (at least one clause is required). The second form changes the owner of the server. To alter the server you must be the owner of the server. Additionally to alter the owner, you must own the server and also be a direct or indirect member of the new owning role, and you must have USAGE privilege on the server's foreign-data wrapper. (Note that superusers satisfy all these criteria automatically.) PARAMETERS
name The name of an existing server. new_version New server version. OPTIONS ( [ ADD | SET | DROP ] option ['value'] [, ... ] ) Change options for the server. ADD, SET, and DROP specify the action to be performed. ADD is assumed if no operation is explicitly specified. Option names must be unique; names and values are also validated using the server's foreign-data wrapper library. new_owner The user name of the new owner of the foreign server. new_name The new name for the foreign server. EXAMPLES
Alter server foo, add connection options: ALTER SERVER foo OPTIONS (host 'foo', dbname 'foodb'); Alter server foo, change version, change host option: ALTER SERVER foo VERSION '8.4' OPTIONS (SET host 'baz'); COMPATIBILITY
ALTER SERVER conforms to ISO/IEC 9075-9 (SQL/MED). The OWNER TO and RENAME forms are PostgreSQL extensions. SEE ALSO
CREATE SERVER (CREATE_SERVER(7)), DROP SERVER (DROP_SERVER(7)) PostgreSQL 9.2.7 2014-02-17 ALTER SERVER(7)
All times are GMT -4. The time now is 11:11 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy