aspose file tools*
The moose likes JDBC and the fly likes VisualAge Database Connectivity.....help! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "VisualAge Database Connectivity.....help!" Watch "VisualAge Database Connectivity.....help!" New topic
Author

VisualAge Database Connectivity.....help!

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Has anybody worked with Database in VisualAge?
If yes....................then please give your suggesstions for the following question!
1) When connecting Informix Database with VisualAge frontend using statement
String url = "jdbc:informix-sqli//db.test.cycosmos.com:1526/cdm:informixserver=ol_testdb";
String driverClassName = "com.informix.jdbc.IfxDriver";

2)The driver name is correctly identified as follows but the problem is only #3.
try
{
Class.forName(driverClassName);
//System.out.println(driverClassName);
}
catch(Exception e){
System.out.println("fails to load class");
e.printStackTrace();
return;
}

3)When giving the following connection:
Connection con = DriverManager.getConnection(url,user,pswd);

Statement select = con.createStatement();
ResultSet result = select.executeQuery("SELECT * FROM cdmuser");
VisualAge does not simply connect giving the error
java.lang.ClassCastException
java.lang.Throwable()
java.lang.Exception()
java.lang.RuntimeException()
java.lang.ClassCastException()
java.sql.Connection com.informix.jdbc.IfxDriver.connect(java.lang.String, java.util.Properties)
java.sql.Connection com.informix.jdbc.IfxDriver.connect(java.lang.String, java.util.Properties)
java.sql.Connection java.sql.DriverManager.getConnection(java.lang.String, java.util.Properties)
java.sql.Connection java.sql.DriverManager.getConnection(java.lang.String, java.lang.String, java.lang.String)

(Mind that this code works in JDK but its simply that now VisualAge simply doesnt go to this getConnection thing
Why the ClassCastException?
In case of no connection, it should give No Connect error.)
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Check your class and classpath settings.
Review your VisualAge install doc's.
My guess is that somewhere a checkbox, path, or option is the
cause of your problems.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
This is my classpath,
1)set classpath=U:\mwieland\out\java;C:\jdk1.3
java SelectApp
pause
The first U is the directory where the Informix Driver is, and in C ,jdk is my program and java files.
2)Actually even when i check the Driver with
public class CreateDB {
public static void main(String args []){
try
{
Class.forName("com.informix.jdbc.IfxDriver");
System.out.println("found informix driver");
}
catch(Exception e)
{
System.out.println("error to load informix driver");
e.printStackTrace();
return;
}
IT gives ClassNotFound, or ClassCastException.
3)It is not working in JDK1.3 also now...I wonder if the problem is in locatioin of driver or ???
This program is givig me lots of stress...please do help!!!
Keep up the good work!!!
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
hi
hope it will work.
try palcing u'r driver at the location where u'r class file will be located. this is the same kind of problem which i face when i was using oracle jdbc driver. this error was removed when i placed the driver's directory in the same place as class file of the program implementing my jdbc thing ( i.e my source file)...
naima muzammal
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: VisualAge Database Connectivity.....help!