jdbc javaOBjEX

  • divesh
  • Topic Author
  • Visitor
  • Visitor
15 years 11 months ago #3529 by divesh
jdbc javaOBjEX was created by divesh
can anyone send me a example of how does JDBC javaOBjEX works,
please include sample java program, JED SYSTEM MYACCOUNT. I have tried working on but get this error

java.sql.SQLException: direct SQL syntax error or access rule violation Compile
error: -1 File "First file specified in query " not found.

File SYSTEM , Record 'MYACCOUNT' Insert 16:54:08
Command->
0001 D
0002 C:\Madagascar\bnk\bnk.run
0003
0004
0005
0006
0007 /h{%Q`
0008
0009
0010
0011 -X "JEDIFILEPATH=D:\jbase4\home"


and dis is my java program


import java.sql.*;
import java.io.*;
public class JDBCTestJBase
{
public static void main (String args []) throws SQLException, IOException
{

Connection conn = null;
System.out.println ("Loading JDBC jBASE driver");
try
{
Class.forName ("com.jbase.jdbc.driver.JBaseJDBCDriver");
}
catch (ClassNotFoundException e)
{
System.out.println ("Could not load the driver. Is your classpath correct?");
e.printStackTrace ();
}
System.out.println ("Connecting to the local database");
try{
conn = DriverManager.getConnection("jdbc:jbasejo:thin:@localhost:3570:MYACCOUNT","bnk","shevid");
System.out.println("connextuon " + conn);

}
catch(Exception r)
{
System.out.println("error ah ithe");
}

try
{
Statement stmt = conn.createStatement();
System.out.println("statement" + stmt);
String s = "SELECT EB.CUS.NAME.1 FROM FBNK.CUSTOMER";
System.out.println(s);
ResultSet rset = stmt.executeQuery (s);
System.out.println("statement" + rset);
while (rset.next())
{
// Print the name out
String lastName = rset.getString(1);
String first = rset.getString("FIRST"); // case insensive, referencing alias first
System.out.println (lastName + ", " + first);
}
stmt.close();

conn.close();
}catch(SQLException se)
{
se.printStackTrace();
System.out.println("..........................");
String sErrorState = "Err Code: " + se.getErrorCode() + " SQL State: " + se.getSQLState() + " mesg: " + se.getMessage();
System.out.println(sErrorState);
System.out.println("..........................");
conn.close();
}
}
}


Please help

Please Log in or Create an account to join the conversation.

  • juanperez
  • Visitor
  • Visitor
15 years 1 month ago #4979 by juanperez
Replied by juanperez on topic Re:jdbc javaOBjEX
I made this steps.

1. Connect to GLOBUS via classic session((I'm made in a demo area)

2. From JBASE shell prompt type
JED SYSTEM TEMP.RELEASE

3. I aggreated the information
0003
0004
0005
0006
0007 /h{%Q`
0008
0009
0010
0011 -X "JEDIFILEPATH=D:\jbase4\home"

4. From DOS command line I cd to mi GLOBUS*.run directory
cd d:\t24areas\demo\demor.run

5. I call from here to JAVAOBEXServer
d:\t24areas\demo\demor.run\javaOBjEXServer start -V

6. I tested with

ResultSet rset = stmt.executeQuery ("SELECT * FROM FBNK.CUSTOMER");

7. I found an error when I tried to get more results from the resultSet.

8. I couldn't use SELECT NAME.1 FROM FBNK.CUSTOMER, JDBC said that it is a syntax error.

9. When you check the result MetaData you could see that the records were retrieved using identifiers like SHORT.NAME. Anyone knows why ?

Please Log in or Create an account to join the conversation.

Time to create page: 0.031 seconds