Linux JDBC connection wont
Posted in 1998
Topics: Connectivity: ODBC / JDBC / .NET, Connectivity: ESQL/C, 4GL & Embedded SQL, Server Administration, Security, Permissions & Auditing, Platform-Specific Issues, Java & JDBC Development
This is a multi-part message in MIME format.
--------------EE37494D82FAC23AEBB56174
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
I have a very short java program to test out the JDBC driver I just
downloaded from informix. Just trying to connect to the stores database.
I can access the database with dbaccess and with esqlc and all looks
good. This is on a SuSE 5.3 Linux machine.
The java program will connect to the database server if, I leave out the
database name (stores7). If I put the database name in the program it
pukes with a 329 error. The DBAPTH variable is set to
/home/informix/data and this is where the stores7.dbs directory is
located.
What did I miss here?
program and output are attached below.
Thanks for your time,
Kyle Dansie
--
--------------------------------------------------------
Linux Rules
ZIP drive Mini-HOWTO
http://njtcom.com/dansie/zip-drive.html
or
http://sunsite.unc.edu/mdw/HOWTO/mini/ZIP-Drive.html
--------------------------------------------------------
--------------EE37494D82FAC23AEBB56174
Content-Type: text/plain; charset=us-ascii; name="login.java"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="login.java"
import java.sql.*;
public class login {
public static void main(String argv[])
throws Exception
{
System.out.println("This is the top of the login program.");
DriverManager.setLogStream(System.out); // testing here **
// The simplest thing to do is to not use Properties and embed the
// connection parameters in the URL.
String dbDriver = new String();
String dbUrl = new String();
dbDriver="com.informix.jdbc.IfxDriver";
dbUrl="jdbc:informix-sqli://zues:8000/stores7:INFORMIXSERVER=dbexample;user=informix;password=kjd01";
Connection conn2;
try {
System.out.println("Start of classforname");
Class.forName(dbDriver);
System.out.println("End of classforname");
}
catch (Exception e) {
System.out.println("Error : failed to load informix JDBC driver. ");
}
try {
System.out.println("starting conn2=... ");
conn2=DriverManager.getConnection(dbUrl);
System.out.println("end of conn2=....");
}
catch (Exception e) {
System.out.println("Error : failed to connect to database");
}
System.out.println("End of Program. ");
}
}
--------------EE37494D82FAC23AEBB56174
Content-Type: text/plain; charset=us-ascii; name="login.out"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="login.out"
This is the top of the login program.
Start of classforname
DriverManager.initialize: jdbc.drivers = null
JDBC DriverManager initialized
registerDriver: driver[className=com.informix.jdbc.IfxDriver,context=null,com.informix.jdbc.IfxDriver@80cc5fa]
End of classforname
starting conn2=...
DriverManager.getConnection("jdbc:informix-sqli://zues:8000/stores7:INFORMIXSERVER=dbexample;user=informix;password=kjd01")
trying driver[className=com.informix.jdbc.IfxDriver,context=null,com.informix.jdbc.IfxDriver@80cc5fa]
SQLException: SQLState(IX000) vendor code(-329)
java.sql.SQLException: Database not found or no system permission.
at com.informix.util.IfxErrMsg.getSQLException(IfxErrMsg.java)
at com.informix.jdbc.IfxSqliConnect.<init>(IfxSqliConnect.java)
at com.informix.jdbc.IfxDriver.connect(IfxDriver.java)
at java.sql.DriverManager.getConnection(DriverManager.java:91)
at java.sql.DriverManager.getConnection(DriverManager.java:149)
at login.main(login.java:34)
getConnection failed: java.sql.SQLException: Database not found or no system permission.
Error : failed to connect to database
End of Program.
--------------EE37494D82FAC23AEBB56174--