Showing posts with label download. Show all posts
Showing posts with label download. Show all posts

Tuesday, March 27, 2012

connecting to SQL Server 2000 using JDBC

I've download Microsoft SQL Server 2000 JDBC Driver. All these files are being installed and saved in a folder called sql. For example, the IP adress is 255.255.255.255 , I updated the code and saved it as test1.java in this manner:

import java.sql.*;
/**
* Microsoft SQL Server JDBC test program
*/
public class test1 {
public test1() throws Exception {
// Get connection
DriverManager.registerDriver(new
com.microsoft.jdbc.sqlserver.SQLServerDriver());
Connection connection = DriverManager.getConnection(
"jdbc:microsoft:sqlserver:@.255.255.255","abc","abc");
if (connection != null) {
System.out.println();
System.out.println("Successfully connected");
System.out.println();
// Meta data
DatabaseMetaData meta = connection.getMetaData();
System.out.println("\nDriver Information");
System.out.println("Driver Name: "
+ meta.getDriverName());
System.out.println("Driver Version: "
+ meta.getDriverVersion());
System.out.println("\nDatabase Information ");
System.out.println("Database Name: "
+ meta.getDatabaseProductName());
System.out.println("Database Version: "+
meta.getDatabaseProductVersion());
}
} // Test
public static void main (String args[]) throws Exception {
test1 test = new test1();
}
}

I'm able to compile but when I run the program, the given error is:

Exception in thread "main" java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Unable to connect. Invalid URL.
at com.microsoft.jdbc.base.BaseExceptions.createExcep tion(Unknown Source
)
at com.microsoft.jdbc.base.BaseExceptions.getExceptio n(Unknown Source)
at com.microsoft.jdbc.base.BaseDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(DriverManager .java:512)
at java.sql.DriverManager.getConnection(DriverManager .java:171)
at test1.<init>(test1.java:10)
at test1.main(test1.java:31)

I have checked that the given IP address is correct, so please can anyone enlighten me about the problem.

Thanks.You must set your database name and port number such as following
Connection connection = DriverManager.getConnection(
"jdbc:microsoft:sqlserver:@.255.255.255:1433;Databas eName=MyDB","abc","abc");

You can also use your computer name in url

"jdbc:microsoft:sqlserver://MYSERVER:1433;DatabaseName=MYDB","USERID","PASSWORD"

Originally posted by diablos00
I've download Microsoft SQL Server 2000 JDBC Driver. All these files are being installed and saved in a folder called sql. For example, the IP adress is 255.255.255.255 , I updated the code and saved it as test1.java in this manner:

import java.sql.*;
/**
* Microsoft SQL Server JDBC test program
*/
public class test1 {
public test1() throws Exception {
// Get connection
DriverManager.registerDriver(new
com.microsoft.jdbc.sqlserver.SQLServerDriver());
Connection connection = DriverManager.getConnection(
"jdbc:microsoft:sqlserver:@.255.255.255","abc","abc");
if (connection != null) {
System.out.println();
System.out.println("Successfully connected");
System.out.println();
// Meta data
DatabaseMetaData meta = connection.getMetaData();
System.out.println("\nDriver Information");
System.out.println("Driver Name: "
+ meta.getDriverName());
System.out.println("Driver Version: "
+ meta.getDriverVersion());
System.out.println("\nDatabase Information ");
System.out.println("Database Name: "
+ meta.getDatabaseProductName());
System.out.println("Database Version: "+
meta.getDatabaseProductVersion());
}
} // Test
public static void main (String args[]) throws Exception {
test1 test = new test1();
}
}

I'm able to compile but when I run the program, the given error is:

Exception in thread "main" java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Unable to connect. Invalid URL.
at com.microsoft.jdbc.base.BaseExceptions.createExcep tion(Unknown Source
)
at com.microsoft.jdbc.base.BaseExceptions.getExceptio n(Unknown Source)
at com.microsoft.jdbc.base.BaseDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(DriverManager .java:512)
at java.sql.DriverManager.getConnection(DriverManager .java:171)
at test1.<init>(test1.java:10)
at test1.main(test1.java:31)

I have checked that the given IP address is correct, so please can anyone enlighten me about the problem.

Thanks.|||I had the same problem,

The problem is that the Microsoft jdbc driver used unicode and Ianywhere can't handle it.

Use an other jdbc driver from a 3de party will solve this problem.

I used the jdbc driver from datadirect (Type 4 jdbc driver) and this one
was working perfectly. Only thing is you have to pay for it.

I hope i could help you with this.

Greetz|||Microsofts JDBC driver works just fine. In fact it's an old data direct Type 4 driver. Make sure you have the service pack 1 jdbc driver. Here's the exact connection url I use with no problems.

jdbc:jtds:sqlserver://tlmssql3:1388/db1;USER=appsrv1;PASSWORD=password;TDS=8.0

Sunday, March 11, 2012

Connecting to DB2 / AS 400 from SQL Server

