Connect to a external DB2 with ZendServer - php

I have been fighting with Zend Server 2018 while trying to connect to a remote AS/400 DB2.
I am using the IBM_DB2 php functions to do the connection but every time I get
[IBM][CLI Driver] SQL1031N The database directory cannot be found on the indicated file system. SQLSTATE=58031 SQLCODE=-1031
Anyone else successful connecting the two?
What I've read online is that I need to catalog the servers.
So I have db2 running on an iseries at say 192.168.50.1 with a name of X232321 and a Windows 10 box running zend server 2018.
What commands would I need to catalog the two servers so I can use the db2 connector? And what does that actually do?
Thanks for the help

Try this on the windows db2 client:
db2 "catalog tcpip node MY_IS remote 192.168.50.1 server 446"
db2 "catalog db MY_ALIAS at node MY_IS"
db2 "catalog dcs db MY_ALIAS as X232321"
You can set MY_IS, MY_ALIAS as you want (no more than 8 letters).
Port 446 may be different for your iSeries host.

Related

Cannot to connect to sql server through PHP

I have installed to a computer, MS SQL Server 2016 Developer Edition and created through Management Studio 17 an instance and a database. On another computer that runs IIS7, i enabled PHP extension through FastCGI and created an application.
In my application i try to run a php file with the following code:
<?php
$conn = mysql_connect('IP_OF_SQL_SERVER_INSTALLATION', 'USER_OF_SQL_DB', 'PASSWORD_OF_DB_USER', 'PORT_USED_FOR_SQL_APP')
or die('Error connecting to mysql: '.mysql_error());
?>
i wait for around 1 minute and then i get 500 - Internal server error. In SQL computer, i have enabled TCP/IP for my instance, i have opened ports 1433 (TCP) and 1434 (UDP) from windows firewall as inbound rules. Also i installed Management Studio 17 to another computer to the same network and when i try to connect from there, i get a connection. Any ideas on this?
Thank you in advance

how to connect sql server 2008 with eclipse helios using data source explorer

I'm trying to connect Sql Server 2008 database with Eclipse using database source explorer,
could you help me ?
in Eclipse->
Windows ->
open Perspective ->
others ->
Database Development ->
OK
I got DataSource Explores Screen, then
in database Connection->
rightClick ->
click new ->
connection` profile will open.
In that i have selected
sqlserver->
next ->
driver details ->
i have selected sqljdbc4.jar file because iam using jdk1.6
In next tab we can see properties like connection url and driver class my doute is my system is client system i want to connect with server my server name is SQL1. But in URL there is no ServerName.
it can't establish connection
Error: com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host localhost, port 1433 has failed. Error: "Connection refused: connect. Verify the connection properties, check that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port, and that no firewall is blocking TCP connections to the port
thank you
Seen this issue before. Copy sqljdbc_auth.dll to the working directory, should sort it.
Other than that SQL server isn't running, or it's a firewall issue. Or something else potentially is using that port.

Remote MySQL Connection in PHP

I'm beginning to migrate a software project from being a desktop application to a web application. Currently I am using a local PHP/MySQL connection that is associated with the desktop it is installed on.
I'm hoping to untangle this and am trying to create a MySQL database through my 1and1 account. I had no trouble creating a database and recorded my account information. I'd like to be able to edit this database using PHP scripts on my system. However, I haven't been able to get a working connection string going. When I run the following PHP script:
$hostname="db*********.db.1and1.com";
$database="db*********";
$username="dbo*********";
$password="*********";
$link = mysql_connect($hostname, $username, $password);
I get the following error when I run the script in my webbrowser:
Warning: mysql_connect() [function.mysql-connect]: Unknown MySQL server host 'db*********.db.1and1.com' (11001) in C:\Program Files\xampp\htdocs\Remote_MySQL\rightbid_database_initialize.php on line 74
Connection failed: Unknown MySQL server host 'db*********.db.1and1.com' (11001)
How do I get my local system to recognize the 1and1 server host? Am I structuring my connection string correctly? Is it possible to access a remote server from a locally hosted Windows PHP connection?
Thanks!
I assume what's happening if that 1&1 are blocking any connections coming from outside of their network.
Try connecting using
mysql -h HOST -u USERNAME -p DATABASENAME
Good luck
Make sure the MySQL server on 1and1 will accept connections from remote clients. Not just on localhost, and also make sure port 3306 is open to the server.

Cannot connect to SQL SERVER 2000

I am using php 5.3.1 to connect to my SQL SERVER 2000 on remote machine. I use Windows XP.
On using simple program like this:
$conn = mssql_connect("VBNET","sa","mypass") or die ( 'Can not connect to server' );
I get following error:
Warning: mssql_connect() [function.mssql-connect]: message: Login failed for user 'sa'. Reason: Not associated with a trusted SQL Server connection. (severity 14) in C:\wamp\www\Mssql\test.php on line 8
Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: VBNET in C:\wamp\www\Mssql\test.php on line 8
Can not connect to server
I enabled TCP/IP and named pipes in my SQL SERVER and restarted it. Also its Authentication is set to Mixed Mode Authentication.
I can see my server through MS SQL Server Management Studio. So what am I missing here ?
Thanks in advance.
P.S. I have another server in SQL SERVER 2008 to which I can easily connect with the same above mentioned connection string.
EDIT: According to this post, I fired sqlcmd -S np:\\VBNET\pipe\sql\query -U sa in cmd and entered the password and that worked !!! So now what could be the problem. I am at my wits end...please help !!
If you can connect using SSMS, then copy the connection exactly, i.e. make sure you specify a named instance (e.g. 'VBNET\SQLSERVER'). Open SSMS, on the server node on the left side right click and select 'Properties'.
If you have SQL 2008 running on the same machine it is most likely that SQL 2008 uses the default instance and SQL 2000 a named instance.
What also could help, i.e. make testing simpler is to create an empty UDL file (e.g. 'TEST.UDL'). An empty text file should do. Then double click on it, select the provider and play around with the settings. You can always test the connection using the 'Test connection' button. I use this trick when I have to connect from a customer PC for the first time.

Connecting to MSSQL server 2008 with PHP

We are using MSSQL server 2008 on Win server 2008 R2 and have installed Apache (2.2.19) and PHP (5.2.17) separately. We have installd the MSSQL module for PHP and usingthe following connection string:
$myc = mssql_connect(Server, SiteDatabaseUsername, SiteDatabasePassword) or die('Can\'t connect to mssql Database Server: '.mssql_get_last_message($myc));
$db = mssql_select_db(SiteDatabaseName, $myc) or die('Can\'t find database: '.mssql_get_last_message($myc));
But it gives us this error:
Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: localhost\MSSQLSERVER in D:\Apache2.2\htdocs\adminarea\_core.php on line 89
Can't connect to mssql Database Server:
We have used the IP:PORT, localhost\MSSQLSERVER and COMPUTERNAME\MSSQLSERVER but don't seem to be getting anywhere, can anyone help please?
A few things come to mind:
1) Make sure you have the sqlsrv driver package from MS, and make sure you're loading it properly in php.ini (use phpinfo() to verify).
2) If this was a vanilla installation of SQL Server, its likely that only windows authentication is turned on. Open the SQL Enterprise Manager and make sure you have SQL Server Authentication enabled on your database.
3) Make sure that you have enabled network access to SQL Server. I'm not immediately certain whether the new MS drivers use named pipes to communicate with the server, or if they expect that the server will be accessed via the network.
These are the issues I routinely encounter when getting PHP speaking to a new MSSQL server.

Categories