You are not logged in.

Dear visitor, welcome to Jabaco - Community. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

pgus

Beginner

  • "pgus" started this thread

Posts: 2

Date of registration: Jan 22nd 2013

  • Send private message

1

Tuesday, January 22nd 2013, 11:33pm

JDBC:ODBC

Hi All,
I have a problem with my application... I am connected to a JDBC:ODBC MS-ACCESS Driver - No problem. In IDE when I run my application, all is allright and there is no error. But ...

my code (source JABACO Forum April 2009) :
Dim Con As java#sql#Connection
Dim Order As java#sql#Statement
Dim Data As ResultSet

'Load the JDBC-ODBC driver
Class.forName "sun.jdbc.odbc.JdbcOdbcDriver"

'Create connection to the database test
Set Con = java#sql#DriverManager.getConnection("jdbc:odbc:MyDB_Access")

'Create a statement and send the command to the database
Set Order = Con.createStatement
Set Data = Order.executeQuery("SELECT * FROM text;")

'Print the result
Do While Data.next()
java#lang#system.out.println(Data.getString("Name"))
Loop

'Close the connection
Con.close

But after compiling and try it in Windows 7,there is an error : CallByName 'getString' failed... (java.lang.Exception: CallByName 'getString' failed!) see screenshot attached

Could you, please, help me
Thanks
pgus has attached the following image:
  • Capture.PNG

Dani

Intermediate

Posts: 325

Date of registration: Nov 19th 2009

Location: GERMANY

  • Send private message

2

Wednesday, January 23rd 2013, 6:59pm

Hey there,

I think the problem is your connection string

Quoted

Set Con = java#sql#DriverManager.getConnection("jdbc:odbc:MyDB_Access")


as opposed to

Jabaco Source

1
conn = java#sql#DriverManager.getConnection("jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb)};DBQ=C:\test\myDbfile")


have a look at my attached AccessToCsv sample App


Dani

This post has been edited 2 times, last edit by "Dani" (Jan 23rd 2013, 7:15pm)


pgus

Beginner

  • "pgus" started this thread

Posts: 2

Date of registration: Jan 22nd 2013

  • Send private message

3

Thursday, January 24th 2013, 7:47pm

Hi Dani,
Thanks for your reply. Your bill don't work... I have re-install all JABACO, clean the registry for all entry. Now my app works fine.
I look for a lot of documentation and I regret that there are not more numerous examples...
But bravo to JABACO

I have test Real Studio but it is very hard to understand ...

Thanks

Rate this thread
WoltLab Burning Board