Bonjour,
I wish to access a DB2 database wich is on a AS 400.
1) wich OLE db driver must we use ?
2) where can we download it ?
3) is it free ?
3) how to configure it ?
We have try different syntaxes without success :
Example :
sp_addlinkedserver @.server = 'AccesDB2_AS400_TRY1'
, @.srvproduct = 'Microsoft OLE DB Provider for DB2'
, @.provider = 'DB2OLEDB'
, @.location = 'ASILON'
, @.provstr = 'Initial Catalog=EPSILON;Data
Source=DB2;HostCCSID=1252;Network Address=192.168.1.15;Network
Port=50000;Package Collection=admin;Default Schema=admin;'
, @.catalog = 'EPSILON'
Our AS 400 server name is ASILON
Our AS 400 server adress IP is 192.168.1.15
The database name is EPSILON
What are we missing ?
thanks
Frdric BROUARD, MVP SQL Server, expert bases de donnes et langage SQL
Le site sur le langage SQL et les SGBDR : http://sqlpro.developpez.com
Audit, conseil, expertise, formation, modlisation, tuning, optimisation
********************* http://www.datasapiens.com ***********************Hi Frdric,
There should be an OLEDB DB2 provider distributed with MDAC. From here you
can download the latest version:
http://msdn.microsoft.com/data/mdac...ds/default.aspx
Here are a couple of good links providing information about formatting
connection strings:
http://www.carlprothman.net/Default.aspx?tabid=81
http://www.connectionstrings.com/
JT
"SQLpro [MVP]" <brouardf@.club-internet.fr> wrote in message
news:%238ucAMsRGHA.2300@.TK2MSFTNGP11.phx.gbl...
> Bonjour,
> I wish to access a DB2 database wich is on a AS 400.
> 1) wich OLE db driver must we use ?
> 2) where can we download it ?
> 3) is it free ?
> 3) how to configure it ?
> We have try different syntaxes without success :
> Example :
> sp_addlinkedserver @.server = 'AccesDB2_AS400_TRY1'
> , @.srvproduct = 'Microsoft OLE DB Provider for DB2'
> , @.provider = 'DB2OLEDB'
> , @.location = 'ASILON'
> , @.provstr = 'Initial Catalog=EPSILON;Data
> Source=DB2;HostCCSID=1252;Network Address=192.168.1.15;Network
> Port=50000;Package Collection=admin;Default Schema=admin;'
> , @.catalog = 'EPSILON'
>
> Our AS 400 server name is ASILON
> Our AS 400 server adress IP is 192.168.1.15
> The database name is EPSILON
> What are we missing ?
>
> thanks
> --
> Frdric BROUARD, MVP SQL Server, expert bases de donnes et langage SQL
> Le site sur le langage SQL et les SGBDR : http://sqlpro.developpez.com
> Audit, conseil, expertise, formation, modlisation, tuning, optimisation
> ********************* http://www.datasapiens.com ***********************|||this posting made my day!!!
thanks!!!
--
thanks (as always)
some day i''m gona pay this forum back for all the help i''m getting
kes
"JT" wrote:

> Hi Frédéric,
> There should be an OLEDB DB2 provider distributed with MDAC. From here you
> can download the latest version:
> http://msdn.microsoft.com/data/mdac...ds/default.aspx
> Here are a couple of good links providing information about formatting
> connection strings:
> http://www.carlprothman.net/Default.aspx?tabid=81
> http://www.connectionstrings.com/
> JT
> "SQLpro [MVP]" <brouardf@.club-internet.fr> wrote in message
> news:%238ucAMsRGHA.2300@.TK2MSFTNGP11.phx.gbl...
>
>

connecting to database

Hi everybody

I was trying to connect to datatbase on my computer, through java. I understand that I will need to download JDBC driver for that. But i am not sure which driver will I need, and where do i need to put it. Do I have to make some changes in CLASSPATH as well?

I am using SQL 2000. My jdk profile is j2sdk1.4.2.01. Also what is subname in

jdbc:<subprotocol>:<subname>

is it the name of database or what?

In need of help !!!!!!

thanks in advanceThe jdbc drive should be in the classpath and added to your project (depends on your environment).

I believe that the subname is the database (could be its ip), with subprotocol being the driver, for db2 its db2, not sure thought for sql 2000.

Are you creating a standalone java application and appled or jsp ?

Wednesday, March 7, 2012

Connecting to a Remote Server with SQL Management Studio Express

I installed a copy of SQL 2005 Express on another computer here using the
automatic download and install from Microsoft supported by the setup
toolkit.
I can't access this server from another machine on the LAN using SQL
Management Studio Express. I can 'see' the server but cannot connect. Both
machines are running XP, mine is trying to log in as 'Guest'.
Do I need to configure SQL 2005 on the remote machine to use mixed-mode
authentication and try to log in using an SQL password, or is there a way to
make a remote user work with Windows Authentication?
How should I go about this?
Thanks.
You will have to disable the simple filesharhing in XP, otherweise the
client will try to logon using the guest account.
Jens K. Suessmeyer.
http://www.sqlserver2005.de
|||If you haven't done so yet - enable TCP/IP via the SQL Server Surface Area
Configuration tool / Remote Connections on the destination SQL Server. SQL
Server 2005 Express doesn't enable this by default. Also turn on the SQL
Browser service.
M a M
"Jens" wrote:

