freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
JDBC driver bug when connecting to DB that starts with number
- From: Irfan Baig <irfan AT abstractedge.com>
- To: TDS Development Group <freetds AT franklin.oit.unc.edu>
- Subject: JDBC driver bug when connecting to DB that starts with number
- Date: Thu, 7 Jun 2001 14:33:57 -0400
Problem Description:
When I try to connect to a database whose name begins with a number (e.g.
'4film'), I get the following exception:
--
SQLException: Logon failed. Msg 170, Lvl 15, State 1, Line 1: Incorrect
syntax near '4'., Server BENITEZ, Procedure , Line 1 0 connection are in use
by this program SQLState: null VendorError: 0
--
The driver works fine for DBs with names beginning in alphabets.
Details (as requested in FAQ)
1. Unsure, it compiled into a directory structure (com/internetcds/...etc)
and i added the hierarchy to my classpath - how do I ident it? The source was
unpacked from a file named freetds_jdbc-0.2.tgz.
2. Default (4.2)
3. Java (TM) 2 Runtime Environment, Standard Edition (build 1.3.0_02)
Java HotSpot (TM) Client VM (build 1.3.0_02, mixed mode)
4. Microsoft SQL Server 7.00 - 7.00.623 (Intel X86) Nov 27 1998 22:20:07
Copyright (c) 1988-1998 Microsoft Corporation Standard Edition on Windows NT
4.0 (Build 1381: Service Pack 4)
5. Windows NT 4.0
6. Yes
Program Source:
--
import java.sql.*;
public class LoadDriverMSSQL
{
public static void main(String[] Args)
{
try {
Class.forName("com.internetcds.jdbc.tds.Driver").newInstance();
Driver driver = new com.internetcds.jdbc.tds.Driver();
}
catch (Exception E) {
System.err.println("Unable to load driver.");
E.printStackTrace();
}
try {
Connection C =
DriverManager.getConnection("jdbc:freetds:sqlserver://benitez/4film",
"irfan", "irfan");
System.out.println("Connected...");
// Do something with the Connection
try {
Statement
Stmt = C.createStatement();
ResultSet RS
= Stmt.executeQuery("SELECT @@VERSION");
while
(RS.next()) {
System.out.println(RS.getString(1));
}
// Clean up
after ourselves
RS.close();
Stmt.close();
C.close();
}catch (SQLException E) {
System.out.println("SQLException: " + E.getMessage());
System.out.println("SQLState: " + E.getSQLState());
System.out.println("VendorError: " + E.getErrorCode());
}
}catch (SQLException E) {
System.out.println("SQLException: " + E.getMessage());
System.out.println("SQLState: " + E.getSQLState());
System.out.println("VendorError: " + E.getErrorCode());
}
}
}
--
irfan.baig = "International Space Station Ground Crew, Abstract Edge"
irfan.phone = "212.352.9311 ext 102"
irfan.fax = "212.352.9498"
-
JDBC driver bug when connecting to DB that starts with number,
Irfan Baig, 06/07/2001
- <Possible follow-up(s)>
- Re: JDBC driver bug when connecting to DB that starts with number, Curt Hagenlocher, 06/07/2001
- Re: JDBC driver bug when connecting to DB that starts with number, Bob Kline, 06/07/2001
- Re: JDBC driver bug when connecting to DB that starts with number, Irfan Baig, 06/07/2001
- Re: JDBC driver bug when connecting to DB that starts with number, Irfan Baig, 06/07/2001
- Re: JDBC driver bug when connecting to DB that starts with number, Curt Hagenlocher, 06/07/2001
Archive powered by MHonArc 2.6.24.