Re: Linux JDBC connection wont
Posted in 1998
Kyle,
I've been able to connect to an SE database on SCO OpenServer.
I looked under the the release notes
(driver directory/doc/release/jdbcrel.txt) to help me connect to the SE
database.
The URL I used:
String url =
"jdbc:informix-sqli://myhostname:1525//u3/mt5.0/fms:INFORMIXSERVER=" +
"olcnet_se;user=candy;password=mypassword";
I used the IP-address for "myhostname". 1525 is the number in the
"services" file for sqlexec (name for the service, could be what
ever you choose). The database "fms" is located in the directory /u3/mt5.0
on the host (there's a subdirectory there called fms.dbs). I had tried
using
DBPATH, but then looked in the "jdbcrel.txt" file to help me. Hope this
helps!
Candy
--
Candy McCall
ONLINE Computing, Inc.
(candym@olcinc.com)
>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
>
>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. ");
>
> }
>}
>
>
>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:INFORMI
XSERVER=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--
>