> You will have to disable the simple filesharhing in XP, otherweise the
> client will try to logon using the guest account.
>
> Jens K. Suessmeyer.
> --
> http://www.sqlserver2005.de
> --
>
|||Thanks. I have done that but apparently have to enable mixed mode
authentication on the server in order to authenticate. How do I do this?
regards.
"M a M" <MaM@.discussions.microsoft.com> wrote in message
news:6045D19B-3B4F-4B27-B3CD-F82DD325E7DA@.microsoft.com...[vbcol=seagreen]
> If you haven't done so yet - enable TCP/IP via the SQL Server Surface Area
> Configuration tool / Remote Connections on the destination SQL Server. SQL
> Server 2005 Express doesn't enable this by default. Also turn on the SQL
> Browser service.
> M a M
> "Jens" wrote:
|||You could simply add the Windows NT account via the Security / Logins of the
Server in question. You have to log into the server locally obviously to make
this change. Either add the NT account or (your request) change the "Server
authentication" to SQL Server and Windows Authentication mode via the
Security tab of the SQL Server properties.
M a M
"Andrew Chalk" wrote:

> Thanks. I have done that but apparently have to enable mixed mode
> authentication on the server in order to authenticate. How do I do this?
> regards.
> "M a M" <MaM@.discussions.microsoft.com> wrote in message
> news:6045D19B-3B4F-4B27-B3CD-F82DD325E7DA@.microsoft.com...
>
>
|||> this change. Either add the NT account or (your request) change the
> "Server
> authentication" to SQL Server and Windows Authentication mode via the ...
How? This is XP with no SQL Management Studio Express. I have to connect
first before I can access the database with SQL MSE. That is the object of
this exercise.
Thanks.
"M a M" <MaM@.discussions.microsoft.com> wrote in message
news:96E18316-203F-46F1-A01D-FDEBE024CCBB@.microsoft.com...[vbcol=seagreen]
> You could simply add the Windows NT account via the Security / Logins of
> the
> Server in question. You have to log into the server locally obviously to
> make
> this change. Either add the NT account or (your request) change the
> "Server
> authentication" to SQL Server and Windows Authentication mode via the
> Security tab of the SQL Server properties.
> M a M
> "Andrew Chalk" wrote:
|||I loaded MSE on the remote machine and changed the logi mode to mixed. After
that, I was able to connect remotely with MSE.
So, my question boils down to this: How do I set the login mode of SQL
Server 2005 Express to mixed WITHOUT Manaagement Studio Express?
Thanks.
"M a M" <MaM@.discussions.microsoft.com> wrote in message
news:96E18316-203F-46F1-A01D-FDEBE024CCBB@.microsoft.com...[vbcol=seagreen]
> You could simply add the Windows NT account via the Security / Logins of
> the
> Server in question. You have to log into the server locally obviously to
> make
> this change. Either add the NT account or (your request) change the
> "Server
> authentication" to SQL Server and Windows Authentication mode via the
> Security tab of the SQL Server properties.
> M a M
> "Andrew Chalk" wrote:
|||HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL
Server\MSSQL.1\MSSQLServer change LoginMode from 1 to 2 and restart SQL
Server services.
"Andrew Chalk" wrote:

> I loaded MSE on the remote machine and changed the logi mode to mixed. After
> that, I was able to connect remotely with MSE.
> So, my question boils down to this: How do I set the login mode of SQL
> Server 2005 Express to mixed WITHOUT Manaagement Studio Express?
> Thanks.
> "M a M" <MaM@.discussions.microsoft.com> wrote in message
> news:96E18316-203F-46F1-A01D-FDEBE024CCBB@.microsoft.com...
>
>
|||Thanks!
"M a M" <MaM@.discussions.microsoft.com> wrote in message
news:6DBDB113-6DDE-4FAC-A09E-74FAAECAE75A@.microsoft.com...[vbcol=seagreen]
> HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL
> Server\MSSQL.1\MSSQLServer change LoginMode from 1 to 2 and restart SQL
> Server services.
> "Andrew Chalk" wrote:

Connecting to a Remote Server with SQL Management Studio Express

I installed a copy of SQL 2005 Express on another computer here using the
automatic download and install from Microsoft supported by the setup
toolkit.
I can't access this server from another machine on the LAN using SQL
Management Studio Express. I can 'see' the server but cannot connect. Both
machines are running XP, mine is trying to log in as 'Guest'.
Do I need to configure SQL 2005 on the remote machine to use mixed-mode
authentication and try to log in using an SQL password, or is there a way to
make a remote user work with Windows Authentication?
How should I go about this?
Thanks.You will have to disable the simple filesharhing in XP, otherweise the
client will try to logon using the guest account.
Jens K. Suessmeyer.
http://www.sqlserver2005.de
--