on 2012 Jan 27 11:19 AM
I've converted a PowerBuilder from PB8 to 12.5. I would also like to get rid of the ODBC drivers installed on each client pc using JDBC. But before I change app code.
In PowerBuilder itself, I want to setup a JDBC profile to connect to my SQLanywhere 12 DB. In the connect information I supplied:
DRIVER NAME: sybase.jdbc4.sqlanywhere.IDriver
URL: sqlanywhere:DBN=mydb;Servername=Test_sqlanywhere12;AStart=NO;
LOGINID:dba
PASSWORD:***
When I test the connection I the error popup: POWERBUILDER Non SQL Error: cound not load class sybase.jdbc4.sqlanywhere.IDriver
The CLASSPATH used by PB does not include %sqlany12%\\java\\sajdbc4.jar. You can add this by opening the menu item Tools | System Options and adding this jar on the Java tab or in a CLASSPATH environment variable that is visible to PB. You may need to restart PB for the change to be visible.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I did add to the jar to the reg settings. It did work. But that is not the solution I was looking for. I want to be able to make the JDBC connection without making driver installs or registry changes. If I need to change the client, I will not be gaining much over just continuing to use ODBC.
Is there something I can add to my powerscript connection logic to update the classpath with the jar location?
http://www.sybase.com/detail?id=47902
Why use the JDBC Interfaces? Depending on which product you are using, the use of the JDBC interface enables you to develop several types of components and/or applications in PowerBuilder: Thin client/server applications If a client is already running a Java VM (in a running Web browser or inside the operating system), the use of the JDBC interface to access a database does not require the client-side installation and administration of a database driver such as what is required when using ODBC. The major advantage of using JDBC over ODBC drivers in PowerBuilder is zero client site configurations.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have not used the JDBC interface in PB until now so you may want to ask this in a PowerBuilder focused forum as someone may know other mechanisms to resolve this.
I looking at the options that can be set in code, I see nothing that allows you to identify the JDBC driver jar. But what you can do is create a launcher app or a batch that defines an isolated environment for the application to use and launches the application. Sybase Central and dbisql use this technique.
A simple batch could be
set CLASSPATH=<desired classpath=""> YourApp.exe
Your advice has been a big help to get the JDBC profile setup in PB.
That worked to get me a JDBC profile connection in PB12.5
Then I wanted to get my app changed.
//SQLCA.DBMS = "ODBC" *became* SQLCA.DBMS = "JDBC" //SQLCA.dbparm = "ConnectString='DSN=" + ls_server + ";UID=" + trim(sle_userid.text) + & ";PWD=" + string(ls_dbpassword) + "'" *became* SQLCA.dbparm = "URL='jdbc:sqlanywhere:DBN=" + ls_server + ";UID=" + trim(sle_userid.text) + ";PWD=" + string(ls_dbpassword) + ";ServerName=test_sqlanywhere12;ASTART=NO;Host=dhhbgbfhsql101:2638',Driver='sybase.jdbc4.sqlanywhere.IDriver'"
That works fine on my development PC, when I make an executable and install, still runs fine from my development machine. When I attempt to run the same executable from another machine I get the following error:
SQLCA.sqlerrtext = "NON SQL Error: Could not load class sybase.jdbc4.sqlanywhere.IDriver"
Why won't it connect when I run the exe from another PC?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
69 | |
9 | |
8 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.