Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

Invalid JDBC connection

3 posts in JDBC Connect (product renamed to JConnect) Last posting was on 1997-08-07 11:27:53.0Z
Brian Durgin Posted on 1997-08-06 19:32:48.0Z
From: "Brian Durgin" <bdurgin@maine.rr.com>
Subject: Invalid JDBC connection
Organization: Time Warner
Message-ID: <01bca2a6$6faf6dd0$0c57d2cc@motherdell>
X-Newsreader: Microsoft Internet News 4.70.1161
Newsgroups: sybase.public.jdbcconnect
Date: Wed, 06 Aug 1997 15:32:48 -0400
Lines: 151
Path: forums-1-dub!forums-master.sybase.com!forums.powersoft.com
Xref: forums-1-dub sybase.public.jdbcconnect:403
Article PK: 252156

I'm having problems performing any actions on a connection that I establish
to a SQL Anywhere open server gateway. I get the following error message:

*************** BEGIN Open Server Gateway Messages
************************
Wed Aug 6 16:05:38 1997 Failed to set connection options for T-SQL
compatibility
Wed Aug 6 16:05:38 1997 Validate Connection: Invalid connection
Wed Aug 6 16:05:38 1997 Validate Connection: Invalid connection
Wed Aug 6 16:05:38 1997 Validate Connection: Invalid connection
Wed Aug 6 16:05:38 1997 Validate Connection: Invalid connection
*************** END Open Server Gateway Messages ************************

This is a 1.02 applet running in the PowerJ environment. I beleive I am
using one of the following SybDriver classes:

C:\Program
Files\Powersoft\PowerJ20\Java\jconnect\devclasses\com\sybase\jdbc
05/21/97 02:47p 7,147 SybDriver.class

C:\Program Files\Powersoft\PowerJ20\Java\jconnect\classes\jdbc\sybase\jdbc
05/21/97 02:47p 5,773 SybDriver.class

Below is the code that I use to establish the connection. I've used this
code before and it has always worked. This is the first time I have used
it on this machine with this version of PowerJ (Build 184).

*************************** BEGIN Connection Code
***********************************

public boolean connectToDB()
{
String driver; // name of theJDBC driver to use
String user_id; // user id for connecting to
database
String password; // password for connecting to
database
String url; // the URL of the database
connection
Class driver_class; // The JDBC driver class
boolean connected = false; // set to true if connection
succeeds

user_id = "dba";
password = "sql";

// Determine which ODBC driver to use
if (jdbc_driver.equals("odbc")){
driver = "sun.jdbc.odbc.JdbcOdbcDriver";
url = "jdbc:odbc:syberbank";
}
else {
driver = "jdbc.sybase.jdbc.SybDriver";
url = "jdbc:sybase:Tds:localhost:5533";
}

try {

debugMsg("Loading driver " + driver);

driver_class = Class.forName(driver);
// DriverManager.registerDriver(driver_class.newInstance());

debugMsg("Establishing connection to " + url);

con = DriverManager.getConnection(url, user_id, password);

// If we were unable to connect, an exception
// would have been thrown. So, if we get here,
// we are successfully connected to the URL
// Check for, and display and warnings generated
// by the connect.
printSQLWarnings(con.getWarnings());

// Get the DatabaseMetaData object and display
// some information about the connection.
printDriverInfo(con);

// Create a Statement object so we can submit
// SQL statements to the driver
stmt = con.createStatement();

// If we are using TDS, tell the gateway which database
// to use.
if (jdbc_driver.equals("tds"))
stmt.execute("use syberbank");

// If there was an exception we wouldn't have made it here
// so we must be connected, right?
connected = true;

}
catch (java.lang.ClassNotFoundException e) {
System.err.print ("Specified class not found: ");
System.err.println (e.getMessage());
}
catch (jdbc.sql.SQLException sqle) {
printSQLExceptions(sqle);
}
catch (java.lang.Exception ex) {
// Got some other type of exception. Dump the stack trace.
System.err.print ("Exception Occurred: ");
ex.printStackTrace();
}
return connected;

}
************ END Connection Code **********************************

****************** OUTPUT of Java console ***************************
---------------------------------------
starting code

Sybase jConnect (TM) for JDBC (TM) 2.1 Development and Unsupported Version
It is an unsupported product and is not intended for deployment. It does
not i
nclude free technical support. You can purchase technical support on an
annual
or pay-per-issue basis. Discussion Newsgroup is available on
www.sybase.com.
For additional information on services or run-time license, please check
Sybas
e website or call 1-800-8-SYBASE or +1-510-922-3500 outside of the USA and
Cana
da.

Copyright 1997 Sybase, Inc.
All Rights Reserved
Loading driver jdbc.sybase.jdbc.SybDriver
Establishing connection to jdbc:sybase:Tds:localhost:5533

*** Warning ***

SQLState: 010SJ
Message: Metadata accessor information was not found on this database:
Metadata
accessor information was not found on this database
Vendor: 0

-------------------------------------
Driver :jConnect (TM) for JDBC (TM)
Version :jConnect (TM) for JDBC(TM)/2.1/PowerJ Development
Version/JDK102/Fri M
ay 9 13:41:15 1997
-------------------------------------

Executing Query: SELECT * FROM customer

*** SQLException caught ***

-------------------------------------
SQLState: JZ0R2
Message: No result set for this query: No result set for this query
Vendor: 0
-------------------------------------
************************* END OF OUTPUT
**************************************

Does anyone know whats going on? I can connect to the database useing ISQL
with no problem and execute quires.

Thanks in advance,

Brian Durgin
Sybase Professional Services


David Lance Wolf Posted on 1997-08-06 23:39:07.0Z
Message-ID: <33E90B1A.5EC27D81@sybase.com>
Date: Wed, 06 Aug 1997 16:39:07 -0700
From: David Lance Wolf <dwolf@sybase.com>
Organization: Sybase Professional Services
X-Mailer: Mozilla 4.01 [en] (Win95; U)
MIME-Version: 1.0
Subject: Re: Invalid JDBC connection
X-Priority: 3 (Normal)
References: <01bca2a6$6faf6dd0$0c57d2cc@motherdell>
Content-Type: multipart/mixed; boundary="------------D5B178433E0C81C3CFAA355A"
Newsgroups: sybase.public.jdbcconnect
Lines: 37
Path: forums-1-dub!forums-master.sybase.com!forums.powersoft.com
Xref: forums-1-dub sybase.public.jdbcconnect:402
Article PK: 252153

Brian, have you run the sql_anywhere.sql script against your database
yet?? This installs the sp_mda proc et. al. which allows the driver to
capture the DatabaseMetdata() information??

Dave Wolf
Sybase Professional Services

> Message: Metadata accessor information was not found on this
> database:
> Metadata
> accessor information was not found on this database
> Vendor: 0
>
> -------------------------------------
> Driver :jConnect (TM) for JDBC (TM)
> Version :jConnect (TM) for JDBC(TM)/2.1/PowerJ Development
> Version/JDK102/Fri M
> ay 9 13:41:15 1997


Download VCard vcard.vcf


Brian Durgin Posted on 1997-08-07 11:27:53.0Z
From: "Brian Durgin" <bdurgin@maine.rr.com>
Subject: Re: Invalid JDBC connection
References: <01bca2a6$6faf6dd0$0c57d2cc@motherdell> <33E90B1A.5EC27D81@sybase.com>
Organization: Time Warner
Message-ID: <01bca32b$d727c400$0c57d2cc@motherdell>
X-Newsreader: Microsoft Internet News 4.70.1161
Newsgroups: sybase.public.jdbcconnect
Date: Thu, 07 Aug 1997 07:27:53 -0400
Lines: 23
Path: forums-1-dub!forums-master.sybase.com!forums.powersoft.com
Xref: forums-1-dub sybase.public.jdbcconnect:397
Article PK: 252149

Yes I did.

The problem was that I tried to create a new database by simply copying an
old database (which has almost the exact structure I need) to a new
database name. I then ran the sql_any50.sql on that database. After I ran
into all of the problems (mentioned in my previous message) I erased the
database, created a new database using Sybase Central, exported the
structure of my old database, and imported the tables into the new
database. Then I ran sql_an50.sql on the new database. Now everything is
working fine.

Thanks for you help.

David Lance Wolf <dwolf@sybase.com> wrote in article
<33E90B1A.5EC27D81@sybase.com>...
> Brian, have you run the sql_anywhere.sql script against your database
> yet?? This installs the sp_mda proc et. al. which allows the driver to
> capture the DatabaseMetdata() information??
>
> Dave Wolf
> Sybase Professional Services
>